Repository navigation
fix(api): API key replaces Basic Auth on /api/v1 when set - #91
Merged
Merged
Conversation
Both schemes use the Authorization header, so with BITVAULT_API_KEY and Basic Auth configured no request could pass. A configured key is now the sole API credential; without a key Basic Auth still guards /api/v1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Fixes the credential conflict on
/api/v1: Basic Auth and the API key both used theAuthorizationheader, so with both configured no request could pass.Behaviour (per CTO decision, MIK-87):
BITVAULT_API_KEYset → bearer token is the only/api/v1credential; Basic Auth middleware is skipped on that scope. Wrong/missing bearer → 401API_KEY_REQUIRED./api/v1(except/health).Changes
src/util/auth.rs:api_scope_uses_basic_auth(api_key, basic_username);src/main.rsuses it for the/api/v1Condition.src/endpoints/api.rs: testsapi_key_replaces_basic_auth_on_api_scope,basic_auth_guards_api_scope_without_api_key.README.md,openapi.yaml: auth docs rewritten to match.Verified locally:
cargo fmt --check,cargo test endpoints::api(4/4),cargo clippy --all-targets -D warningsclean.🤖 Generated with Claude Code