Require a shared password to access transcript administration #146

Merged
mike merged 8 commits from mike-bot/admin-login into master 2026-11-25 20:31:53 -05:00 AGit
Collaborator

All transcript administration routes require a shared admin passphrase. Editors return to the requested admin page after logging in; unauthenticated edits, imports, and deletes receive 401. If an editor is logged out, htmx takes them back to login without replaying the request. Public transcript pages and downloads remain accessible without logging in.

The server validates the passphrase at startup and on login, using the same rules in both places. It requires 1–100 Unicode code points in valid UTF-8, rejects NUL, and does not change the supplied text. The server requires an explicitly configured authenticator.

Admin logins survive deploys and restarts as long as the passphrase stays the same. The server imposes no login timeout and renews the sharedSecret cookie on page loads, subject to browser limits. Logging out clears that browser’s cookie; changing the passphrase invalidates all existing logins.

For local development, dev-scripts/serve sets the admin passphrase to somepassword.

Before merging: Set a strong, randomly generated ADMIN_PASSWORD as a Fly app secret. The app will not start without a valid passphrase.

All transcript administration routes require a shared admin passphrase. Editors return to the requested admin page after logging in; unauthenticated edits, imports, and deletes receive `401`. If an editor is logged out, htmx takes them back to login without replaying the request. Public transcript pages and downloads remain accessible without logging in. The server validates the passphrase at startup and on login, using the same rules in both places. It requires 1–100 Unicode code points in valid UTF-8, rejects NUL, and does not change the supplied text. The server requires an explicitly configured authenticator. Admin logins survive deploys and restarts as long as the passphrase stays the same. The server imposes no login timeout and renews the `sharedSecret` cookie on page loads, subject to browser limits. Logging out clears that browser’s cookie; changing the passphrase invalidates all existing logins. For local development, `dev-scripts/serve` sets the admin passphrase to `somepassword`. **Before merging:** Set a strong, randomly generated `ADMIN_PASSWORD` as a Fly app secret. The app will not start without a valid passphrase.
Require a shared password to access transcript administration
All checks were successful
ci/crow/pr/build Pipeline was successful
30c667da46
Previously, anyone could open the editor and make changes to transcripts.

With this change, editors sign in with the configured shared password. The
server returns them to the requested admin page and rejects unsigned edits.
Public transcript pages and downloads still work without signing in.

Set ADMIN_PASSWORD as a Fly app secret before deploying. Sessions last up to
30 days and expire immediately on sign-out or an app restart.

AI-Model: openai/gpt-6.2-sol-fast
AI-Model: openai/gpt-6-luna
mike-bot changed title from Require a shared password to access transcript administration to WIP: Require a shared password to access transcript administration 2026-11-25 16:50:57 -05:00
Let developers sign in when running dev-scripts/serve
All checks were successful
ci/crow/pr/build Pipeline was successful
507b20ece5
Air gives the development binary the same local-only example password that
PicoShare uses. Production still requires a configured ADMIN_PASSWORD.

AI-Model: openai/gpt-6.2-sol-fast
Prompt editors to sign in when an admin session ends
All checks were successful
ci/crow/pr/build Pipeline was successful
74443f7430
Previously, when a session ended while an admin page was open, a rejected
save could replace the editor with an error and a rejected import could
fail without showing a message.

Reload the current admin page so it sends the editor to sign in instead.
Do not replay the rejected request. Keep the production HTTPS upgrade in
the browser-test build while allowing its local HTTP session cookie.

AI-Model: openai/gpt-6.2-sol-fast
mike-bot changed title from WIP: Require a shared password to access transcript administration to Require a shared password to access transcript administration 2026-11-25 16:59:39 -05:00
Use “Log in” for the heading and button. Put the form directly in the
page container, focus the password field, and show errors beneath the form.

AI-Model: openai/gpt-6.2-sol-fast
Keep admin logins across deploys
All checks were successful
ci/crow/pr/build Pipeline was successful
5ca94cf0a2
The server no longer keeps an expiring session table. A PicoShare-style
shared-password authenticator accepts the same admin cookie after a restart
or deploy, as long as ADMIN_PASSWORD has not changed.

Logging out clears the browser's cookie. Rotate the password to invalidate
all existing logins. The server renews cookies on page loads to avoid a
fixed login timeout within browser cookie limits.

AI-Model: openai/gpt-6.2-sol-fast
Follow the shared admin login pattern from PicoShare and Grosireé
All checks were successful
ci/crow/pr/build Pipeline was successful
05208caef3
Use the two projects’ shared_secret and kdf package layout, and inject the
server’s authenticator at startup. Follow Grosireé’s form-based login
contract rather than adding PicoShare’s JSON endpoint.

Keep the existing transcript cookie name and key format so this refactor
does not log anyone out. Keep cookie renewal and the HTTPS-only production
cookie, and derive the cookie key only at startup so an unauthenticated
login attempt does not trigger an expensive derivation.

AI-Model: openai/gpt-6.2-sol-fast
mike-bot force-pushed mike-bot/admin-login from 05208caef3
All checks were successful
ci/crow/pr/build Pipeline was successful
to 3a7e379808
All checks were successful
ci/crow/pr/build Pipeline was successful
2026-11-25 18:28:17 -05:00
Compare
Isolate admin handler tests from the login flow
All checks were successful
ci/crow/pr/build Pipeline was successful
096ad1f4d2
Inject a mock in handler tests so they can check admin routing and
transcript operations without calling the login endpoint as setup.
Playwright still covers login and logout against the real authenticator.

AI-Model: openai/gpt-6.2-sol-fast
Validate admin passphrases consistently at startup and login
All checks were successful
ci/crow/pr/build Pipeline was successful
644c21b28e
Accept passphrases of 1–100 Unicode code points without changing their
text. Refuse invalid configuration at startup and handle invalid login
input the same way as a wrong password.

Name the login cookie sharedSecret and require callers to supply an
authenticator instead of silently installing an empty one.

AI-Model: openai/gpt-6.2-sol-fast
mike scheduled this pull request to auto merge when all checks succeed 2026-11-25 18:42:38 -05:00
mike canceled auto merging this pull request when all checks succeed 2026-11-25 20:31:49 -05:00
mike merged commit b4f30a299f into master 2026-11-25 20:31:53 -05:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
oe/transcripts!146
No description provided.