Harden REST auth defaults: startup fail-fast + opt-in WS query-key fallback#433
Open
hiroshitanaka-creator wants to merge 1 commit intomainfrom
Open
Harden REST auth defaults: startup fail-fast + opt-in WS query-key fallback#433hiroshitanaka-creator wants to merge 1 commit intomainfrom
hiroshitanaka-creator wants to merge 1 commit intomainfrom
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
evaluate_auth_policy()design and make minimal, testable changes with docs and examples aligned.Description
ws_allow_query_api_key: bool = FalsetoAPISettings(envPO_WS_ALLOW_QUERY_API_KEY) and wired it into the WS auth resolver so?api_key=is accepted only when explicitly enabled._validate_startup_auth_configuration()called fromcreate_app()that raises aRuntimeErrorwhenPO_SKIP_AUTH=falseandPO_API_KEYis empty/blank (dev mode withPO_SKIP_AUTH=trueremains allowed)._resolve_ws_auth_key()to prefer header auth and only use query param whenws_allow_query_api_keyis true, and preserved the sharedevaluate_auth_policy()path.README.md,.env.example,docker-compose.yml) and adjusted benchmark fixture to create the app with explicit settings and a warm-up request to avoid cold-start skew.tests/unit/test_rest_api.pyandtests/benchmarks/test_rest_perf.pyto cover startup fail-fast, WS query-param opt-in, and benchmark compatibility.Testing
pytest -q tests/unit/test_rest_api.pyand the file passed (new startup + WS tests included).pytest -q tests/benchmarks/test_rest_perf.pyafter adding warm-up; benchmarks passed.pytest -qwhich completed successfully: final run reported3724 passed, 4 skipped.Codex Task