2. Static path matching
Fifteen anchored path rules from paths.toml - the curated list of files that are always worth a decision.
| Phase | 1, static |
| Score | 3.0, 4.0 or 5.0 |
| Source | crates/grith-proxy/src/filters/path_match.rs |
| Config | config/filters/paths.toml - 15 rules |
The curated list. Fifteen rules, each naming a path shape, the operations it applies to, and
a score. Every rule is tested and the highest-scoring match wins - overlapping rules like
~/.ssh/* and ~/.ssh/id_* are both considered, not short-circuited.
The shipped rules
| Rule | Pattern | Operations | Score |
|---|---|---|---|
ssh-private-key | ~/.ssh/id_* | read, write, delete | 5.0 |
etc-shadow | /etc/shadow* | read, write | 5.0 |
gnupg | ~/.gnupg/* | read, write, delete | 4.0 |
aws-credentials | ~/.aws/* | read, write, delete | 4.0 |
gcloud-config | ~/.config/gcloud/* | read, write, delete | 4.0 |
pem-files | *.pem | read, write, delete | 4.0 |
key-files | *.key | read, write, delete | 4.0 |
terraform-state | *.tfstate | read, write, delete | 4.0 |
cargo-credentials-store | ~/.cargo/credentials* | read, write, delete | 4.0 |
git-credentials-store | .git-credentials | read, write, delete | 4.0 |
git-credentials-store-xdg | ~/.config/git/credentials | read, write, delete | 4.0 |
ssh-dir | ~/.ssh/* | write, delete, list | 3.0 |
env-file | .env | read, write, delete | 3.0 |
env-file-variants | .env.* | read, write, delete | 3.0 |
etc-system-write | /etc/* | write, delete | 3.0 |
Patterns are anchored
A pattern is compiled once, with its anchor preserved. /etc/* means the real /etc, not
any directory called etc further down a path - so a vendored node_modules/aria-query/lib/etc/
does not match. *.pem globs the basename, so /p/.pem-notes/a.js does not match. ~/
resolves against the user's home directory.
Two rules carry an exclude list. .env and .env.* skip .env.example, .env.sample,
.env.template, .env.dist and .env.defaults - committed scaffolding holds placeholders.
.env.local and .env.production are deliberately not excluded; they routinely hold real
secrets.
Every path a call touches is judged
A rename carries two paths, a link carries the target and the link name. Each is scored with its own operation and the worst result wins, so a link planted at a protected location is priced like the write it substitutes for.
Adding your own rules
Copy config/filters/paths.toml, add [[rules]] entries, and put the file at
./config/filters/paths.toml relative to the working directory the daemon starts in. That
file replaces the shipped one outright - it is not merged - so start from a copy. There is no
~/.config/grith/filters/paths.toml layer. See
Filter config files.
See also
- 3. Sensitive path heuristic - the built-in complement
- 4. Allowlist / denylist - your own exceptions