Skip to content

Secrets in the vault: keys agents' sandbox commands use but never see - #361

Merged
hkonsti merged 5 commits into
mainfrom
memory
Nov 23, 2026
Merged

hkonsti merged 5 commits into
mainfrom
memory

Conversation

@hkonsti

@hkonsti hkonsti commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Adds Secrets to the vault: API keys and tokens that agents' sandbox commands can use but agents never see. Memory, which was part of this PR, is now its own PR stacked on this one (#379).

Secrets

  • New vault collection secrets with a name (an env var name, unique per vault), a value and a note.
  • The value is never given to an agent. It's stripped from list, get, create and update results in agent-side/tools.ts via a new Field.secret flag, and left out of search.
  • New actions, both off by default:
    • Use secrets (high): sandbox_exec {secrets: ["NAME"]} gives the named secrets to the command as environment variables. If two vaults have the same name, the agent asks for vault/NAME. The log keeps only the names.
    • Save secrets (medium): add, replace and delete secrets without reading any back.
  • Masking stops accidental reads, not deliberate ones. On every sandbox_exec, whether or not it asked for secrets, the output has the values of every secret the agent may use shown as [secret NAME]. That covers a value one command wrote to a file and a later one printed. An agent that wants a value it was given can always get it, for example by encoding it. Use secrets means trusting that agent with the value, and the permission's description says so.
  • Values are saved without surrounding spaces and line breaks, so a pasted trailing newline doesn't stop masking from matching.
  • Agents with either action are told how secrets work in their instructions.
  • listOldVaultRecords no longer treats secrets as old data to convert.
  • Web: a Secrets tab on the vault page, with each value hidden until shown, plus copy, add, edit and delete.

Also

  • The vault's icon is a key instead of a library.
  • On a drive's page, the search and the trash, new folder and upload buttons sit on the tabs' row, so the empty row under the tabs is gone. The path ("Files › Folder") gets its own row only inside a folder or the trash. PageTabs takes an optional toolbar slot for this.

Not in this PR

Tests

  • api: secret values (picking, masking, env), sandbox_exec with secrets, secret values withheld from agents, updated catalog and tool lists.
  • web: the Secrets tab.
  • Typecheck, lint, and the api, web, integrations and db tests pass.

@hkonsti
hkonsti changed the base branch from main to hkonsti/google-large-document-upload November 20, 2026 21:57
Base automatically changed from hkonsti/google-large-document-upload to main November 20, 2026 22:06
A vault keeps secrets beside its entries: a name (an environment
variable's), a value and a note. An agent sees a secret's name and note,
never its value, which only the person reads, on the vault's page.

Use secrets gives the named secrets to a sandbox command as environment
variables (sandbox_exec {secrets}), and what the command writes back has
each value shown as [secret NAME]; Save secrets adds, replaces and
deletes them without reading any back. Both are off by default.
@hkonsti hkonsti changed the title Memory for agents, and secrets in the vault Secrets in the vault: keys agents' sandbox commands use but never see Nov 21, 2026
…immed

What a sandbox command writes back now has the values of every secret
the agent may use shown by their names, not only those the call asked
for: a value one command wrote to a file, another may print. Masking
keeps a value out of the agent's answers by accident; an agent set on
reading what its command is given can always, which the comments, the
agent's instructions and the secret's dialog now say.

A secret's value is kept without the spaces and line breaks around it,
which a paste brings along and a command's output may leave off.
Masking replaces every value in one pass, so a short secret's value is
never found again inside the [secret NAME] shown for a longer one.

A secret that can't be read is left out of what a command is given and
masked with, and logged, rather than failing every sandbox command of
every agent that may use the vault's secrets.

One name asked for from two vaults is refused: a command has one
variable of each name, and the second would quietly replace the first.

A secret's name is checked against the vault's others as it is written,
with the vault's other writes of secrets held off by a lock, so two at
once can't both take a name and leave neither usable.

Secret values are taken out of every tool's answer in one place, not in
each kind of tool, so a command on such a record can't answer with one.
@hkonsti
hkonsti merged commit 5b74acc into main Nov 23, 2026
3 checks passed
@hkonsti
hkonsti deleted the memory branch November 23, 2026 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant