fix(rule): harden protected path normalization - #47
Open
ronheichman wants to merge 9 commits into
Open
ronheichman wants to merge 9 commits into
ronheichman wants to merge 9 commits into
Conversation
Expose canonical_path(string) to rules: path.Clean plus a /proc/<self|thread-self|PID>/root strip, so a rule compares one normalized target instead of enumerating traversal and proc-root disguises in bounded regex. Closes the fixed-depth traversal hole a hand-rolled regex cannot: dir/../ chains resolve at any depth.
ronheichman
force-pushed
the
canonical-path-operand
branch
from
August 28, 2026 20:31
a9a971c to
41669e2
Compare
ronheichman
marked this pull request as ready for review
August 29, 2026 02:15
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
canonical_path()CEL helper for separator, dot-segment, Windows drive/UNC, and supported Linux/proc/.../rootnormalizationvisudofile, edit, check, and export option forms without adding a generic command-option parsercanonical_path()does not access the filesystem or resolve arbitrary symlinks. Relative paths stay relative, and Windows drive and UNC roots remain distinct. Rule versions and generated checked expressions are updated.Compound-command enforcement is intentionally left to #46; this PR does not change the enforcement engine. There are no event-schema or dependency changes.
Verification
go generate ./ruleswith no generated diffgo test ./...go test -race ./...go vet ./...golangci-lint v2.12.2 rungolangci-lint v2.12.2 fmt --diffgovulncheck v1.6.0 ./...go mod tidywith no module diff