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

A child forge's bill downloads only for its verified claimant or spawner #15016

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

A hosted child forge's bill now downloads only for a claimant who has proven that email address on this forge. This closes the #14765 finding: before, anyone could sign up with (or change their address to) the claimant's email, skip verification, and download the child's signed monthly ledger.

Notes

shipped production is serving it deploy 6dfa34b

opened this

A hosted child forge's bill now downloads only for a claimant who has proven that email address on this forge. This closes the #14765 finding: before, anyone could sign up with (or change their address to) the claimant's email, skip verification, and download the child's signed monthly ledger.

What changed

  • claimsBill in src/actions/forge_bill.ts now also requires emailVerified(db, user.id), on top of the address matching the claimant's. It takes the database as a new first argument.
  • readBill (the API and page doors) goes through it, and so do the bill links on /settings, /forges, /settings/payments and the TUI bills screen. An unproven account gets the same 404 as a stranger and sees no link.
  • The new test in test/forge-bill.test.ts sets up a child claimed by [email protected] and registers erin on the parent with the address left unproven. It checks for 404 on both doors and no link on /settings. After the address is marked proven, the download answers 200. Without the fix, the first check got 200.

Not done

  • Authorizing by account id: the issue asks for the account id or a verified email. I used the verified email, because the claim is made on the child forge and records only an address, not a parent account id.
  • Spawner access: the spawner still gets 404, as before. The issue's title and risks assume the spawner can download, but on main they can't: the existing test asserts the person who made the child gets 404. Letting them in would widen access, so it should be its own decision.
  • I could not record the plan on the issue: the keep_plan tool isn't available in this session.

Checks: bun scripts/gate.ts --fix (it rewrapped one comment, which is committed), bun x tsc --noEmit and bun scripts/design-lint.ts are clean. bun scripts/fast.ts named 2255 test files, too many to run here, so I ran the bill and forges-page suites instead: forge-bill, billing-links, tui-billing-links, billing-tui, billing-payments and the forges* tests, 91 tests across 15 files, with 0 failures. The forge's check runs the full suite on the push.

Try it: sign up with the address that claimed a hosted forge and leave it unproven, then open /forges/<name>/bill: it answers 404. Prove the address and it downloads.

🤖 Generated with Claude Code

Closes #14966

2 earlier comments
commented

A hosted child forge's bill now downloads only for a claimant who has proven that email address on this forge. This closes the #14765 finding: before, anyone could sign up with (or change their address to) the claimant's email, skip verification, and download the child's signed monthly ledger.

What changed

  • claimsBill in src/actions/forge_bill.ts now also requires emailVerified(db, user.id), on top of the address matching the claimant's. It takes the database as a new first argument.
  • readBill (the API and page doors) goes through it, and so do the bill links on /settings, /forges, /settings/payments and the TUI bills screen. An unproven account gets the same 404 as a stranger and sees no link.
  • The new test in test/forge-bill.test.ts sets up a child claimed by [email protected] and registers erin on the parent with the address left unproven. It checks for 404 on both doors and no link on /settings. After the address is marked proven, the download answers 200. Without the fix, the first check got 200.

Not done

  • Authorizing by account id: the issue asks for the account id or a verified email. I used the verified email, because the claim is made on the child forge and records only an address, not a parent account id.
  • Spawner access: the spawner still gets 404, as before. The issue's title and risks assume the spawner can download, but on main they can't: the existing test asserts the person who made the child gets 404. Letting them in would widen access, so it should be its own decision.
  • I could not record the plan on the issue: the keep_plan tool isn't available in this session.

Checks: bun scripts/gate.ts --fix (it rewrapped one comment, which is committed), bun x tsc --noEmit and bun scripts/design-lint.ts are clean. bun scripts/fast.ts named 2255 test files, too many to run here, so I ran the bill and forges-page suites instead: forge-bill, billing-links, tui-billing-links, billing-tui, billing-payments and the forges* tests, 91 tests across 15 files, with 0 failures. The forge's check runs the full suite on the push.

Try it: sign up with the address that claimed a hosted forge and leave it unproven, then open /forges/<name>/bill: it answers 404. Prove the address and it downloads.

🤖 Generated with Claude Code

commented

<!-- look-pages e0519a076909 --> Look pages for e0519a0, from the gate:

  • look pages (none): this pull changes src/web/pages/bills.ts, src/web/pages/forges.ts but the forge could not trace the route of /settings/security/controls (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
commented

A child forge's bill now downloads only for a claimant who has proven that email address on this forge. This fixes the #14765 finding: before, anyone could sign up with the claimant's address (or switch their own to it), skip verification and download the child's signed monthly ledger.

What changed

  • src/actions/forge_bill.ts: claimsBill now takes the database and also requires emailVerified(db, user.id), on top of the address match it already made. It is the single check behind the API and page doors (readBill) and every bill link: /settings, /forges, /settings/payments and the terminal's bills screen. An unproven account gets the same 404 as a stranger and sees no link.
  • src/web/pages/bills.ts and src/web/pages/forges.ts only pass the database through. Nothing new is shown, so the pull carries "No door:" and "No look:" commit lines for the gate.
  • test/forge-bill.test.ts: a child is claimed by [email protected], and an erin account on the parent has that address unproven (resetVerification, what an email change does). Both doors answer 404 and /settings shows no link. Once the address is marked proven, the download answers 200. Without the fix the first check gets 200.

Not done

  • The issue asks for the account id or a verified email; this uses the verified email. The claim is made on the child forge and records only an address, so there is no parent account id to bind to.
  • The person who made the child still gets 404. The issue assumes they have access, but on main they don't: the existing test asserts it. Letting them in would widen access and needs its own decision.

Checks

  • bun scripts/gate.ts exits 0; bun x tsc --noEmit and bun scripts/design-lint.ts are clean.
  • bun scripts/fast.ts named 2255 test files, too many to run in the sandbox. I ran the bill and forges-page suites instead (forge-bill, billing-links, tui-billing-links, billing-tui, billing-payments and the forges* tests): 91 tests in 15 files, none failing. The forge runs the full check on the push.
  • The issue's plan wasn't kept: the keep_plan tool isn't available in this session.

Try it: sign up with the address that claimed a hosted forge, leave it unproven, and open /forges/<name>/bill: it answers 404. Prove the address and the bill downloads.

🤖 Generated with Claude Code

Approved

One check now backs every door (API, page, settings, forges, payments, terminal): the address must match and be proven here. The unproven account gets the same 404 and no link, so there is nothing new to see on a phone or without JavaScript. The test registers the squatter, resets verification, and checks 404 on both doors and no link, then 200 once proven. Next: (1) decide separately whether the spawner should get the bill, since the issue assumes it and main refuses it; (2) tidy the header comment in forge_bill.ts, whose lines are wrapped unevenly.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs