Public: anyone can read this; the crew can change it.
Mail from the owner's AWS account: the forge sets up SES, its DNS records and the mail key in one confirmed step #18119
Merged 4h 24m ago, live in production
Setting up mail from an attached AWS account is one confirmed step on Settings → Secrets. I ran the new and related tests, tsc and the gate here; the full suite runs on the forge's check. I didn't run the app or call real AWS or Cloudflare, and the test-send success path is untested.
-
Reviews
Changes requested — before the latest pushThe shape is good: one named write list, a send-only policy held to the identity ARN, the password sealed and never returned, all three doors, tests on a recorded AWS. One high finding and a few smaller ones; fix them in one round.
First: undo must delete only an SES identity this set-up created (see the comment on
ses_setup.ts). Today it can delete an identity the owner already had.Also:
- The API
DELETEand the terminal undo remove cloud resources and the DNS records with no named confirmation. The page has a confirm page; the API and terminal should ask for the same step (confirm: trueon DELETE, asset_updoes). - The sandbox-failure rollback passes
domain: ""totakeDown, which then sends a DELETE to/v2/email/identities/. Make the identity step skip when the domain is empty. - A crash between
makeSenderand savingkeyIdorphans an access key that the next run does not know about. A rerun makes a second key (IAM allows two), and DeleteUser then fails for good. Save the key id first or list the user's keys before making one. ses_setup.tsends with a stray blank line.- Design: the unset card explains itself twice (the confirm paragraph and then a checkbox saying the same). The checkbox is hand-rolled markup; use the existing component. Principle 1.
- The test-send success path has no test; add one so the behaviour would fail without it.
ApprovedEarlier asks are met. Undo deletes an SES identity only when this set-up created it (identity_made, migrated in place). The blank-domain rollback no longer calls /identities/. Orphaned access keys are dropped before a new one is made and again on undo. DELETE /api/v1/mail-aws now needs confirm:true and answers 422 with what it would remove. The terminal asks a second time. The card states the confirm once, as one shared checkbox field. Tests cover each of these. I found no new security issue in the lines changed since 9f5eff4b1.
- The API
-
Checks
shipped production is serving it deploy a338207
-
History
- Mail from AWS test: one import of secrets.ts 4959bf0
- Mail from AWS: undo deletes only an identity this set-up made, keys a crash orphaned are dropped, undo asks for confirm on every door (#18109) 8b621f3
- Mail from AWS: its tag is listed, and the GET declares only the refusals it answers 9f5eff4
- Mail from AWS: the setup's policy is main's send-only one, held to the identity's ARN; tests follow the shared allowlist ad76400
- Take main into the mail-from-AWS pull: one write allowlist with SES's REST writes added 15b9efe
- AWS writes for mail setup are a named allowlist beside the read rule, and nothing else (#18142) 93c7c3d
- Traces 1c: GET /api/v1/traces/:id returns the thread, turns and steps as one tree (#18128) 077bab0
- A box's TPS and tick time show live on its games pane, from spark's health report or `/spark tps` at check-in (#18143) f7e559b
- Access 4c: the grants view as an MCP tool and a terminal screen (#18130) 89afadf
- small: the Absorb findings say they are ready for the owner to send to Ben (#18132) d41ec43
- Games survival step 2a: BlueMap behind login at /games/<box>/<server>/map, no published box port (#18100) 1132c91
- A Mac can take a repository's checks and report them on the pull (#17915) 4c72a1d
- Access 4: one view of every grant, and a page that says who may do what (#18062) 5ba07c8
- Take main into the mail-from-AWS pull (#18109) 7ca933c
- Access 2: one `may(principal, action, resource)`, with the repository checks behind it first (#18065) 7d48ce1
- Mail from AWS: no look page for the secrets card 1126175
- Apps without a login 2: a tiny model in the browser fills the app's spec, and the compiler catches every failure (#18117) 4147a37
- Games: a new pin for the forge's proxy plugin replaces the old jar, in PLUGINS and on disk, and the page says which one loaded (#18111) da9e15f
- Healer: a server still starting, its log moving, is not started again (#18053) d918642
- Game box: refuse a wake or a mod install the box has no memory for (#18057) 7fe508f
7 earlier comments
<!-- look-pages 9303d5b4ba97 --> Look pages for 9303d5b, from the gate:
look pages (none): "Looks: /settings/secrets" is not a page of app.looks in forge.json; this pull changes src/web/pages/secrets.ts, src/web/render/mail_aws_card.ts but the forge could not trace the route of /, /admin/telemetry, /explore and 29 more (an inline or wrapped handler), so it could not infer a page; the reviewer decides. A "Looks: <path>" line naming the nearest page, or a "No look: <why>" line (10+ characters), says it
I changed no code again. This round only fixes the look-page line, which the gate had rejected.
My last commit said Looks: /settings/secrets, but that path isn't in app.looks in forge.json. The secrets page is owner-only and no listed page shows the mail card. A new look would also need an owner-session entry, so I didn't add one. The new commit says No look: with that reason, plus Direction: … (#18109). I didn't run the gate or tests again.
The three tests the check refuses most still hold. Last round I ran dead-code exports, module-level state and during job timing locally, and all three passed. I haven't touched code since.
What the pull does: the forge sets up outbound mail from the owner's own AWS account in one confirmed step. It creates the SES identity, publishes its DNS records and issues the mail key. Undo goes through a confirm page.
What I left out: a look for the secrets card. Merging mailAwsDo and mailAwsUndo with similar functions in backups.ts and maintenance.ts is also left out. The gate only notes them, and the shared shape is small.
How to try it: open Settings → Secrets on the preview at https://lab--18119--forge-trevato-apps.open-platform.sh. The "Mail from AWS" card walks through confirm and undo. The same flow is at /api/v1/mail/aws and in the terminal's secrets screen.
[{"go":"/settings/secrets","look":"the Mail from AWS card","expect":"it shows the state and a button that goes to a confirm page before anything changes"}]
🤖 Generated with Claude Code
I merged main into the branch and pushed it. The only conflict was src/generated/marks.ts, which is generated, so I took main's copy and regenerated it with bun scripts/own-source.ts. The regenerated file has no conflict markers and includes the api-v1-mail-aws mark.
Checks I ran after the merge, all green:
bun x tsc --noEmit- 47 tests across seven files:
own-source,route-marks,route-marks-roster,mail-aws,mail-aws-doors,unused-exportsandmodule-state
I did not run the full suite; the forge runs that on push.
The pull's content is unchanged. The forge sets up outbound mail from the owner's own AWS account in one confirmed step: the SES identity, its DNS records and the mail key. To try it, open Settings → Secrets on the preview at https://lab--18119--forge-trevato-apps.open-platform.sh and use the "Mail from AWS" card.
[{"go":"/settings/secrets","look":"the Mail from AWS card","expect":"it shows the state and a button that goes to a confirm page before anything changes"}]
🤖 Generated with Claude Code
main is merged into the branch and pushed. The one conflict was in src/cloud/aws_call.ts. Type-check and the mail and AWS tests pass. One failure remains in test/cloud-inventory.test.ts: the redirect test got 202 instead of 200. I didn't touch that code and didn't check it against main. It uses a local server, so I suspect the sandbox, but I haven't confirmed that.
Merge. main had added its own named-writes list (#18142). It lets IAM writes through only when the attached account has writes allowed. The merge keeps that one list and adds this pull's SES calls (CreateEmailIdentity, DeleteEmailIdentity, PutAccountDetails) to it. A write is now refused unless:
- the call is on the list, and the account has writes allowed;
- an IAM call names a
forge-mail-…user and runs in us-east-1; - a
PutUserPolicydocument is exactly main's send-only policy; - an SES write is a REST call, and nothing else is sent to
ses.
Mail setup changes.
- The setup now looks up the AWS account number with STS and writes main's send-only policy, limited to that domain's SES identity. The earlier policy used a wildcard resource with a from-address condition and would no longer pass main's check.
- The mail action passes
writes=truetoawsCall; it already refused accounts that aren't write-allowed. test/aws-writes.test.ts, which main's tests use, now usesforge-mail-…user names. Its "SES writes are not listed" test was obsolete, so it now checks that SES writes are REST-only.test/mail-aws.test.tshas an STS stub and passeswrites=truewhere it should.
bun scripts/gate.ts --fix changed nothing. It still flags two similar-looking functions, mailAwsDo and mailAwsUndo in src/web/pages/secrets.ts, which I left alone.
Mail from the owner's AWS account now passes the two OpenAPI checks that failed on it. I could not reproduce the third failure, the dashboard N+1 test, and I did not change anything for it.
- Tag test:
/api/v1/mail-awshad no tag of its own, so the OpenAPI document listed an undescribed tag. I added"mail-aws": "tokens"to the aliases insrc/contract/tags.ts, besidemail-key. - Shared-refusal test: the
GET /api/v1/mail-awsroute declared a 403 it never answers in that test. An admin gets 200 and no credential gets 401. It now declaresrefuses: [401]ingetApiV1MailAws.ts. - Dashboard test:
test/surfaces-adversarial.test.tspassed twice here on its own, 13 of 13. This pull's only change near that area issrc/http/lazy_lists.ts, which I did not look into. A timing flake under the shard load is possible but not shown. If the check fails again on that test, it needs a closer look.
I ran test/openapi-errors.test.ts, test/contract-openapi-tags.test.ts and test/surfaces-adversarial.test.ts here, all green. tsc --noEmit is clean and gate --fix made no changes. The gate still prints two similar-code notes for the mail-AWS card in src/web/pages/secrets.ts, which I left alone.
The fix is pushed.
The review round is addressed and pushed. Undo now deletes only an SES identity this set-up created, and the API and terminal ask for the same confirmation as the page.
- Identity data loss:
mail_awshas a newidentity_madecolumn, added by migration if the table already exists.makeIdentityreports whether it created the identity or adopted an existing one. Undo deletes the identity only when this set-up created it. If the owner already had the domain in SES, undo leaves it in place and says so. - Blank identity path:
takeDownskips the identity step whendomainis empty, so the sandbox-failure rollback no longer calls/v2/email/identities/. The same empty-domain path serves the adopted-identity case. - Orphaned access key: before creating a key,
makeSenderlists the IAM user's keys and deletes any it finds. At that point the row holds no key id, so any key is an orphan.takeDownalso deletes every key the user holds, soDeleteUserno longer trips on a leftover. This usesListAccessKeys, which the existing read rule already allows. - Confirmation on undo:
DELETE /api/v1/mail-awsnow needsconfirm: true. Without it the API answers 422unconfirmedandsaynames what undo would remove.- The terminal undo shows a second confirm screen with the same sentence (
mailAwsUndoConfirm). - The OpenAPI route and
docs/features/mail-key.mdsay the same.
- Card: the separate confirm paragraph is gone. The confirm sentence is now the label of one
field({ type: "checkbox" }), so it is stated once and uses the shared component. - Trailing blank line: removed from
ses_setup.ts. - Tests:
- A test send now reaches a local SMTP stub through the sealed key.
- A rerun with an orphaned key deletes the orphan before creating the new key, and undo leaves a pre-existing identity alone.
takeDownwith an empty domain makes no identity call.DELETEwithoutconfirmis refused in the doors test.
I ran test/mail-aws.test.ts, mail-aws-doors, openapi-errors, contract-openapi-tags, unused-exports, module-state, route-timing-coverage, job-slices, both-doors, contract-openapi-roles and app-secrets-web, all green. tsc --noEmit and design-lint are clean. I ran no broader suite locally, because scripts/fast.ts says the changed files reach 3122 test files (about 257 minutes). The forge runs the full check on this push.
Left out: no confirm step on look or test, since they remove nothing. The gate's similar-code notes on mailAwsDo and mailAwsUndo in src/web/pages/secrets.ts stay.
Try it: in Settings → Secrets, tick the one confirm box to set up, then Undo. DELETE /api/v1/mail-aws with {"confirm": true} does the same through the API, and w on the forge's place does it in the terminal.
The failing check is fixed and pushed. test/mail-aws.test.ts imported ../src/actions/secrets.ts twice, once for mailKeyLine and putSecret and again for setMailKey. That tripped the duplicate-import rule. I merged them into one import line.
After the change, test/mail-aws.test.ts and test/dup-imports.test.ts pass (19 tests), and bun x tsc --noEmit reports no errors. I did not run the full suite, and I did not run gate.ts or design-lint.ts. The change touches only an import line in a test file.
Setting up mail from an attached AWS account is one confirmed step on Settings → Secrets. I ran the new and related tests,
tscand the gate here; the full suite runs on the forge's check. I didn't run the app or call real AWS or Cloudflare, and the test-send success path is untested.What changed
src/cloud/aws_call.tsstill refuses every write except a named list: the SES identity create and delete, account details, and the IAM user, policy and key calls. An IAM user it touches must be namedforge-mail-…. Behind it,src/cloud/ses_setup.tsholds the SES and IAM calls and the SMTP password derivation./settings/secrets./api/v1/mail-aws(GET, POSTstep, DELETE), with contract entries.won the secrets screen.docs/features/mail-key.md.src/http/marks/.Reused:
writeRecord,lookRecordandremoveRecordfromdns_record.ts,setMailKeyandremoveMailKey,gatedFetch,confirmAction, and the cloud account'sopen, which I exported rather than copy.Not done
*.amazonaws.comtoforge.jsonegress, becauseaws_call.tssays it names none on purpose and every AWS read already works that way. Tell me if the forge's gate should refuse these writes without it.No door:lines because the terminal door and how-to are edits to existing files. There is noLooks:path: the gate could not infer a page for/settings/secrets. Two duplicate-function notes remain formailAwsDoandmailAwsUndo, which are only notes.Closes #18109