Public: anyone can read this; the crew can change it.
auth + default anon #18
Merged 77d 7h ago, live in production
Pushed. Here's the summary for the pull: The scaffold every new app starts from (src/apps/scaffold.ts) had no auth at all. It now ships a small src/auth.ts (self-contained, zero dependencies) that gives new apps a clean, minimal core for this from day one: Default allow anon.
-
Reviews
No review yet.
-
Checks
shipped production is serving it deploy c4333e8
-
History
- Fix a race in the check test: pick the pull's own check by env, not state b4b522f
- Scaffold apps ship auth: default allow anon, one admin role c457234
- realtime (#16) 7a199de
- Merge remote-tracking branch 'upstream/main' 63d2f8a
- Asks you is one panel: a row per ask with its actions on the line aa68866
- Merge remote-tracking branch 'upstream/main' d17726b
- An open pull whose head was never checked is checked when the service boots 279d2e3
- Merge remote-tracking branch 'upstream/main' 8c0dd49
- The decider: TypeSafe's Jev answers the forge's fixed-choice questions, the rules stand behind it ac32cf9
- Merge remote-tracking branch 'upstream/main' f57a389
- A grant cookie is named for its app, so two forges can grant on one hostname 752b65b
- Merge remote-tracking branch 'upstream/main' 7affb7a
- A guest forge's grant passes through on a nested hostname d93e631
- Merge remote-tracking branch 'upstream/main' e34d660
- The studio app page from the forge's parts: the app leads, the box is a composer, Now is rows with avatars 715f47e
- Merge remote-tracking branch 'upstream/main' 34aa5f1
- Grants land on the hostname asked for; a bare POST is an empty form; Now shows each thing once; one empty state on the map 3176306
- Merge remote-tracking branch 'upstream/main' 78c67c5
- The studio home is the forge's own rows: apps with a signal each, what asks you, what is happening fe48f4e
- Merge remote-tracking branch 'upstream/main' c96aa7c
Sign in to join this conversation.
new above
offline
Pushed. Here's the summary for the pull:
The scaffold every new app starts from (
src/apps/scaffold.ts) had no auth at all. It now ships a smallsrc/auth.ts(self-contained, zero dependencies) that gives new apps a clean, minimal core for this from day one:Roletype ("anon" | "admin") gates the one thing that should be privileged: deleting a note. Extending it (a third role) means widening that one union and its checks, not scattering string comparisons through routes.ADMIN_PASSWORDfrom the environment (reusable, like a real password), or — with none set — a one-time code generated on boot, persisted so the server and the terminal (src/tty.ts) agree on it, printed once to the run log and the terminal, and never shown on a page. Using it once retires it.core/sessions.ts), 30-day expiry,HttpOnly/SameSite=Laxcookie,Securewhen served over https.New routes:
GET /admin(claim form or admin panel),POST /admin/claim,POST /admin/logout,POST /notes/delete(admin-only). The home page shows a delete button per note only to an admin session, plus an admin/log-out link.Tests added to
src/server.test.tscover: anon can still read/write with no session, anon is refused on delete, wrong secret is refused, the right secret claims admin and sets anHttpOnlycookie, admin can delete while anon still cannot, and logout ends the session. I generated the scaffold into a scratch directory and ran itsbun test(12/12 pass) and a live boot to exercise the unclaimed one-time-code path end to end (terminal and log both print the same code; reusing it after a claim is refused).Left out: no password-reset or multi-admin support — this is deliberately the smallest correct shape an agent extending a real app can grow from, not a full user system.
bun x tsc --noEmitand the repo's declaredchecksuite pass except for a handful of pre-existing failures (git-push-auth related) present identically onmain, unrelated to this change.Closes #7