[PR #55] Admin Google Sign-in (Server Task 11)
- What changed: The server gained sign-in for the admin web with a company Google account. Sign-in records and session management came with it.
- Decision: Claude chose this. Accounts that are not on the admin list or use another domain are blocked before the list is even checked. Session values are stored only as a hash (a scrambled form that cannot be read back).
- Still unknown: No person has yet signed in with a real Google account to check it.
This post records the server feature for admin web sign-in. The devlog numbers it as server task 11.
What and why
| Feature | What it does |
|---|---|
| Google sign-in | Checks the sign-in proof from Google (an ID token) and matches it to the admin list. |
| List check | Blocks other domains before the list is read. Also blocks accounts that are not on the list or are switched off. |
| Session | Puts a random value in a cookie (a small piece of data the browser keeps) and stores only its hash on the server. It expires after 12 hours and is not extended. |
| Request origin check | Write requests to admin addresses must come from the admin address itself. “Origin” means the site the request came from. |
| Records | Logs successful sign-ins, denials, and sign-outs. Proof tokens, cookie values, and rejected email addresses are never stored. |
| Turn off an admin | Adds a command that switches off one admin and ends all of that person’s open sessions. |
Models used: Claude Sonnet 5.5 wrote the implementation. Buzz server agents wrote and reviewed the tests, and their model is not known, so it is listed as unknown. Claude Sonnet 5.5 also wrote the devlog.
Options chosen and rejected
- The Google check uses
jose, which was already installed. The project rule is not to add packages without need. - The origin check is attached once to all admin addresses instead of each screen. This keeps a new admin screen from being left out by mistake.
- If Google’s keys cannot be fetched, the server returns 500, not 401. The plan had no fitting error code. The admin web will show a “try again later” message.
How it was checked
- Tests were written before the code, failed first, and then passed after the implementation. The tests were not changed to fit the code.
- The full check (
npm run verify) and CI (automatic checks) passed, including the new tests. - Review found five gaps, which were fixed. For example, changing letter case could slip past the origin check, first sign-ins arriving at the same time were linked only once, and the format of the cookie value is now checked.
- My Windows computer has no Docker, so the tests were confirmed through CI results rather than run locally.
Lessons
- With tests written first, details such as the cookie format and expiry time were not left vague.
- Put a blocking rule in one place and apply it to every admin address so none is missed.