<?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: Container</title>
    <description>The latest articles on DEV Community by Container (@c0nt8r).</description>
    <link>https://dev.to/c0nt8r</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%2F4152900%2F88d64650-1397-43e5-8d1b-6109845090db.jpg</url>
      <title>DEV Community: Container</title>
      <link>https://dev.to/c0nt8r</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/c0nt8r"/>
    <language>en</language>
    <item>
      <title>Your AI agent shouldn't see your API keys</title>
      <dc:creator>Container</dc:creator>
      <pubDate>Mon, 16 Nov 2026 18:09:14 +0000</pubDate>
      <link>https://dev.to/c0nt8r/your-ai-agent-shouldnt-see-your-api-keys-2nei</link>
      <guid>https://dev.to/c0nt8r/your-ai-agent-shouldnt-see-your-api-keys-2nei</guid>
      <description>&lt;p&gt;Three incidents from the past month made me rethink where my agents keep secrets.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Cursor.&lt;/strong&gt; Coding-agent traces stolen in a breach contained users' credentials. The attacker used them to reach other services.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Phala, a provider behind OpenRouter.&lt;/strong&gt; The attacker could see request contents, and tokens from those requests were later misused.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;LLM routers.&lt;/strong&gt; A recent study tested 428 third-party routers. Nine of them swapped the model's tool calls for malicious ones.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Anthropic and OpenAI probably have some of the best security in the world. Smaller providers can be breached, and then a malicious tool call runs on your machine.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where keys usually live
&lt;/h2&gt;

&lt;p&gt;Usually keys sit where the agent can reach them. In Hermes, for example, they are stored on disk next to the token for remote server access.&lt;/p&gt;

&lt;p&gt;The agent adds them to requests without reading them. But even strong models slip. A file holds JSON, and the model decides it's an env file. Every now and then Claude Code tells me it accidentally read a secret.&lt;/p&gt;

&lt;p&gt;Still, agents need secrets. They already handle customer requests, work with repositories and monitor servers, and that list will only grow.&lt;/p&gt;

&lt;p&gt;So I built den, a personal agent that runs on your own machine and that you can trust with your accounts. It handles the problem in three ways.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. The agent never sees keys
&lt;/h2&gt;

&lt;p&gt;The agent runs with limited permissions and talks to the outside world through den's daemon. Say it needs to check a Grafana dashboard. It sends a plain request, and den's proxy adds the authorization header.&lt;/p&gt;

&lt;p&gt;The token is bound to the Grafana host, so it can't be sent anywhere else.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fx6jkh4azsvwnhmmhcpj9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fx6jkh4azsvwnhmmhcpj9.png" alt="How den keeps API keys from the agent" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Risky actions wait for your tap
&lt;/h2&gt;

&lt;p&gt;The agent can read everything and change what it created itself. It pushes to its own branches freely, but asks before merging or pushing to main. It also asks before sending anyone an email.&lt;/p&gt;

&lt;p&gt;Tapping Allow all the time gets tiring. So you can allow one kind of action for good, or give the agent an hour for all changes to one service or repository. Deletions still ask.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmg0n6yvyaqiqjc10z44q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmg0n6yvyaqiqjc10z44q.png" alt="Allow/Deny request in Telegram" width="799" height="585"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  3. The agent lives in a container
&lt;/h2&gt;

&lt;p&gt;I already ran my agents in a sandbox or a Docker container. den does it for you, on your computer or a server.&lt;/p&gt;

&lt;p&gt;On a Mac the isolation is stronger. On Linux a container shares the kernel with the host. With Apple container, each container gets its own lightweight VM with its own kernel.&lt;/p&gt;

&lt;p&gt;It's also light. At idle, den itself takes about 20 MB and the whole container about 72 MB. The headless browser and speech-to-text start only when a task needs them.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it doesn't protect against
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The agent has full internet access inside the container. A prompt injection can make it leak whatever it reads.&lt;/li&gt;
&lt;li&gt;A breached provider still means rotating your keys.&lt;/li&gt;
&lt;li&gt;An OS-level vulnerability could let the agent escape its permissions and reach your secrets.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Nothing is 100% safe. The goal is to make an attack much harder.&lt;/p&gt;

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

&lt;p&gt;den works with most model providers and subscriptions. Claude Pro/Max runs through the official claude CLI.&lt;/p&gt;

&lt;p&gt;Setup is one command. You need a Telegram bot (the current interface) and a model key.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -fsSL https://raw.githubusercontent.com/unsady/den/main/install.sh &lt;span class="o"&gt;|&lt;/span&gt; sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://github.com/unsady/den" rel="noopener noreferrer"&gt;https://github.com/unsady/den&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The project is young, and I want to hear where this threat model leaks. And a question for you. What would you let an agent do without asking?&lt;/p&gt;

</description>
      <category>ai</category>
      <category>security</category>
      <category>opensource</category>
      <category>showdev</category>
    </item>
    <item>
      <title>I wanted a SQLite job queue that felt like a library</title>
      <dc:creator>Container</dc:creator>
      <pubDate>Fri, 02 Oct 2026 16:52:15 +0000</pubDate>
      <link>https://dev.to/c0nt8r/i-wanted-a-sqlite-job-queue-that-felt-like-a-library-44j7</link>
      <guid>https://dev.to/c0nt8r/i-wanted-a-sqlite-job-queue-that-felt-like-a-library-44j7</guid>
      <description>&lt;p&gt;I run several small projects on one small server. For an application that needs to send emails or run a few background tasks, adding Redis means another service to configure, deploy, and keep running.&lt;/p&gt;

&lt;p&gt;I wanted to install a package, give it a SQLite connection, and start a worker.&lt;/p&gt;

&lt;p&gt;That became &lt;strong&gt;walq&lt;/strong&gt;, a TypeScript job queue backed by SQLite.&lt;/p&gt;

&lt;h2&gt;
  
  
  A small API
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;Database&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;better-sqlite3&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Queue&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@walq/core&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;betterSqlite3&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@walq/better-sqlite3&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;db&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Database&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;app.db&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;queue&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;Queue&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;emails&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;storage&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;betterSqlite3&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;db&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;

&lt;span class="nx"&gt;queue&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;process&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;userId&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;sendWelcomeEmail&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;

&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;queue&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;42&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The queue can share the application's SQLite database or use its own file. In either case, there is no separate queue server to deploy. Integration tests can use a temporary database and run the real worker.&lt;/p&gt;

&lt;h2&gt;
  
  
  More than a tasks table
&lt;/h2&gt;

&lt;p&gt;Storing a task is straightforward. Making sure it survives a crashed worker, and keeping completed tasks from filling the database, takes more work.&lt;/p&gt;

&lt;p&gt;These are some of the details walq handles:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Situation&lt;/th&gt;
&lt;th&gt;What walq does&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;A worker crashes&lt;/td&gt;
&lt;td&gt;Makes its tasks available again after their leases expire&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A handler takes a long time&lt;/td&gt;
&lt;td&gt;Renews its lease automatically&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A handler fails&lt;/td&gt;
&lt;td&gt;Supports configurable retries and backoff&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Completed tasks accumulate&lt;/td&gt;
&lt;td&gt;Removes them automatically in bounded batches&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;You need to investigate failures&lt;/td&gt;
&lt;td&gt;Keeps the latest 100 failed tasks by default&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Lease recovery means a task can run more than once. A worker might send an email and crash before recording completion, so handlers need to account for repeated execution.&lt;/p&gt;

&lt;h2&gt;
  
  
  Options where you need them
&lt;/h2&gt;

&lt;p&gt;Priority, deduplication, and grouping are task options:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;queue&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;42&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;priority&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;dedupe&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;welcome:42&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;group&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;customer:7&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Priority lets urgent work move ahead. A dedupe key prevents another task with the same key from being added to that queue until the existing task is removed.&lt;/p&gt;

&lt;p&gt;Groups are useful when many independent customers share the same worker. If one customer queues 10,000 tasks, walq rotates between available groups using round-robin selection instead of letting that backlog monopolize the worker. By default, only one task per group can be active at a time.&lt;/p&gt;

&lt;p&gt;Walq also supports delayed tasks, schedules, and batch processing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keeping SQLite responsive
&lt;/h2&gt;

&lt;p&gt;Synchronous SQLite calls can block the application's event loop, even when the queue uses its own database file.&lt;/p&gt;

&lt;p&gt;Walq splits claims into bounded transactions and yields to the event loop between them. Smaller transactions alone are not enough: if they run back-to-back, the application still waits for the entire sequence.&lt;/p&gt;

&lt;p&gt;In a benchmark with 256 queues and 131,072 ready tasks:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Implementation&lt;/th&gt;
&lt;th&gt;Longest blocking interval, p95&lt;/th&gt;
&lt;th&gt;Tasks claimed/sec&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Prototype: one large transaction&lt;/td&gt;
&lt;td&gt;86 ms&lt;/td&gt;
&lt;td&gt;53,100&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Prototype: smaller transactions, no yielding&lt;/td&gt;
&lt;td&gt;90 ms&lt;/td&gt;
&lt;td&gt;51,500&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Current adapter: smaller transactions with yielding&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;20 ms&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;50,600&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The current adapter retained roughly &lt;strong&gt;95% of claim throughput&lt;/strong&gt; while giving the application more frequent opportunities to run other work.&lt;/p&gt;

&lt;p&gt;The 20 ms figure is the p95 duration of an individual blocking interval, not the duration of the whole claim call. The complete claim call still took about 89 ms p95.&lt;/p&gt;

&lt;p&gt;These results compare a prototype with the current adapter, whose scheduling logic also differs. They measure claims and event-loop turns, rather than handler throughput or HTTP latency.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Apple M1 Pro, Node 24, SQLite WAL/FULL, no competing writer. Figures are medians across five runs.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Cleanup follows the same principle: delete a bounded batch, then return control to the event loop.&lt;/p&gt;

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

&lt;p&gt;If your application and workers run on one server, walq lets you add background processing with a package and a SQLite file.&lt;/p&gt;

&lt;p&gt;SQLite still has a single writer. For workers spread across multiple machines, a separate queue service may be a better fit.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; @walq/core @walq/better-sqlite3 better-sqlite3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Start with the usage examples on &lt;a href="https://github.com/unsady/walq" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>sqlite</category>
      <category>typescript</category>
      <category>showdev</category>
      <category>node</category>
    </item>
  </channel>
</rss>
