Repository navigation
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4912 +/- ##
==========================================
+ Coverage 98.65% 98.71% +0.06%
==========================================
Files 48 48
Lines 3188 3190 +2
==========================================
+ Hits 3145 3149 +4
+ Misses 43 41 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
BasicAuth, BasicAuthForRealm, and BasicAuthForProxy currently compare the entire authorization header case-sensitively. Correct credentials with
basic,BASIC, orbAsIctherefore receive 401/407. RFC 9110 section 11.1 specifies that authentication scheme names are case-insensitive; Go'snet/http.Request.BasicAuthaccepts these variants as well.Match the fixed-length
Basicprefix case-insensitively, then compare the encoded credentials with the existingsubtle.ConstantTimeCompare. Credentials remain case-sensitive. No API or dependencies are added.The regression test exercises origin and proxy authentication with 30 subcases, including valid scheme variants, malformed headers, other schemes, a non-ASCII lookalike, and changes to encoded credentials, username, or password case. It checks response bodies, authenticated user values, and 401/407 challenges. Exactly six valid cases fail before the fix; all 30 pass afterward. An independent HTTP service reproduces the issue on tagged v1.12.0 and current master (
0f09c3a) and succeeds with this fix.Validation on Windows/amd64 with Go 1.26.2:
go vet ./...: passed.TestSaveUploadedFileWithPermission,TestSaveUploadedFileWithPermissionFailed,TestSaveUploadedFileToExistingDir, andTestFileDescriptor. No skips or workflow changes are included in this PR.--new-from-rev upstream/master: 0 issues.auth.gohas 100% statement coverage in the default local package suite.binding.TestMappingStructField; the same isolated test panics on unchanged master.Current-commit CI: all 20 Linux/macOS combinations of Go 1.26/1.27 and default, nomsgpack, Sonic, go_json, and race passed, along with lint, CodeQL, and Codecov. Run Tests.
Known baseline: Trivy reports five vulnerabilities in unchanged
golang.org/x/net v0.57.0. The official master scan reports the same five findings. Dependency updates are outside this focused fix.Pull Request Checklist
masterbranch.docs/doc.md. (Not applicable: bug fix.)One commit, changing only
auth.goandauth_test.go. The CI checkbox remains unchecked because the baseline Trivy security findings remain unresolved.