<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: necromancer</title>
    <description>The latest articles on DEV Community by necromancer (@necromancer123).</description>
    <link>https://dev.to/necromancer123</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4262348%2F4c517722-68bb-4eec-ac15-a1b001a3525c.jpg</url>
      <title>DEV Community: necromancer</title>
      <link>https://dev.to/necromancer123</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/necromancer123"/>
    <language>en</language>
    <item>
      <title>I built a .env file my AI agent can use but never read</title>
      <dc:creator>necromancer</dc:creator>
      <pubDate>Tue, 24 Nov 2026 10:11:21 +0000</pubDate>
      <link>https://dev.to/necromancer123/i-built-a-env-file-my-ai-agent-can-use-but-never-read-4fei</link>
      <guid>https://dev.to/necromancer123/i-built-a-env-file-my-ai-agent-can-use-but-never-read-4fei</guid>
      <description>&lt;p&gt;AI coding agents are great at calling APIs. To do that, they need API keys. And the easiest place to put a key is a &lt;code&gt;.env&lt;/code&gt; file in the project, which the agent can read like any other file. From there the key ends up in the agent's context, in the chat history, in logs, and sometimes in code it writes.&lt;/p&gt;

&lt;p&gt;I wanted my agent to &lt;em&gt;use&lt;/em&gt; my secrets without ever &lt;em&gt;seeing&lt;/em&gt; them. So I built &lt;strong&gt;facedown&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  How it works
&lt;/h2&gt;

&lt;p&gt;Secrets live in one file in your project, &lt;code&gt;.env.facedown&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ini"&gt;&lt;code&gt;&lt;span class="c1"&gt;# @desc token for the GitHub API
# @allow api.github.com
&lt;/span&gt;&lt;span class="na"&gt;GITHUB_TOKEN&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;enc&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;v2&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;8kZ0&lt;/span&gt;…
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Names, notes and allowed sites are plain text.&lt;/strong&gt; The agent reads them to know what exists.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Values are encrypted&lt;/strong&gt; (AES-256-GCM). The key isn't in the project: it's in your home folder, locked to your Windows account with DPAPI.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;There's no command that prints a value.&lt;/strong&gt; A secret only ever goes to two places: the environment of a program you run, or an outgoing web request.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The agent gets MCP tools instead of the values:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;run_with_secrets&lt;/code&gt;: runs a command with the keys it names as environment variables.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;http_request&lt;/code&gt;: sends a request with &lt;code&gt;{{GITHUB_TOKEN}}&lt;/code&gt; placeholders that facedown fills in.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;add_key&lt;/code&gt;: opens a small window on &lt;em&gt;your&lt;/em&gt; screen where &lt;em&gt;you&lt;/em&gt; type the value.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Printing a secret is fine
&lt;/h2&gt;

&lt;p&gt;Your code can log a secret while debugging. The output just shows which key it was:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[debug] using token ***GITHUB_TOKEN*** | as base64: ***GITHUB_TOKEN:base64***
facedown: note: hid the value of GITHUB_TOKEN (2x) in the output.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Base64, hex and every common URL encoding are caught. A random stress test throws thousands of secrets, encodings, split chunks and pauses at the cleaner on every commit. It already found one real leak (two overlapping secrets), which is fixed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Each key has a list of sites
&lt;/h2&gt;

&lt;p&gt;A key can only be sent to the hosts on its list. A new key has none. Adding a site opens a confirmation window that only a click on &lt;strong&gt;Allow&lt;/strong&gt; approves; Enter means Cancel. And the list is part of the encryption: if something edits &lt;code&gt;# @allow&lt;/code&gt; by hand, that key stops decrypting instead of being sent to the new site.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it doesn't do
&lt;/h2&gt;

&lt;p&gt;It's a seat belt, not a vault door. An agent with a full shell that is &lt;em&gt;deliberately&lt;/em&gt; trying to steal a secret can get around it: it runs as you, so it could scramble the value before printing it, or unlock the key file the same way facedown does. The strongest setup is an agent with only the &lt;code&gt;http_request&lt;/code&gt; tool and no shell. Then the allowed-sites list is a real wall.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try to break it
&lt;/h2&gt;

&lt;p&gt;I think the rest holds, so there's a challenge: a script puts a random flag into a demo vault (nobody ever sees it), and you try to get it out through normal use. Rules and setup: &lt;a href="https://github.com/necromancer124/facedown/blob/main/docs/CHALLENGE.md" rel="noopener noreferrer"&gt;docs/CHALLENGE.md&lt;/a&gt;. Reports go through GitHub's private vulnerability reporting, and finders get credited.&lt;/p&gt;

&lt;h2&gt;
  
  
  Get it
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Claude Code: &lt;code&gt;/plugin install facedown --marketplace necromancer124/facedown&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Anywhere else: &lt;code&gt;npx facedown help&lt;/code&gt;, and &lt;code&gt;facedown mcp&lt;/code&gt; for any MCP client. It's also in the official MCP Registry as &lt;code&gt;io.github.necromancer124/facedown&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Windows for now; Linux and macOS are planned after 1.0. Node 20+, no dependencies, MIT.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Repo: &lt;a href="https://github.com/necromancer124/facedown" rel="noopener noreferrer"&gt;https://github.com/necromancer124/facedown&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Feedback welcome, especially "this broke" or "this was annoying" u know the good stuff.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>security</category>
      <category>mcp</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
