fix(rest): fail-closed when API key is not configured - #431
Open
hiroshitanaka-creator wants to merge 1 commit into
Open
fix(rest): fail-closed when API key is not configured#431hiroshitanaka-creator wants to merge 1 commit into
hiroshitanaka-creator wants to merge 1 commit into
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
PO_API_KEYwas empty, which left network-exposed endpoints unauthenticated by default.Description
require_api_keyinsrc/po_core/app/rest/auth.pyto only bypass whenskip_auth=Trueand to raise503 Service Unavailablewhen auth is enabled butapi_keyis empty instead of allowing access.401 Unauthorizedresponse for invalid or missing client keys when an API key is configured.test_reason_auth_returns_503_when_key_not_configuredtotests/unit/test_rest_api.pythat verifies protected endpoints return503whenskip_auth=Falseandapi_keyis unset.Testing
pytest -q tests/unit/test_rest_api.py -k "auth"and the selected REST authentication tests passed (5 passed).pytest -q; the run completed but two benchmark timing tests failed in this environment:tests/benchmarks/test_pipeline_perf.py::test_bench_concurrent_warn_requestsandtests/benchmarks/test_pipeline_perf.py::test_bench_deliberation_scaling, which are unrelated timing-sensitive benchmarks and do not affect the auth regression fix.Codex Task