Open the developer area with a bookmarked link instead of a sign-in - #2741
Open the developer area with a bookmarked link instead of a sign-in#2741BigSimmo wants to merge 2 commits into
Conversation
The owner asked for a Developer Section that does not ask him to sign in. Deleting DeveloperAreaGate would have published the task ledger, the hazard notes and the Ward Flow / Care Plan / Caring Contact prototypes to anyone visiting psychiatry.tools -- #L30 reintroduced on purpose -- so this adds a third credential beside the administrator claim rather than removing it. DEVELOPER_AREA_ACCESS_KEY (server-only, 32-character floor) is presented once per device as `/mockups/development?devkey=...`. src/proxy.ts verifies it, sets a signed cookie and redirects the key out of the URL so it does not survive in the address bar, the shared history entry or a Referer header. The cookie carries an HMAC over its own issue time, not the key, so it cannot be re-dated or turned back into the secret; the proxy re-issues it on every verified visit, so a device used once a year never sees the sign-in again. The credential is additive and fails closed everywhere: unset, under-strength, malformed, or signed under a rotated key all fall through to the existing sign-in screen. Rotating the key in Railway is the revocation. Reaching the page is all it grants -- environment-facts and corpus-health still check the administrator claim themselves and degrade to "unavailable" for a link holder. check:production-readiness now fails a NEXT_PUBLIC_ copy of the key (Next.js would inline it into the client bundle) and states an enabled key as a release-time fact. Verified: lint, typecheck, prettier --check . and the four affected suites (link-access, proxy, developer-area-access, developer-area-gate) green; verify:cheap left to the next run. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K8kRjars99uHE46MRH28rg
`check:repo-awareness-snapshot` reported the committed snapshot behind the repository after docs/developer-area-access.md was added. Regenerated with `npm run snapshot:repo-awareness`; the check now reports in step. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K8kRjars99uHE46MRH28rg
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Superseded by #2742 and closing. Same change, scanner-clean. Why a replacement rather than a fix here. Gitleaks failed this branch with five The fix could not land on this branch. Gitleaks scans every commit in a PR's range, not just the tip, so the offending blob had to leave the branch's history; force-push and branch deletion are both barred from this session. The owner approved a replacement branch instead. Verified with the pinned Gitleaks 8.24.3 the workflow installs, over the same range the check scans: this branch reproduces at Nothing else differs. All local gates were re-run on the new branch after the fixture change — lint, typecheck, whole-tree Generated by Claude Code |
Summary
DeveloperAreaGatewould have published the task ledger, the hazard notes and the Ward Flow / Care Plan / Caring Contact prototypes to anyone visiting psychiatry.tools —#L30reintroduced on purpose — so this adds a third credential beside the administrator claim rather than removing it.DEVELOPER_AREA_ACCESS_KEY(server-only, 32-character floor) is presented once per device as/mockups/development?devkey=….src/proxy.tsverifies it, sets a signed cookie, and redirects the key out of the URL so it does not survive in the address bar, the shared history entry, or aRefererheader sent onward.v1.<issuedAt>.<HMAC-SHA256 over both, keyed by the secret>— not the key. A stolen cookie cannot be turned back into the secret, and cannot be re-dated to extend itself because the signature covers the issue time. The proxy re-issues it on every verified visit, inside the ~400-day ceiling browsers clampSet-Cookieto, so a device used once a year never sees the sign-in screen again.NEXT_PUBLIC_MOCKUPS_ENABLEDis untouched. Rotating the key in Railway revokes every device at once.resolveHubEnvironmentFactsand the corpus-health reader still callisAdministratorUserthemselves and degrade to "unavailable" for a link holder — the link is a convenience credential that can be forwarded in a message; the corpus is the clinical library. The code anddocs/developer-area-access.mdboth say not to "simplify" that away.check:production-readinessnow fails aNEXT_PUBLIC_DEVELOPER_AREA_ACCESS_KEY(Next.js would inline the secret into the client bundle) and states an enabled key as a release-time fact.docs/developer-area-access.mdcovers setup, per-device use, what the link does not grant, and revocation.Verification
npm run verify:cheap— exit 0.[diff-integrity] PASS — 5 changed test file(s), 52 -> 76 test case(s);[mockup-retirement] PASS — 82 mockup route(s) indexed;sitemap:checkclean. Its one advisory (check:repo-awareness-snapshotbehind, from the new document) is fixed in the second commit — the check now reports[repo-awareness] in step with data/repo-awareness-snapshot.json.npm run typecheck—[gate-receipts] recorded a pass for "typecheck:internal" (7464 input files)npm run lint—[gate-receipts] recorded a pass for "lint:internal" (7464 input files)npx prettier --check .—All matched files use Prettier code style!(whole tree, committed)tests/developer-area-link-access.test.ts(12 new),tests/proxy.test.ts(33),tests/developer-area-access.test.ts,tests/developer-area-gate.dom.test.tsx, plustests/production-readiness-offline.test.ts(14).npm run verify:pr-local— Verification not run: deferred to CI, which runs the same risk-routed selection on this diff.npm run verify:ui— UI verification not run: the only component change is one added branch inDeveloperAreaGate, a Server Component that renders existing children; no styling, routing chrome, or client behaviour changed. CI runs the browser suite on this diff.npm run check:production-readiness— Verification not run: provider-backed, needs explicit approval. The newdeveloperAccessKeyProductionRiskpredicate it calls is covered offline intests/production-readiness-offline.test.ts.Risk and rollout
tests/developer-area-link-access.test.ts, andtests/proxy.test.tsasserts no cookie is minted for a wrong key, for an unconfigured deployment, or on a look-alike path such as/mockups/care-plan-archive. The secondary risk is key leakage: the cookie isHttpOnly, scopedPath=/mockupsso it is never sent on a clinical request, and the URL secret is stripped by redirect whether or not it verified.DEVELOPER_AREA_ACCESS_KEY. The feature is off and administrator sign-in is the only way in, with no code change and no deploy.Clinical Governance Preflight
Clinical KB Database(sjrfecxgysukkwxsowpy) — untouchedNEXT_PUBLIC_copyNotes
docs/developer-area-access.mdsays so rather than leaving it to be rediscovered.🤖 Generated with Claude Code
https://claude.ai/code/session_01K8kRjars99uHE46MRH28rg
Generated by Claude Code