Repository navigation
fix: validate authentication headers case-insensitively - #17
Draft
Kayvan Zahiri (Kayvan-Zahiri) wants to merge 1 commit into
Draft
Kayvan Zahiri (Kayvan-Zahiri) wants to merge 1 commit into
Kayvan Zahiri (Kayvan-Zahiri) wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
With credentials supplied through
default_headersor per-requestextra_headers, the SDK rejects valid lowercaseauthorizationand mixed-caseX-API-Keyheaders before sending the request. HTTP header names are case-insensitive, but both generated_validate_headersmethods look up dictionary keys with fixed casing.Normalize names locally before checking credentials and explicit omission in the sync and async clients. Missing credentials still fail locally. This change does not alter outgoing header merging or wire spelling.
Adds 34 offline public
machines.list()cases across both clients: three casings of each supported credential header, default/per-request headers, explicit omission, and missing-auth rejection. HTTPX MockTransport checks the requests without calling a deployment.Validation: 20 new cases fail and 14 controls pass before the fix; all 36 discovered offline tests pass afterward, including the two existing retry tests. The live
smoke-test.pyscript was not run. New-test Ruff lint, source blocking lint, andgit diff --checkpass. The CI-pinned Ruff 0.16.8 formatter accepts all 86 files; wheel and source-distribution builds pass. Broader client lint and mypy retain 10 and 4 findings respectively, reproduced with the original client source.This is generated Scalar code. Please carry the case-insensitive lookup into the authentication-validation generator/template so regeneration preserves the fix; this draft demonstrates the change and provides regressions.