fix(security): auth middleware fail-close, allow_no_auth flag, public OAuth routes#1117
Open
AlexZander85 wants to merge 2 commits intoRightNow-AI:mainfrom
Open
fix(security): auth middleware fail-close, allow_no_auth flag, public OAuth routes#1117AlexZander85 wants to merge 2 commits intoRightNow-AI:mainfrom
AlexZander85 wants to merge 2 commits intoRightNow-AI:mainfrom
Conversation
…with vault token persistence
Adds a new oauth_providers module with device-flow implementations for
OpenAI Codex, Google Gemini, Qwen (DashScope), and MiniMax. Tokens are
persisted to both the in-memory vault and secrets.env for dual-write
durability. The Copilot flow is preserved unchanged.
New routes:
POST /api/providers/openai-codex/oauth/start
GET /api/providers/openai-codex/oauth/poll/{poll_id}
POST /api/providers/gemini-oauth/oauth/start
GET /api/providers/gemini-oauth/oauth/poll/{poll_id}
POST /api/providers/qwen-oauth/oauth/start
GET /api/providers/qwen-oauth/oauth/poll/{poll_id}
POST /api/providers/minimax-oauth/oauth/start
GET /api/providers/minimax-oauth/oauth/poll/{poll_id}
UI: Settings page shows Login buttons for each provider with device-code
display and polling feedback.
… OAuth routes - Add allow_no_auth to AuthConfig (default true) for backward compatibility - Replace fail-open with fail-close+opt-in: when allow_no_auth=false and no API key is set, return 401 instead of allowing all access (RightNow-AI#1034) - Add codex/gemini/qwen/minimax OAuth routes to middleware public endpoint list - Add auth middleware unit tests
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.
Summary
allow_no_auth: booltoAuthConfig(defaulttrue). Whenfalse, middleware fails closed if no API key is configuredallow_no_auth=trueand no key is set (existing behavior preserved but now explicit)Changed files
crates/openfang-api/src/middleware.rs-allow_no_authlogic, 6 new public routes, 5 unit testscrates/openfang-api/src/server.rs- wiringallow_no_authfrom configcrates/openfang-types/src/config.rs-allow_no_auth: boolin AuthConfig (defaulttrue)crates/openfang-api/tests/api_integration_test.rs-allow_no_authfield in AuthState constructionTest plan
cargo build --workspace --lib- compiles cleancargo test -p openfang-api -p openfang-runtime -p openfang-types- all 910+ tests passcargo clippy --workspace --all-targets -- -D warnings- zero warningsPart of #1030 OAuth providers review split (PR 3 of 3)