Repository navigation
visibility: fix multi-wildcard globs and *.pem matching (SEC-01, SEC-02) - #35
Merged
Merged
Conversation
kridaydave
force-pushed
the
fix/pr-15-visibility-matcher-globs
branch
from
November 8, 2026 18:01
aa1ea8a to
4d7aa25
Compare
… SEC-02)
SEC-02: matches_pattern used split_once('*') so patterns with more than one
wildcard (e.g. *key*, *audit*, a*b*c) never matched real paths/branches.
Replace with segment-wise matching that handles any number of '*' wildcards.
SEC-01: private key files like key.pem/deploy/id.pem were not caught by the
repo visibility policy. visibility.toml documented '*.pem' as the suffix form
while the config used literal '.pem'; switch the policy to '*.pem' (matching
documented intent) and add a regression test covering multi-* globs and the
*.pem suffix case.
kridaydave
force-pushed
the
fix/pr-15-visibility-matcher-globs
branch
from
November 8, 2026 18:50
5d60c80 to
93456c9
Compare
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.
Bugs
*.pemkey coverage) did not catch real key files likekey.pem/deploy/id.pemin practice because the documented suffix form was not used in config; visibility must follow the documented.pem(literal) vs*.pem(suffix) intent.matches_patternused a singlesplit_once('*')with literalends_with, so patterns with more than one*(e.g.*key*,*audit*,a*b*c) never matched real paths/branches.What was wrong
src/visibility.rs:80-89(matches_pattern):split_once('*')left any later*inside the suffix, making multi-wildcard patterns require a literal*in the candidate. This under-matched both path globs and private-branch globs.visibility.tomlalso listed.pem(literal) while the documented suffix form for private keys is*.pem, leaving key files likekey.pem/deploy/id.pemoutside the repo policy.Fix
matches_patternto split on every*and match prefix, ordered middle segments, and suffix (handling any number of wildcards, preserving fail-closed behavior).visibility.tomlprivate_pathsto use*.pem(the documented suffix form) so private key files are caught as intended, without changing.pem's documented literal semantics.src/visibility.rsunit tests for multi-*path/branch globs and*.pemsuffix matching.Verification
CI green (fmt, clippy, tests, release build, adjudication) + the regression test added (
test_path_globs_support_multiple_wildcards_and_pem_suffix)