Skip to content

Comments

fix path parsing to be cleaned and tested ahead of opening file#275

Merged
bobcallaway merged 1 commit intosigstore:mainfrom
bobcallaway:parser_fix
Feb 23, 2026
Merged

fix path parsing to be cleaned and tested ahead of opening file#275
bobcallaway merged 1 commit intosigstore:mainfrom
bobcallaway:parser_fix

Conversation

@bobcallaway
Copy link
Member

This PR addresses a path validation vulnerability in pkg/config/parser.go by replacing a simple string prefix check with robust path canonicalization and relative path verification.

The previous implementation used strings.HasPrefix(path, basedir), which was vulnerable to two specific bypass techniques:

  1. Sibling Directory Bypass:
    Paths like /a/bc/evil.yaml would incorrectly pass validation against a base directory of /a/b because the string prefix matches, even though they are sibling directories.

  2. Lack of Canonicalization:
    Paths containing traversal sequences like /safe/dir/../../../etc/passwd would pass validation against /safe/dir because the raw string prefix matches, despite resolving to a location outside the base directory.

Signed-off-by: Bob Callaway <bcallaway@google.com>
@bobcallaway bobcallaway enabled auto-merge (squash) February 23, 2026 19:27
@bobcallaway bobcallaway merged commit 2a2312b into sigstore:main Feb 23, 2026
3 checks passed
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.

2 participants