Skip to content

Fix nested credential path scope matching - #6

Merged
ttys3 merged 1 commit into
mainfrom
fix/credential-path-scopes
Sep 4, 2026
Merged

Fix nested credential path scope matching#6
ttys3 merged 1 commit into
mainfrom
fix/credential-path-scopes

Conversation

@ttys3

@ttys3 ttys3 commented Sep 4, 2026

Copy link
Copy Markdown
Owner

Summary

  • support slash-boundary-aware credential scopes at arbitrary path depth while preserving exact matches and first-match precedence
  • align stored credential URL parsing and percent decoding with Git v2.55.0 behavior
  • reject ambiguous dot-segment scope inheritance and path-prefix collisions
  • keep passwords and malformed credential contents out of debug logs, and use 0600 permissions on POSIX systems
  • document credential.useHttpPath, credential ordering, the scope extension, and the relevant official Git references

Motivation

PR #4 identified the need for multi-level GitLab group credentials. This implementation addresses that use case without raw strings.HasPrefix matching, which could allow group/sub to match group/submarine or 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 --check
  • go test -count=1 ./...
  • go vet ./...
  • go test -count=1 -race ./...
  • go test -count=100 ./...
  • go test -cover ./... (61.1%)
  • differential checks against Git v2.55.0 URL parsing and decoding behavior
  • gitleaks scan of the resulting commit (no leaks found)

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>
@ttys3
ttys3 merged commit d2ff579 into main Sep 4, 2026
1 check failed
@ttys3
ttys3 deleted the fix/credential-path-scopes branch September 4, 2026 03:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant