Policy File (.rafter.yml)
The.rafter.yml file defines project-level security policies that override your global ~/.rafter/config.json settings. Place it in your project root and Rafter picks it up automatically.
How It Works
When anyrafter agent command runs, the CLI walks from your current directory up to the git root looking for .rafter.yml or .rafter.yaml. If found, its values merge into the loaded config with policy file winning on conflicts.
Arrays like blocked_patterns replace the corresponding ~/.rafter/config.json values entirely rather than appending. Note that hardcoded defaults (e.g. the built-in exclusion list and 21+ secret patterns) always apply regardless of what the policy file sets.
Full Schema
Custom Scan Patterns
Add organization-specific secret patterns that the default 21 patterns don’t cover:- name: Human-readable identifier shown in scan output
- regex: JavaScript-compatible regular expression
- severity:
critical,high,medium, orlow
Exclude Paths
Skip directories during secret scanning:node_modules, .git, dist, build, .next, coverage, .vscode, .idea) always apply. Your exclude_paths add to that list.
Command Policy Overrides
Lock down command execution rules per project:Precedence Rules
| Setting | Source | Priority |
|---|---|---|
| Risk level | .rafter.yml | Wins |
| Risk level | ~/.rafter/config.json | Default |
| Blocked patterns | .rafter.yml | Replaces config.json |
| Custom patterns | .rafter.yml | Added to built-in 21+ |
| Exclude paths | .rafter.yml | Added to built-in exclusions |
Best Practices
Recommendations
- Commit
.rafter.ymlto version control so the whole team gets the same policies - Start with
risk_level: moderateand tighten as needed - Add custom patterns for any organization-specific secret formats
- Use
exclude_pathsfor vendored code or generated files

