Fix nested credential path scope matching - #6
Merged
Conversation
Match multi-level credential paths only at slash boundaries while preserving first-match precedence. Align credential URL parsing with Git and prevent debug logs from exposing credential secrets. Co-Authored-By: Codex (gpt-5.6-sol) <noreply@openai.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.
Summary
0600permissions on POSIX systemscredential.useHttpPath, credential ordering, the scope extension, and the relevant official Git referencesMotivation
PR #4 identified the need for multi-level GitLab group credentials. This implementation addresses that use case without raw
strings.HasPrefixmatching, which could allowgroup/subto matchgroup/submarineor an empty path to match every repository.Git's built-in credential store uses exact field matching. This helper retains exact matching and adds slash-delimited path scopes as an explicit, documented project-specific extension.
Testing
git diff --checkgo test -count=1 ./...go vet ./...go test -count=1 -race ./...go test -count=100 ./...go test -cover ./...(61.1%)gitleaksscan of the resulting commit (no leaks found)