Public: anyone can read this; the crew can change it.
An app secret's value is never in a page's HTML: the secrets page shows its name, last change and a Replace action #13154
Check · Review · Land · Live done — Landed and live in production.
Each row of an app's Environment card (Settings › App) now has a Replace action: a write-only password field and a button that posts the new value to the existing POST /:owner/:name/settings/app/env, which only accepts same-origin requests.
shipped production is serving it deploy 59903fa
3 earlier comments · 1 event
Each row of an app's Environment card (Settings › App) now has a Replace action: a write-only password field and a button that posts the new value to the existing POST /:owner/:name/settings/app/env, which only accepts same-origin requests. The app's own secrets live in app_env and are drawn by appEnvView() in src/web/pages/settings.ts, not in app_secrets.ts, so the change is there.
Before this, the value was already never rendered: the page, GET /api/v1/repos/:owner/:name/app/env and the MCP app_env list all return names, scope and updatedAt only. Each change was already recorded as an app.env_set event holding the actor and the time, with no value. So what's new is the Replace action plus a test that proves all of it.
test/app-secrets-value.test.ts:
- The page lists the secret's name, "set <time>", and a Replace form with a password input. This test fails without the change.
- After the secret is set, the value appears in none of the three answers: the settings page HTML, the API list and the MCP list.
- A cross-origin Replace is refused with 403 and records nothing.
- A same-origin Replace returns 303 and records
app.env_setwith the admin's id and a time. The new value is in no event payload and in none of the three answers.
The test first also expected a POST with no Origin header to be refused. That expectation was wrong: crossOrigin() in src/http/context.ts accepts a missing Origin on purpose, treating it as a non-browser client, so I removed it.
Not done:
- The row doesn't show who last changed a secret. The event records it, but showing it would need an event lookup per row.
- Replace is offered on plain variables too, keeping their kind. It's the same form, and it avoids a branch.
- No new MCP tool or action;
mcp-sizepasses. - I didn't keep a plan on the issue or record an estimate, because the
keep_planandestimatetools aren't available in this session.
docs/design/areas/settings.md now lists appEnvView() among the writers of .row-fields; no new class was added.
Checks run: scripts/gate.ts, tsc --noEmit and design-lint are clean. scripts/fast.ts picked 1922 test files, too many to run here, so I ran the 8 that cover this change: the new test, app-secrets-web, mcp-size, mcp-app-env, forge-box-unit, fresh-app, app-settings-page and web-apps. All 68 tests pass.
To try it: open an app's Settings › App, find a secret under Environment, type a new value beside it and press Replace. The row's "set" time updates, and the value appears nowhere on the page.
🤖 Generated with Claude Code
An app's secret value no longer appears in any page, API answer or MCP answer. Each secret's row under Settings › App › Environment now has its own Replace field: you type a new value there instead of seeing the old one.
The check failure: the forge's before/after-looks rule fails when a pull changes src/web/pages/settings.ts and no commit names a page from app.looks (the pages the forge photographs, in forge.json) or gives a reason with "No look:". None of those pages shows an app's Environment section, which needs a real app with secrets. So I added an empty commit with a No look: line saying that; no code changed. bun scripts/gate.ts now passes. I did not re-run the type check or tests, since that commit changes no files.
To try it: open an app's Settings › App, find a secret under Environment, type a new value beside it and press Replace. The secret's value should not show up in the page source or in the API's answer.
🤖 Generated with Claude Code
This pull lets you replace an app secret from its own row in Settings › App › Environment. A secret's value appears in no page, no API answer and no MCP answer: you can set a new value, but nothing ever shows it back to you.
The last push failed main's comment-width rule (100 columns) in src/web/pages/settings.ts. That rule came in on main through scripts/gate.ts after this branch was cut, so this push merges main in. Running bun scripts/gate.ts --fix then rewrapped one comment, in autonomySettingsUpdate. That comment came from main through the merge, not from this pull. No behaviour changed.
Before pushing, the gate, bun x tsc --noEmit and bun scripts/design-lint.ts passed. I didn't run the files scripts/fast.ts named: the merge with main touched 1,924 test files, about 163 minutes of tests. I ran the 8 settings and secrets test files instead (app-secrets-value, app-secrets-web, app-secrets, app-settings-page, mcp-secrets, settings-secret-delete, secrets-card, settings-app-domains), and all 36 tests passed. The forge runs the full check on this push.
To try it on the preview: open an app's Settings › App, find a secret under Environment, type a new value beside it and press Replace. The page confirms the change without ever showing the value.
🤖 Generated with Claude Code
Behaviour is right: the Replace form posts to the existing same-origin route, value is absent from page, API and MCP, and the event holds actor and time without the value. The terminal already sets/replaces via src/tui/screens/appenv.ts, so both doors exist. One miss: docs/features/app-secrets.md (the how-to) does not say that a secret is replaced from its row on the page (and with the terminal screen), and that the value is never shown back. Add that. Also: Replace is offered on plain variables, whose value the row prints; either limit the form to secrets (the issue is about secrets) or say so in the doc. Drop the unrelated comment rewrap in autonomySettingsUpdate if the gate permits it.
An app secret is now replaced from its row under Settings › App › Environment, and its value is never in a page, an API answer or an MCP answer. The row shows the secret's name, scope and when it last changed, with a password field and Replace. Replace sends a same-origin POST to the existing settings/app/env route. The change is logged as an app.env_set event with who made it and when, never the value.
This push, after review:
- Replace is for secrets only. The form appears only when
kind === "secret"(src/web/pages/settings.ts,appEnvView). A plain variable's value is already printed in its row, so it is set again with the form under the list.
- New test in test/app-secrets-value.test.ts: a variable's row has no Replace form. It fails on the old code.
- The how-to now covers replacing.
docs/features/app-secrets.mdhas a "Replacing a secret" section. It says:
- a secret is replaced from its row; - its value is never shown back; - Replace is for secrets only.
- The terminal docs. The terminal section now says that setting an existing name again in Variables (
src/tui/screens/appenv.ts) replaces its value. It uses the samesetAppEnvVarupdate-or-insert. The section also says the list never shows a secret's value. - The comment rewrap in
autonomySettingsUpdatestays. The gate doesn't permit dropping it: with the comment back at 101 columns,bun scripts/gate.tsfails the 100-column rule. The overlong line came from main, but this pull changessettings.ts, so that rule covers the whole file.
Checks: the gate, bun x tsc --noEmit and bun scripts/design-lint.ts pass. The settings, secrets and app-env test files all pass: 14 files, 74 tests. I didn't run the files scripts/fast.ts names, because it names 1,924 of them since the earlier merge with main.
To try it on the preview:
- Open an app's Settings › App › Environment.
- On a secret's row, type a new value and press Replace. The page confirms the change without ever showing the value.
- A plain variable's row has no Replace field.
🤖 Generated with Claude Code
Both earlier asks are met. Replace is now offered on secrets only, and docs/features/app-secrets.md gains a Replacing a secret section and the terminal note. The new test fails without the Replace form. The value is absent from the page, the API and MCP answers, and the event holds the actor and time but not the value. The same-origin check is covered. The change reuses .row-fields and adds no class. The terminal door already replaces through Variables, and the how-to is in docs/features, not the README. Nothing blocking.
Each row of an app's Environment card (Settings › App) now has a Replace action: a write-only password field and a button that posts the new value to the existing
POST /:owner/:name/settings/app/env, which only accepts same-origin requests. The app's own secrets live inapp_envand are drawn byappEnvView()insrc/web/pages/settings.ts, not inapp_secrets.ts, so the change is there.Before this, the value was already never rendered: the page,
GET /api/v1/repos/:owner/:name/app/envand the MCPapp_envlistall return names, scope andupdatedAtonly. Each change was already recorded as anapp.env_setevent holding the actor and the time, with no value. So what's new is the Replace action plus a test that proves all of it.test/app-secrets-value.test.ts:app.env_setwith the admin's id and a time. The new value is in no event payload and in none of the three answers.The test first also expected a POST with no
Originheader to be refused. That expectation was wrong:crossOrigin()insrc/http/context.tsaccepts a missing Origin on purpose, treating it as a non-browser client, so I removed it.Not done:
mcp-sizepasses.keep_planandestimatetools aren't available in this session.docs/design/areas/settings.mdnow listsappEnvView()among the writers of.row-fields; no new class was added.Checks run:
scripts/gate.ts,tsc --noEmitanddesign-lintare clean.scripts/fast.tspicked 1922 test files, too many to run here, so I ran the 8 that cover this change: the new test,app-secrets-web,mcp-size,mcp-app-env,forge-box-unit,fresh-app,app-settings-pageandweb-apps. All 68 tests pass.To try it: open an app's Settings › App, find a secret under Environment, type a new value beside it and press Replace. The row's "set" time updates, and the value appears nowhere on the page.
🤖 Generated with Claude Code
Closes #13142