The path/filepath standard library package. Join(), Abs(), Clean() are used as sanitizers in path traversal rules when combined with containment checks.
.Join()SanitizerJoin(elem ...string) string
Joins path elements. Sanitizer when followed by a prefix containment check.
.Abs()SanitizerAbs(path string) (string, error)
Returns absolute path. Sanitizer when result is checked against allowed root.
.Clean()SanitizerClean(path string) string
Lexically cleans path. Partial sanitizer — still needs containment check.
.Base()SanitizerBase(path string) string
Returns last element of path. Strips directory traversal sequences.
| FQN | Field | |
|---|---|---|
| path/filepath | fqns[0] | |
| filepath.* | patterns |
Wrong FQN → 0 findings. Verify with: change fqns to garbage → must produce 0 results.
// standard library — no go.mod entry required
from codepathfinder.go_rule import GoFilepath