v0.6.1-beta: Auth Bootstrap Fix - #42
Merged
Merged
Conversation
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.
Motivation
current_userand return 401/403 instead of raising a 500.Description
frontend/src/App.tsxto always callGET /api/auth/setup-requiredfirst and then conditionally callGET /api/auth/me; added explicitloading,setup,login,app, anderrormodes to gate rendering.SetupViewandLoginViewcomponents atfrontend/src/components/SetupView.tsxandfrontend/src/components/LoginView.tsximplementing initial admin setup (POST /api/auth/setup) and login (POST /api/auth/login) flows with visible error handling.frontend/src/api.ts) now usescredentials: 'include'for all fetch calls and exposesgetSetupRequired,getMe,setupAdmin, andloginhelpers used by the bootstrap flow.backend/app/core/auth.pyby removing the special-case path that returnedNonewhen no users exist sorequire_roleand role-based dependencies callget_current_userand properly return 401/403 rather than allowing unauthenticated access.backend/tests/test_api_smoke.pyto cover setup-required behavior, 401 when unauthenticated, 403 for viewer role, and 200 for operator/admin; added helper to create/login the initial admin in tests.v0.6.1-beta/0.6.1across backend/frontend/metadata and updatedREADME.mdandRELEASE_NOTES.mdwith Auth Bootstrap Fix highlights.Testing
pytest backend/tests/test_api_smoke.py -qwhich passed (tests in that file passed).cd frontend && npm run buildwhich completed successfully and produced a production build.Codex Task