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

Crash reports: a private app's owner makes a report key, and a build with it can file reports without a session #18238

opened this

Closed 2h 37m ago

A private app's owner can now make a report key, and a build that sends it files crash reports without a session. I ran bun x tsc --noEmit and the focused tests (test/report-key.test.ts, test/crash-reports.test.ts, test/schema-migrations.test.ts, the contract and docs suites).

Notes

opened this

A private app's owner can now make a report key, and a build that sends it files crash reports without a session. I ran bun x tsc --noEmit and the focused tests (test/report-key.test.ts, test/crash-reports.test.ts, test/schema-migrations.test.ts, the contract and docs suites). I did not run a bare bun test, and I have not tried it on a preview. The gate is clean on the last run; design-lint was last run before the how-to and the "No look" commit.

  • Key: the owner makes it from the app's settings (a "Report key" block, shown only on private apps), from the terminal palette ("Report key": m makes or rotates, x revokes), or through POST and DELETE /api/v1/apps/:owner/:name/report-key (rw token). The three share their words in src/actions/report_keys.ts. The key is shown once, only its sha256 is kept, and making another replaces the old one.
  • Accepting reports: POST …/crash-reports takes a private app's report when it carries the key in an x-report-key header. Otherwise the existing rules apply, so a wrong, revoked or missing key gets the identical 404 body as an app that does not exist. The key opens that one route, and the same 5 a minute per address and 60 a minute per app still apply.
  • Test: test/report-key.test.ts makes a key, files a report with it, shows a wrong key and a missing key get the missing-app 404 body, and shows the key can't reach the key route or the repo page. It then rotates the key (the old one stops), revokes it, and files again to get the same 404.
  • Docs and migration: docs/features/report-key.md and a paragraph in crash-reports.md; the migration 20261204120000-report-key is pinned.
  • Reused: the secret and hash helpers (secret(), sha256), adminForm and flashTo (the one-shot flash that shows the key once) for the page, and the secrets settings block as the template for the page and terminal screens. bun scripts/gate.ts --fix listed near-duplicate functions but I did not merge any.
  • One table instead of a token row: the issue said to use the token pattern, but a token row authenticates as its user across the whole API, so the key would not be limited to this one route. I copied the pattern (rk_ prefix, shown once, hash only) into a small report_key table with one row per app and ON DELETE CASCADE.
  • Left out: more than one key per app, last-used tracking, and a key for public apps (making one answers 422 off).
[
 {"go":"/<owner>/<private-app>/settings/app#report-key","look":"Report key block; press Make a key","expect":"a one-shot flash shows rk_… once; the block then says Made <time> and offers Rotate and Revoke"},
 {"go":"POST /api/v1/apps/<owner>/<private-app>/crash-reports with header x-report-key","look":"the key from the flash","expect":"202; after Revoke, or with a wrong key, the same 404 as an app that does not exist"}
]

Closes #18224

2 earlier comments · 1 event
commented

A private app's owner can now make a report key, and a build that sends it files crash reports without a session. I ran bun x tsc --noEmit and the focused tests (test/report-key.test.ts, test/crash-reports.test.ts, test/schema-migrations.test.ts, the contract and docs suites). I did not run a bare bun test, and I have not tried it on a preview. The gate is clean on the last run; design-lint was last run before the how-to and the "No look" commit.

  • Key: the owner makes it from the app's settings (a "Report key" block, shown only on private apps), from the terminal palette ("Report key": m makes or rotates, x revokes), or through POST and DELETE /api/v1/apps/:owner/:name/report-key (rw token). The three share their words in src/actions/report_keys.ts. The key is shown once, only its sha256 is kept, and making another replaces the old one.
  • Accepting reports: POST …/crash-reports takes a private app's report when it carries the key in an x-report-key header. Otherwise the existing rules apply, so a wrong, revoked or missing key gets the identical 404 body as an app that does not exist. The key opens that one route, and the same 5 a minute per address and 60 a minute per app still apply.
  • Test: test/report-key.test.ts makes a key, files a report with it, shows a wrong key and a missing key get the missing-app 404 body, and shows the key can't reach the key route or the repo page. It then rotates the key (the old one stops), revokes it, and files again to get the same 404.
  • Docs and migration: docs/features/report-key.md and a paragraph in crash-reports.md; the migration 20261204120000-report-key is pinned.
  • Reused: the secret and hash helpers (secret(), sha256), adminForm and flashTo (the one-shot flash that shows the key once) for the page, and the secrets settings block as the template for the page and terminal screens. bun scripts/gate.ts --fix listed near-duplicate functions but I did not merge any.
  • One table instead of a token row: the issue said to use the token pattern, but a token row authenticates as its user across the whole API, so the key would not be limited to this one route. I copied the pattern (rk_ prefix, shown once, hash only) into a small report_key table with one row per app and ON DELETE CASCADE.
  • Left out: more than one key per app, last-used tracking, and a key for public apps (making one answers 422 off).
[
 {"go":"/<owner>/<private-app>/settings/app#report-key","look":"Report key block; press Make a key","expect":"a one-shot flash shows rk_… once; the block then says Made <time> and offers Rotate and Revoke"},
 {"go":"POST /api/v1/apps/<owner>/<private-app>/crash-reports with header x-report-key","look":"the key from the flash","expect":"202; after Revoke, or with a wrong key, the same 404 as an app that does not exist"}
]
commented

The check failed because the generated route index was stale. It was missing the export for deleteApiV1AppsOwnerNameReportKey. I regenerated it with bun scripts/openapi-routes.ts and pushed the result as one commit.

  • Tests: test/openapi-routes.test.ts passes locally (589 tests). I did not run the other tests, so the forge's full check on this push is the rest of the verification.
  • Type check: bun x tsc --noEmit printed no errors.
  • Gate: bun scripts/gate.ts --fix changed nothing. It still prints a similarity note that reportKeyMake and reportKeyRevoke in src/web/pages/report_key.ts look alike (0.73). That is advisory, so I left it.
  • Door rule: the commit message says No door: because only the generated index changed, with no behaviour change.
the crew's run was interrupted: restart, resumes on the next pass — cancelled
commented

Declined: already done on main in fbb3da48f. I aborted the merge and pushed nothing. Run log: https://forge.open-platform.sh/trevato/forge/runs/01m90tytantjxcxdnzq51nm0ta

Sign in to join this conversation.

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

Keyboard shortcuts

Docs