Repository navigation
feat(frontend): per-user sign-in; the browser no longer holds the API key (#96) - #115
Merged
Merged
Conversation
… key (#96) The frontend now requires signing in. /auth posts to /api/auth/login and keeps the session in sessionStorage; every API call sends it as a bearer token, and no call sends X-API-Key. A 401 ends the session and returns to /auth; the upload page and /audit redirect there when signed out. The header shows user and tenant with a sign-out button. VITE_API_KEY is gone from the code, the offline bundle and the docs. The offline installer creates the first tenant and admin (password to a root-only file, not the log) and the smoke test now checks sign-in and waits for the frontend to start. QUICKSTART gains the one-time create_tenant_admin step. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019YPoXzBSj89ZHgw7nfTmbB
This was referenced Oct 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #96. This is the last part of ART Milestone 2 (BR-36). You decided on 26 Oct: sign-in required; the browser never holds the shared key; the installer creates the first admin.
What changes
Frontend (
csv-table-hub-main)/authis now a real form: tenant, username, password. It posts to/api/auth/loginand keeps the session insessionStorage, so the session ends when the tab closes.Authorization: Bearer <token>. No call sendsX-API-Key, andVITE_API_KEYis removed from the code./auth./auditredirect to/authwhen nobody is signed in.user · tenant, with the role in the tooltip, and a sign-out button. Sign-out revokes the token on the server too.detailerrors now show to the user.src/lib/session.ts,src/components/session-menu.tsx, and two test files.Offline install (#60 tooling)
install.shcreates the first tenant and admin. Defaults aremainandadmin, overridable withTE_TENANT,TE_ADMIN_USERandTE_ADMIN_PASSWORD. A generated password goes to/root/te-initial-admin(mode 600, root only). It is never printed, so it stays out ofinstall.log.Docs: QUICKSTART (one-time
create_tenant_admin.pystep, noVITE_API_KEY), ENV_VARIABLES, API_INTEGRATION (who uses bearer and who uses the key), README limitations,env.dev.example,docs/offline-install.md. The API's startup log line no longer says the frontend must send the key.Evidence
tsc --noEmitnpm run build)scripts/lint.shOffline rehearsal of the rebuilt bundle (143 MB, 478 files), inside a network namespace with loopback only:
install.shcreated tenantmainand its admin.Real browser (Playwright, same namespace, against the installed app):
/and/auditland on/auth;admin · main;sessionStorage;/auth, and/redirects there again;tenant_main.csv_fileswith 2 rows, and every API call carried a bearer token and noX-API-Key.Note: GitHub CI doesn't run vitest or the frontend build. The figures above are from this workspace.
After merging
VITE_API_KEYcan drop it.Generated by Claude Code