📝 fermata: purge botignore.toml from all docs
Update crate README, CLAUDE.md, configuration.md, commands.md, threat-model.md, security-philosophy.md, and tools/fermata.md to reflect the unified .botsecrets [policy] config. No more three-file story — it's .botignore + .botsecrets everywhere. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
ac11512f62
commit
7b660b3da0
@@ -12,7 +12,7 @@ Harness-agnostic policy gate and secret filtering engine for AI coding agents.
|
|||||||
|
|
||||||
Three concentric layers; nothing inner imports from anything outer.
|
Three concentric layers; nothing inner imports from anything outer.
|
||||||
|
|
||||||
- **`core/`** — harness-unaware, transport-unaware, sync. Types (`Op`, `Decision`), `.botignore` walker, `botignore.toml` parser, `Policy::check` / `check_command`, path extraction. Sync, no tokio.
|
- **`core/`** — harness-unaware, transport-unaware, sync. Types (`Op`, `Decision`), `.botignore` walker, `.botsecrets` `[policy]` parser, `Policy::check` / `check_command`, path extraction. Sync, no tokio.
|
||||||
- **`core/secrets/`** — the secret filtering engine:
|
- **`core/secrets/`** — the secret filtering engine:
|
||||||
- `config.rs` — `.botsecrets` TOML parser and hierarchical resolution (user, project, local override).
|
- `config.rs` — `.botsecrets` TOML parser and hierarchical resolution (user, project, local override).
|
||||||
- `manifest.rs` — discovers secret-containing files from `.botsecrets` patterns and loads their content for redaction.
|
- `manifest.rs` — discovers secret-containing files from `.botsecrets` patterns and loads their content for redaction.
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ fermata interposes on every tool call in the agent's lifecycle:
|
|||||||
```
|
```
|
||||||
Agent wants to run a tool
|
Agent wants to run a tool
|
||||||
|
|
|
|
||||||
PreToolUse ── fermata checks .botignore / botignore.toml
|
PreToolUse ── fermata checks .botignore / .botsecrets [policy]
|
||||||
| blocked? → deny with reason
|
| blocked? → deny with reason
|
||||||
| allowed? ↓
|
| allowed? ↓
|
||||||
Tool executes
|
Tool executes
|
||||||
@@ -87,7 +87,7 @@ Three layers of defense, each independent:
|
|||||||
|
|
||||||
| Layer | Mechanism | What it catches |
|
| Layer | Mechanism | What it catches |
|
||||||
|-------|-----------|-----------------|
|
|-------|-----------|-----------------|
|
||||||
| **Access control** | `.botignore` rules block tool calls by path | Direct reads/writes to sensitive files |
|
| **Access control** | `.botignore` + `.botsecrets [policy]` rules block tool calls by path | Direct reads/writes to sensitive files |
|
||||||
| **Known-value redaction** | `.botsecrets` declares secret files; fermata parses them and builds an Aho-Corasick automaton | Every occurrence of a declared secret value, in any tool output, regardless of source |
|
| **Known-value redaction** | `.botsecrets` declares secret files; fermata parses them and builds an Aho-Corasick automaton | Every occurrence of a declared secret value, in any tool output, regardless of source |
|
||||||
| **Heuristic detection** | Regex patterns from gitleaks detect undeclared secrets (AWS keys, JWTs, GitHub PATs, database URLs) | Secrets not covered by the manifest -- runtime-generated, unexpected locations |
|
| **Heuristic detection** | Regex patterns from gitleaks detect undeclared secrets (AWS keys, JWTs, GitHub PATs, database URLs) | Secrets not covered by the manifest -- runtime-generated, unexpected locations |
|
||||||
|
|
||||||
@@ -95,7 +95,7 @@ Performance: ~1-5ms per tool call. Cold start (loading config + parsing secret f
|
|||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
Three files, each optional, each solving a different problem:
|
Two files, each optional, each solving a different problem:
|
||||||
|
|
||||||
### `.botignore` -- the 80% case
|
### `.botignore` -- the 80% case
|
||||||
|
|
||||||
@@ -107,22 +107,22 @@ Gitignore syntax. Blocks both reads and writes. Onboarding is one line.
|
|||||||
secrets/**
|
secrets/**
|
||||||
```
|
```
|
||||||
|
|
||||||
### `botignore.toml` -- per-operation rules
|
### `.botsecrets` -- per-operation policy rules + secret value redaction
|
||||||
|
|
||||||
Separate namespaces so the same file can be readable but not writable:
|
`.botsecrets` serves double duty: it declares which files contain secrets (for redaction) **and** provides per-operation policy rules under `[policy.*]` sections. Separate namespaces let the same file be readable but not writable:
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
[read]
|
[policy.read]
|
||||||
patterns = [".env*", "secrets/**"]
|
patterns = [".env*", "secrets/**"]
|
||||||
|
|
||||||
[write]
|
[policy.write]
|
||||||
patterns = ["vendor/**", "*.lock"]
|
patterns = ["vendor/**", "*.lock"]
|
||||||
|
|
||||||
[bash]
|
[policy.bash]
|
||||||
deny = ["rm -rf /", "curl * | sh"]
|
deny = ["rm -rf /", "curl * | sh"]
|
||||||
```
|
```
|
||||||
|
|
||||||
### `.botsecrets` -- secret value redaction
|
#### Secret value redaction
|
||||||
|
|
||||||
Declares which files contain secrets. fermata parses them, extracts values, and redacts every occurrence in tool output.
|
Declares which files contain secrets. fermata parses them, extracts values, and redacts every occurrence in tool output.
|
||||||
|
|
||||||
@@ -205,7 +205,7 @@ The policy engine and redaction logic are identical across all modes. Only the I
|
|||||||
v0.2 -- policy gate and secret filtering engine are production-ready. All core components are implemented and tested:
|
v0.2 -- policy gate and secret filtering engine are production-ready. All core components are implemented and tested:
|
||||||
|
|
||||||
- `.botignore` walker with gitignore semantics
|
- `.botignore` walker with gitignore semantics
|
||||||
- `botignore.toml` with read/write/bash namespaces
|
- `.botsecrets [policy]` with read/write/bash namespaces
|
||||||
- Claude Code PreToolUse and PostToolUse adapters
|
- Claude Code PreToolUse and PostToolUse adapters
|
||||||
- `.botsecrets` config, manifest discovery, multi-format parser (.env, TOML, YAML, JSON)
|
- `.botsecrets` config, manifest discovery, multi-format parser (.env, TOML, YAML, JSON)
|
||||||
- Aho-Corasick known-value redactor
|
- Aho-Corasick known-value redactor
|
||||||
|
|||||||
+5
-6
@@ -6,7 +6,7 @@ Fermata is a policy gate and secret filtering engine for AI coding agents. It sh
|
|||||||
|
|
||||||
## fermata check
|
## fermata check
|
||||||
|
|
||||||
Check whether one or more paths are allowed for a given operation. Fermata locates the nearest project root (a directory containing `.botignore`, `botignore.toml`, or `.git`) and evaluates the policy defined there.
|
Check whether one or more paths are allowed for a given operation. Fermata locates the nearest project root (a directory containing `.botignore`, `.botsecrets`, or `.git`) and evaluates the policy defined there.
|
||||||
|
|
||||||
**Usage**
|
**Usage**
|
||||||
|
|
||||||
@@ -79,7 +79,7 @@ Fermata follows a **fail-open** policy for hooks: if the payload cannot be parse
|
|||||||
|
|
||||||
**Event types**
|
**Event types**
|
||||||
|
|
||||||
- **pre-tool-use** -- Runs before the tool executes. Fermata checks the requested path or command against `.botignore` / `botignore.toml` and returns an allow, deny, or ask decision to the harness.
|
- **pre-tool-use** -- Runs before the tool executes. Fermata checks the requested path or command against `.botignore` / `.botsecrets [policy]` and returns an allow, deny, or ask decision to the harness.
|
||||||
- **post-tool-use** -- Runs after the tool executes. Fermata loads `.botsecrets`, builds a manifest of known secret values, and redacts any matches from the tool output before it enters the LLM context. A heuristic scanner (regex patterns derived from gitleaks) catches undeclared secrets as a safety net.
|
- **post-tool-use** -- Runs after the tool executes. Fermata loads `.botsecrets`, builds a manifest of known secret values, and redacts any matches from the tool output before it enters the LLM context. A heuristic scanner (regex patterns derived from gitleaks) catches undeclared secrets as a safety net.
|
||||||
|
|
||||||
**Examples**
|
**Examples**
|
||||||
@@ -103,8 +103,7 @@ Fermata does not have its own global config file. All configuration lives in you
|
|||||||
| File | Purpose |
|
| File | Purpose |
|
||||||
|------|---------|
|
|------|---------|
|
||||||
| `.botignore` | Gitignore-syntax patterns. Blocks both reads and writes to matched paths. |
|
| `.botignore` | Gitignore-syntax patterns. Blocks both reads and writes to matched paths. |
|
||||||
| `botignore.toml` | Per-operation rules with `[read]`, `[write]`, and `[bash]` sections. |
|
| `.botsecrets` | TOML file with `[policy.read]`, `[policy.write]`, and `[policy.bash]` sections for per-operation rules, plus secret redaction configuration. |
|
||||||
| `.botsecrets` | TOML file declaring which files contain secrets, custom key patterns, and heuristic scanning options. |
|
|
||||||
|
|
||||||
Fermata discovers these files by walking up from the target path (or the current working directory for `hook`) until it finds a project root.
|
Fermata discovers these files by walking up from the target path (or the current working directory for `hook`) until it finds a project root.
|
||||||
|
|
||||||
@@ -164,10 +163,10 @@ Add both hook events to `.claude/settings.json`:
|
|||||||
|
|
||||||
### Block dangerous shell commands
|
### Block dangerous shell commands
|
||||||
|
|
||||||
Use `botignore.toml` to deny specific command patterns:
|
Use `.botsecrets [policy.bash]` to deny specific command patterns:
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
[bash]
|
[policy.bash]
|
||||||
deny = ["rm -rf /", "curl * | sh", "wget * | bash"]
|
deny = ["rm -rf /", "curl * | sh", "wget * | bash"]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
+38
-43
@@ -1,16 +1,15 @@
|
|||||||
# Configuration Reference
|
# Configuration Reference
|
||||||
|
|
||||||
Fermata uses three configuration files to control what an AI coding agent can
|
Fermata uses two configuration files to control what an AI coding agent can
|
||||||
access and what secret values it can see. Configuration is layered, with later
|
access and what secret values it can see. Configuration is layered, with later
|
||||||
(more specific) sources overriding earlier ones.
|
(more specific) sources overriding earlier ones.
|
||||||
|
|
||||||
| File | Purpose | Syntax |
|
| File | Purpose | Syntax |
|
||||||
|------|---------|--------|
|
|------|---------|--------|
|
||||||
| `.botignore` | Block agent access to matching paths (reads and writes) | gitignore |
|
| `.botignore` | Block agent access to matching paths (reads and writes) | gitignore |
|
||||||
| `botignore.toml` | Fine-grained per-operation rules (read, write, bash) | TOML |
|
| `.botsecrets` | Per-operation policy rules (`[policy.read]`, `[policy.write]`, `[policy.bash]`) and secret redaction configuration | TOML |
|
||||||
| `.botsecrets` | Declare secret-containing files and control redaction | TOML |
|
|
||||||
|
|
||||||
All three files are optional. Without any configuration Fermata allows all
|
Both files are optional. Without any configuration Fermata allows all
|
||||||
operations and performs no redaction. Add only the files you need.
|
operations and performs no redaction. Add only the files you need.
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -20,7 +19,7 @@ operations and performs no redaction. Add only the files you need.
|
|||||||
A `.botignore` file uses **gitignore syntax** to block agent access to matching
|
A `.botignore` file uses **gitignore syntax** to block agent access to matching
|
||||||
paths. When a path matches, both reads and writes are denied. There is no
|
paths. When a path matches, both reads and writes are denied. There is no
|
||||||
distinction between operations -- if you need per-operation control, use
|
distinction between operations -- if you need per-operation control, use
|
||||||
`botignore.toml` instead.
|
`.botsecrets [policy.*]` sections instead.
|
||||||
|
|
||||||
### Placement and Scoping
|
### Placement and Scoping
|
||||||
|
|
||||||
@@ -74,18 +73,19 @@ id_ed25519
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## `botignore.toml` -- Per-Operation Rules
|
## `.botsecrets` -- Policy Rules and Secret Redaction
|
||||||
|
|
||||||
`botignore.toml` provides fine-grained control by separating rules into three
|
`.botsecrets` is the central TOML configuration file. It combines two concerns:
|
||||||
namespaces: `[read]`, `[write]`, and `[bash]`. Place this file at the project
|
|
||||||
root alongside `.botignore`.
|
|
||||||
|
|
||||||
When both `.botignore` and `botignore.toml` are present, they are evaluated
|
- **Per-operation policy rules** (`[policy.read]`, `[policy.write]`, `[policy.bash]`) -- fine-grained control over which paths and commands the agent can use.
|
||||||
together. `.botignore` is checked first (blocking both reads and writes), then
|
- **Secret redaction** (`[files]`, `[keys]`, `[redaction]`, `[heuristic]`, `[enforcement]`, `[[file]]`) -- declares which files contain secrets and how Fermata should redact them from tool output.
|
||||||
`botignore.toml` namespace-specific rules are applied. A path blocked by either
|
|
||||||
|
When both `.botignore` and `.botsecrets [policy.*]` sections are present, they
|
||||||
|
are evaluated together. `.botignore` is checked first (blocking both reads and
|
||||||
|
writes), then `.botsecrets` policy rules are applied. A path blocked by either
|
||||||
source is denied.
|
source is denied.
|
||||||
|
|
||||||
### `[read]` -- Read Access Rules
|
### `[policy.read]` -- Read Access Rules
|
||||||
|
|
||||||
Blocks the agent from reading matching paths. Patterns use glob syntax.
|
Blocks the agent from reading matching paths. Patterns use glob syntax.
|
||||||
|
|
||||||
@@ -94,11 +94,11 @@ Blocks the agent from reading matching paths. Patterns use glob syntax.
|
|||||||
| `patterns` | `string[]` | Glob patterns for paths the agent cannot read. |
|
| `patterns` | `string[]` | Glob patterns for paths the agent cannot read. |
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
[read]
|
[policy.read]
|
||||||
patterns = [".env*", "secrets/**", "*.pem"]
|
patterns = [".env*", "secrets/**", "*.pem"]
|
||||||
```
|
```
|
||||||
|
|
||||||
### `[write]` -- Write Access Rules
|
### `[policy.write]` -- Write Access Rules
|
||||||
|
|
||||||
Blocks the agent from writing to matching paths. Patterns use glob syntax.
|
Blocks the agent from writing to matching paths. Patterns use glob syntax.
|
||||||
|
|
||||||
@@ -107,11 +107,11 @@ Blocks the agent from writing to matching paths. Patterns use glob syntax.
|
|||||||
| `patterns` | `string[]` | Glob patterns for paths the agent cannot write to. |
|
| `patterns` | `string[]` | Glob patterns for paths the agent cannot write to. |
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
[write]
|
[policy.write]
|
||||||
patterns = ["vendor/**", "*.lock", "migrations/**"]
|
patterns = ["vendor/**", "*.lock", "migrations/**"]
|
||||||
```
|
```
|
||||||
|
|
||||||
### `[bash]` -- Command Execution Rules
|
### `[policy.bash]` -- Command Execution Rules
|
||||||
|
|
||||||
Controls which shell commands the agent can run. Commands are evaluated in
|
Controls which shell commands the agent can run. Commands are evaluated in
|
||||||
priority order: deny, then allow_prefixes, then ask. If none match, the
|
priority order: deny, then allow_prefixes, then ask. If none match, the
|
||||||
@@ -131,35 +131,33 @@ Evaluation order:
|
|||||||
4. Otherwise the command is **allowed**.
|
4. Otherwise the command is **allowed**.
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
[bash]
|
[policy.bash]
|
||||||
deny = ["rm -rf /", "curl * | sh", ":(){ :|:& };:"]
|
deny = ["rm -rf /", "curl * | sh", ":(){ :|:& };:"]
|
||||||
allow_prefixes = ["cargo", "npm", "git status"]
|
allow_prefixes = ["cargo", "npm", "git status"]
|
||||||
ask = ["docker", "kubectl"]
|
ask = ["docker", "kubectl"]
|
||||||
```
|
```
|
||||||
|
|
||||||
### Full `botignore.toml` Example
|
### Full Policy Example
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
[read]
|
[policy.read]
|
||||||
patterns = [".env*", "secrets/**"]
|
patterns = [".env*", "secrets/**"]
|
||||||
|
|
||||||
[write]
|
[policy.write]
|
||||||
patterns = ["vendor/**", "*.lock", "dist/**"]
|
patterns = ["vendor/**", "*.lock", "dist/**"]
|
||||||
|
|
||||||
[bash]
|
[policy.bash]
|
||||||
deny = ["rm -rf /", "curl * | sh"]
|
deny = ["rm -rf /", "curl * | sh"]
|
||||||
allow_prefixes = ["cargo", "npm", "just"]
|
allow_prefixes = ["cargo", "npm", "just"]
|
||||||
ask = ["docker", "kubectl", "terraform"]
|
ask = ["docker", "kubectl", "terraform"]
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
### Secret Redaction
|
||||||
|
|
||||||
## `.botsecrets` -- Secret Redaction
|
The secret redaction sections of `.botsecrets` declare which files contain
|
||||||
|
secrets and how Fermata should redact them from tool output. This prevents
|
||||||
`.botsecrets` declares which files contain secrets and how Fermata should
|
secret values from leaking into the LLM context window even when the agent
|
||||||
redact them from tool output. This prevents secret values from leaking into
|
reads files indirectly (via shell output, log files, error messages, etc.).
|
||||||
the LLM context window even when the agent reads files indirectly (via shell
|
|
||||||
output, log files, error messages, etc.).
|
|
||||||
|
|
||||||
### Layered Configuration
|
### Layered Configuration
|
||||||
|
|
||||||
@@ -385,25 +383,25 @@ style = "masked"
|
|||||||
|
|
||||||
### Fine-Grained: Separate Read, Write, and Bash Rules
|
### Fine-Grained: Separate Read, Write, and Bash Rules
|
||||||
|
|
||||||
Use `botignore.toml` when you need different rules for different operations:
|
Use `.botsecrets [policy.*]` sections when you need different rules for different operations:
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
# botignore.toml
|
# .botsecrets
|
||||||
[read]
|
[policy.read]
|
||||||
patterns = [".env*", "secrets/**"]
|
patterns = [".env*", "secrets/**"]
|
||||||
|
|
||||||
[write]
|
[policy.write]
|
||||||
patterns = ["vendor/**", "*.lock", "Cargo.toml"]
|
patterns = ["vendor/**", "*.lock", "Cargo.toml"]
|
||||||
|
|
||||||
[bash]
|
[policy.bash]
|
||||||
deny = ["rm -rf *"]
|
deny = ["rm -rf *"]
|
||||||
allow_prefixes = ["cargo", "npm", "git"]
|
allow_prefixes = ["cargo", "npm", "git"]
|
||||||
ask = ["docker", "kubectl"]
|
ask = ["docker", "kubectl"]
|
||||||
```
|
```
|
||||||
|
|
||||||
### Full-Featured: All Three Files
|
### Full-Featured: Both Files
|
||||||
|
|
||||||
A production setup using all configuration files together:
|
A production setup using both configuration files together:
|
||||||
|
|
||||||
```gitignore
|
```gitignore
|
||||||
# .botignore
|
# .botignore
|
||||||
@@ -416,21 +414,18 @@ id_ed25519
|
|||||||
```
|
```
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
# botignore.toml
|
# .botsecrets
|
||||||
[read]
|
[policy.read]
|
||||||
patterns = ["secrets/**", ".aws/**"]
|
patterns = ["secrets/**", ".aws/**"]
|
||||||
|
|
||||||
[write]
|
[policy.write]
|
||||||
patterns = ["vendor/**", "*.lock", "dist/**", "migrations/**"]
|
patterns = ["vendor/**", "*.lock", "dist/**", "migrations/**"]
|
||||||
|
|
||||||
[bash]
|
[policy.bash]
|
||||||
deny = ["rm -rf /", "curl * | sh"]
|
deny = ["rm -rf /", "curl * | sh"]
|
||||||
allow_prefixes = ["cargo", "npm", "just", "git"]
|
allow_prefixes = ["cargo", "npm", "just", "git"]
|
||||||
ask = ["docker", "terraform"]
|
ask = ["docker", "terraform"]
|
||||||
```
|
|
||||||
|
|
||||||
```toml
|
|
||||||
# .botsecrets
|
|
||||||
[files]
|
[files]
|
||||||
patterns = [".env", ".env.*", "config/credentials.yaml"]
|
patterns = [".env", ".env.*", "config/credentials.yaml"]
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ The agent calls a path-typed tool (Read, Write, Edit) with an explicit file path
|
|||||||
|
|
||||||
> `Read({"file_path": "/home/user/.env"})` -- `.botignore` matches -- deny.
|
> `Read({"file_path": "/home/user/.env"})` -- `.botignore` matches -- deny.
|
||||||
|
|
||||||
Both `.botignore` (gitignore semantics, deepest directory wins, negation patterns work as in git) and `botignore.toml` `[read]`/`[write]` glob lists are evaluated against the resolved path. This covers the overwhelming majority of accidental secret-file reads, because most agents use direct path tools as their primary file access method.
|
Both `.botignore` (gitignore semantics, deepest directory wins, negation patterns work as in git) and `.botsecrets` `[policy.read]`/`[policy.write]` glob lists are evaluated against the resolved path. This covers the overwhelming majority of accidental secret-file reads, because most agents use direct path tools as their primary file access method.
|
||||||
|
|
||||||
### L1: Absolute paths inside Bash commands
|
### L1: Absolute paths inside Bash commands
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user