Skip to content

feat(secrets): /secform shares named secrets with a thread or bot, with expiry, single use and a revocable chip - #2539

Merged
TheAnimatrix merged 8 commits into
masterfrom
secform
Dec 1, 2026
Merged

TheAnimatrix merged 8 commits into
masterfrom
secform

Conversation

@TheAnimatrix

Copy link
Copy Markdown
Collaborator

Problem

To give an agent or a bot a key, password or token, the person had to wait for it to ask with secret_request, one value per card. There was no way to hand over several secrets up front without typing them into the chat.

Change

  • /secform in the composer of agent threads and bot chats. /secform opens one field, /secform 3 three, and /secform for email, password and openrouterkey three named fields: Email (EMAIL, shown as typed), Password (PASSWORD) and Openrouter API key (OPENROUTER_API_KEY), both hidden with show/hide. The fields are read in the composer (parseSecform), never by a model. The / list keeps the row while the fields are typed ("Opens a form for Email, Password, Openrouter API key"), and Enter opens the form.
  • The form: named rows, Add field, remove, Expires (1 hour, 1 day, 7 days, Never), Who can use it (this thread, or a bot of this computer), Single use, Cancel and Save securely. A thread of another computer shows "Stored on ".
  • Values go only to the secret store of the computer that runs the thread (secrets.share → SecretShares → SecretVault), all or none. Names already taken get the next free name; names that commands already use (PATH, NODE_OPTIONS, ...) are refused. A Never secret is kept for its thread or bot only and is not offered to other threads as a saved key.
  • The agent or bot is told the names only: a quiet note it reads with its next turn (postNote with attention: 'none' for a thread; a Mousse line in a bot's chat). It never starts a turn. The wording (secretShareNote) was reviewed by three independent reviewers; it says the note asks for nothing, gives the end as a time, shows only the secret_run environment-variable route, and for single use says the first secret_run that names it uses it up, so not to test it first.
  • Chip in the chat: "Shared N secrets: NAMES · expires in …" with Revoke, reading saved, expired or revoked. Revoke deletes the values at once. Removing them in Settings reads revoked; a used-up single-use secret reads expired.
  • Single use: never given as a readable file, deleted by its first secret_run. Its command's output is masked with a masker built before the use is counted.
  • Another computer: secrets.share, secrets.shares.list and secrets.shares.revoke are routed thread rows, so a form for a thread of another computer is filled in here and sent once over the encrypted link to that computer's store. Only a person at a Mousse window (here, or another of the user's computers) may call them; agents may not. The values travel in their own key (values), which the owner's request ledger leaves out of its retry match (ROUTED_SECRET_KEYS), so no hash of a value is kept there. The other secret methods stay local.
  • Settings → Agents → Secrets rows follow the approved mocks: "From /secform", who may use it, "expires in …" or "never expires", "single use", "last used today", and a Revoke button (confirms once) in place of the bin.

How to review

  1. src/shared/secform.ts: parser, options, chip words.
  2. src/mms/secrets/SecretShares.ts, SecretVault.ts (expiry, single use, share id), registerMethods.ts (who may call), secretShareNote.ts.
  3. Wiring: MousseMainService.ts, OrchestratorService.recordSecretShare, BotChatService.postSecretShare, bot chat projection.
  4. Routing: shared/bridge/routed.ts, OwnerRoutes.ts (ledger match).
  5. Renderer: SecformCard.tsx, SecretShareChip.tsx, OrchestratorChat.tsx, BotChatView.tsx, composer and bot commands, SecretsSettings.tsx.

The risk is in step 2 and 4: where values may go. tests/secrets/secformWiring.test.ts boots the real service, shares a value from a window and checks that only the secret store file holds it afterwards.

Verification

Tier 5. On a90b2da:

  • node scripts/verify.mjs tests/secrets/secretShares.test.ts tests/secrets/secformWiring.test.ts tests/secrets/secretVault.test.ts tests/secrets/keepPasted.test.ts tests/secrets/keepPastedWiring.test.ts tests/secrets/secretRequestNoLeak.test.ts tests/secrets/botSecretContainment.test.ts tests/secrets/terminalRetiredSecrets.test.ts tests/secrets/serviceBinding.test.ts tests/shared/secform.test.ts tests/slashCommands.test.ts tests/composerSlashSkills.test.ts tests/renderer/botCommands.test.ts tests/renderer/botChatShape.test.ts tests/renderer/boundSecretsSettings.test.ts tests/renderer/secretRequestCard.test.ts tests/renderer/secformCard.test.ts tests/mousseToUI.test.ts tests/mmsProtocolServer.test.ts tests/net/bridge/routed/table.test.ts tests/net/bridge/routed/owner.test.ts tests/bots/botServiceLines.test.ts tests/platformWorkflowInvocation.test.ts tests/renderer/threadTags.test.ts --typecheck all: 511 tests passed, 5 known failures (on master too: botMarks and serviceBinding tests fail on Windows #2210, and Two secret tests fail on Windows (printf in keepPasted; secretRequestCard times out cold) #2537 filed here for two Windows secret tests, listed in tests/known-failures.json); both typechecks clean.
  • Isolated development app on macOS (its own home, no sign-ins), driven by automation: the / row, the named form (Email plain, the others masked), /secform 3, Add field and remove, Save securely off until every field has a value, the saved chip, Revoke to revoked, the Settings rows, and /secform in a bot chat with its chip. A search of the whole development home found the made-up values only in the secret store file, and nowhere after Revoke. That check also caught the form opening empty under React Strict Mode, fixed in 895d269 with a test.
  • Merges cleanly with feat(composer): # tags a thread on any of your computers, and its link names the computer #2535 (# tags), now on master; its tests pass here.
  • Not checked by hand: a thread on another computer (two paired development apps). The routed rows are covered by the routed table tests and tests/secrets/serviceBinding.test.ts.

Notes

A bot that lives on another computer is not offered the form yet: its chat says to share from that computer. It needs a remote bot method of its own, and comes next as a separate PR.

Refs #595

@TheAnimatrix

Copy link
Copy Markdown
Collaborator Author

Screenshots from an isolated development app on macOS (Mousse Dark).

/ list while the fields are typed

/ list while the fields are typed

Named form as it opens

Named form as it opens

Filled, values hidden

Filled, values hidden

/secform 3

/secform 3

Saved chip

Saved chip

Revoked

Revoked

Settings → Agents → Secrets

Settings → Agents → Secrets

In a bot chat

In a bot chat

@TheAnimatrix
TheAnimatrix merged commit 7ea7fc2 into master Dec 1, 2026
9 checks passed
@TheAnimatrix
TheAnimatrix deleted the secform branch December 1, 2026 09:48
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