-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Security: Authentication is fail-open when API key is unset #1131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
tuanaiseo
wants to merge
1
commit into
ace-step:main
Choose a base branch
from
tuanaiseo:contribai/fix/security/authentication-is-fail-open-when-api-key
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: ace-step/ACE-Step-1.5
Length of output: 50377
🏁 Script executed:
Repository: ace-step/ACE-Step-1.5
Length of output: 2376
🏁 Script executed:
Repository: ace-step/ACE-Step-1.5
Length of output: 96
🏁 Script executed:
Repository: ace-step/ACE-Step-1.5
Length of output: 47
🏁 Script executed:
Repository: ace-step/ACE-Step-1.5
Length of output: 3347
🏁 Script executed:
Repository: ace-step/ACE-Step-1.5
Length of output: 507
🏁 Script executed:
Repository: ace-step/ACE-Step-1.5
Length of output: 485
Implementation diverges from PR objectives: missing opt-out mechanism and startup warning; breaks existing tests.
The PR description specifies fail-closed by default with an explicit
ALLOW_UNAUTHENTICATEDescape hatch plus a high-severity startup log when auth is disabled. The current implementation instead unconditionally raises HTTP 503 when_api_key is None, which breaks the codebase in three ways:Existing test fails.
acestep/api/http/auth_test.py::test_verify_token_returns_none_when_auth_is_disabledcallsverify_token_from_request(body={}, authorization=None)and expectsNone, but lines 39–40 now raiseHTTPException(503). The test also callsverify_api_key(authorization=None)expecting success, but line 68 raises 503.Breaks unauthenticated deployments.
acestep/api_server.pyreadsACESTEP_API_KEYviaos.getenv("ACESTEP_API_KEY", None)and passes it toset_api_key. Any deployment without the env var (local dev, the gradio path inacestep/ui/gradio/api/api_routes.py) now 503s on every protected route with no migration path.Missing startup logging. There is no
logger.warningorlogger.erroremitted at configuration time (inset_api_key) to surface the insecure state.Also note:
acestep/ui/gradio/api/api_routes.py::verify_token_from_requeststill silently returnsNoneon unset key (fail-open), while the HTTP module version raises 503 (fail-closed). Either align them or clarify intent (is gradio intentionally left fail-open, or is that a bug?).Suggested fix: Gate the 503 response on an
ALLOW_UNAUTHENTICATEDflag read inset_api_key, emit a startup warning/error log if auth is unset, and update tests to set the flag when testing the "disabled auth" path.🤖 Prompt for AI Agents