Public: anyone can read this; the crew can change it.

The terminal lists a forge admin's sealed secrets by name and sets or removes one, never showing a value #7245

opened this

Merged 39d 5h ago, live in production

A forge admin can now open "Secrets" from the terminal palette. It lists sealed secret names with set and last-read times, and sets or removes one. Values are never shown.

Notes

opened this

A forge admin can now open "Secrets" from the terminal palette. It lists sealed secret names with set and last-read times, and sets or removes one. Values are never shown.

tsc --noEmit, test/tui-secrets.test.ts and test/mcp-size.test.ts pass, and design-lint is clean. scripts/fast.ts named 141 test files (about 11 minutes, over the 5-minute budget), so I did not run them; the forge's check on this push covers them.

  • List: the screen is src/tui/screens/secrets.ts, opened from an entry in src/tui/forge.ts shown only to a forge admin. It shows the forge scope first, and s switches to org NAME or repo OWNER/NAME.
  • Set (a): it asks for a place (empty means the one in view), then a name, then the value in a masked field. The value goes straight to putSecret and is never held, drawn or logged.
  • Remove (d): it asks for a confirm, with Cancel selected by default.
  • Refusals: an invalid name, an empty or oversized value, an unknown org or repo, and a missing secret each read in the screen's own words.
  • Gate: a member gets no palette entry. If a member drives the screen directly, it shows and changes nothing.
  • Test: test/tui-secrets.test.ts covers set, the list showing the name, remove after a confirm, and a member without the entry. It also checks refusals set nothing, and that no frame or event row contains the value.

Left out: viewing or editing a secret's value (the action has no read path, by design), and mouse support on this screen. The MCP is untouched, so no ceiling moved.

Closes #7238

2 earlier comments
commented

A forge admin can now open "Secrets" from the terminal palette. It lists sealed secret names with set and last-read times, and sets or removes one. Values are never shown.

tsc --noEmit, test/tui-secrets.test.ts and test/mcp-size.test.ts pass, and design-lint is clean. scripts/fast.ts named 141 test files (about 11 minutes, over the 5-minute budget), so I did not run them; the forge's check on this push covers them.

  • List: the screen is src/tui/screens/secrets.ts, opened from an entry in src/tui/forge.ts shown only to a forge admin. It shows the forge scope first, and s switches to org NAME or repo OWNER/NAME.
  • Set (a): it asks for a place (empty means the one in view), then a name, then the value in a masked field. The value goes straight to putSecret and is never held, drawn or logged.
  • Remove (d): it asks for a confirm, with Cancel selected by default.
  • Refusals: an invalid name, an empty or oversized value, an unknown org or repo, and a missing secret each read in the screen's own words.
  • Gate: a member gets no palette entry. If a member drives the screen directly, it shows and changes nothing.
  • Test: test/tui-secrets.test.ts covers set, the list showing the name, remove after a confirm, and a member without the entry. It also checks refusals set nothing, and that no frame or event row contains the value.

Left out: viewing or editing a secret's value (the action has no read path, by design), and mouse support on this screen. The MCP is untouched, so no ceiling moved.

commented

All three of sentinel's changes and the nit are in. tsc --noEmit, design-lint and test/tui-secrets.test.ts pass. I also ran test/tui-model.test.ts, test/tui-input.test.ts and test/tui-widgets.test.ts, which cover the promptScreen change. They passed in the run before my last test edit; I did not re-run them after it.

  1. Verbatim value (high). promptScreen now has mask keep its value as typed or pasted. It is not trimmed on submit, and a paste keeps its newlines. The one change is that CR and CRLF become LF. Unmasked prompts behave as before; the other masked prompt, the model token in model.ts, already trims its own input. A new test pastes a two-line PEM with leading and trailing whitespace and reads it back through resolveSecrets. The value comes back exactly as pasted.
  2. Unknown place (medium). The s prompt now calls listSecrets before accepting a place. org nosuchorg keeps the prompt open with "No such organization or repository." A test covers it.
  3. Docs (medium). A "Secrets in the terminal" section is in docs/OPERATING.md, and a line in docs/TOUR.md links to it. I did not edit the README. Neither it nor the tour lists individual palette screens; the Flags and Trusted hosts terminal behaviour is documented in docs/OPERATING.md, so Secrets follows that.
  4. Name nit. The name prompt checks isSecretName, the same rule setSecret uses. A bad name is refused before the value is asked for, and the test checks that the value prompt never opens.

I rewrote one existing test to fit. Its unknown-org case used a lowercase name, which the new check refuses first, so it now uses a valid name and still reaches the "No such organization or repository." refusal.

commented

The cloud add and rotate prompts now trim the pasted token before calling addAccount and rotateAccount, as the page does. tsc --noEmit is clean. test/cloud-doors.test.ts and test/tui-secrets.test.ts pass, and I did not run the rest of the suite.

My earlier note that model.ts held the only other masked prompt was wrong. cloud.ts has two more, at the add and rotate prompts. They relied on promptScreen trimming masked values, which it no longer does.

The change is in src/tui/screens/cloud.ts, at both onSubmits. test/cloud-doors.test.ts now pastes "<T1>\n" into the add prompt and " <T2>\n" into the rotate prompt. It reads each sealed value back through resolveSecrets and checks it equals the bare token. I wrote the test against the real fetch stub, not a stubbed verify: the stub accepts a token with a trailing newline, so only the sealed-value check would catch an untrimmed value.

The Secrets screen is unchanged and keeps its value verbatim, since the page's secrets form stores it verbatim too.

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs