57 Commits
Author SHA1 Message Date
g4borg d587ad6650 🛰️ export standalone-repo assets (cf003043) 2026-11-07 11:34:00 +01:00
g4borg e83d886fa3 docs(fermata): the page lists the command holes left for the shell parser, each with a test
N-1b (a shell line ending in a backslash), S-1b (grep -fe clusters), R-1
(writes through a shell's positional arguments), R-2 (bash -oc pipefail),
R-3 (PowerShell short switches) as known failures, and the echo-only
positional argument as an over-denial. Command checks are marked best
effort until the shell parser round. security-model.md says positional
arguments are read only as printed. No src change.
2026-11-07 11:33:15 +01:00
g4borg d679aec6c3 docs(fermata): the page drops bash -c -o pipefail and names an indented private block and the = and : write forms 2026-11-07 10:05:18 +01:00
g4borg 549cfd1ae3 fix(fermata): a shell's arguments are read as what it prints, its line flag only among leading options; a quoted operator is a word; an attached pattern leaves the file a file
N-1: a POSIX shell's words after its line get a printing segment of their own; eval, cmd
and PowerShell still join. N-2: the line flag is looked for among the shell's leading
options, skipping -o and the like, and PowerShell stops at -File. N-3: the splitter marks
unquoted < and > as tokens, so echo '>' | cat .env and cat '>' id_rsa are read. S-1:
--regexp, --file, --expression and clusters holding e or f give the pattern. A guard test
runs the re-check's ordinary commands.
2026-11-07 10:05:18 +01:00
g4borg 938ce2d766 docs(fermata): the page names the spaced exclude flag a rule still stops 2026-11-07 09:51:52 +01:00
g4borg b9e8e52731 docs(fermata): the page lists what stays open after the fixes; the failure diagram leaves the public README
threat-landscape.svg showed specific failures and nothing else used it, so it is gone. The
false entry on runs outside a project now names all four markers, with a test.
2026-11-07 09:48:21 +01:00
g4borg 67e41c58c3 fix(fermata): real openssl x509 -text output and curl's cacert.pem pass as certificates; a block must close with its own label 2026-11-07 09:48:21 +01:00
g4borg 1e3e3648a9 fix(fermata): a write never takes a printed file past the gate; a flag's value rule leaves file arguments; every spelling of a write and of a shell's line is read
-o counts as output only on a verb that neither prints nor is metadata, and on sort; what
sed -i and sort -o name stays Prints. A spaced exclude flag is skipped only where it takes
a value, so grep --ignore API .env is stopped again. >|, <>, a name with a space, sed -Ei
and --in-place, attached flag values, cp -t and a glob matching nothing yet are writes.
-ce, -cx, --command, rbash and more shells, pwsh -Com, cmd /k, bash -c --, and eval's whole
argument list are read, with all the words after the flag. git commit -F is no metadata.
Remote scp and rsync targets are no local path.
2026-11-07 09:48:21 +01:00
g4borg 709f0cf1bc docs(fermata): the failure list moves out of the READMEs into docs/known-failures.md
One list, merged from both READMEs and security-model.md "Known limits", each entry with
its test. Entries fixed on this branch are gone. Both READMEs keep the warning and point at
the page. tests/docs_known_failures.rs keeps the page and known_limits.rs in step, and
test_crate_export.py checks that the public README's links resolve in the exported tree.
2026-11-07 09:07:19 +01:00
g4borg 2425fa74fc fix(fermata): a bad pattern's note names its layer and its section
SecretsConfig::bad_pattern_sources finds the most specific layer holding the pattern in
that section. Notes, refusals and fermata check say "a[ in [policy.read] of .botsecrets".
2026-11-07 09:03:29 +01:00
g4borg 33e330a4eb fix(fermata): a path call's leading ~/ is expanded, so Grep with path ~/.ssh/id_rsa meets the gate 2026-11-07 09:02:27 +01:00
g4borg 8998540375 fix(fermata): a certificate file is judged by all of its text, not by its armor labels
API_TOKEN=x, a lowercase private block or a raw key beside a certificate block no longer
pass the read gate. Bag Attributes, subject= and issuer=, a CA bundle's comments and the
head of x509 -text stay allowed, so real PEMs keep passing.
2026-11-07 09:02:19 +01:00
g4borg f78fed95ef fix(fermata): a flag's value and an excluded name stop no harmless command
grep -A 2 .env a.txt, rg -t py .env, tar --exclude=.env and git --no-pager status .env
pass under a rule on .env. A small list of grep's and rg's flags with a value, four
exclude flags and git's quiet flags; grep -A 2 TOKEN .env and --include=.env stay stopped.
2026-11-07 09:01:10 +01:00
g4borg bc984b8625 fix(fermata): what a command writes meets the rules, also when it is not there yet
cp a.txt vendor/new, touch .env, echo x > .env and curl -o vendor/new are stopped under a
rule. Verb::Writes covers redirect targets, a list of writing verbs, sed -i, dd of= and
the value of -o. It meets [policy.write] as well as .botignore and [policy.read], and not
the read gate: writing a file reveals nothing.
2026-11-07 09:00:45 +01:00
g4borg 8dd5a81bc8 fix(fermata): a script named like a wrapper or a metadata verb hides nothing; every shell's command line is read
./do .env, scripts/time .env and ./test .env pass no more: a wrapper counts by its file
name only as a bare word or an absolute path, and the word after an absolute path still
counts as a path, so /home/me/scripts/env .env is stopped too. A metadata verb has to be
a bare word. dash, ksh, mksh, ash, yash, fish, csh, tcsh, pwsh, powershell and cmd have
their command line read, and bash --norc -c no longer hides it.
2026-11-07 08:58:35 +01:00
g4borg 34298c5f9a fix(fermata): a shell behind a wrapper and a verb given by path are read; the forms that stay text are named
The bash/sh/zsh/eval unwrap reads the word after the prefix walk, so sudo, env,
timeout, nohup, exec, xargs, busybox and X=1 in front of a shell no longer hide
its command line. A prefix counts by its file name, as a verb already did, so
/bin/bash -c, /usr/bin/env cat and /usr/bin/timeout 5 cat are read.

Named as limits, each with a test in known_limits.rs: dash -c, ksh -c,
bash -c -- x, eval past its first argument, sudo -u root bash -c, and on the read
gate eval cat id_rsa and cat <&3 id_rsa. (re-check I-3, I-4 leftover, I-5's stale line)
2026-11-07 02:11:10 +01:00
g4borg bfe83165a7 docs(fermata): name the command forms that pass, the harmless ones stopped and what a bad glob costs
Both READMEs, security-model.md, configuration.md, commands.md, threat-model.md, the crate
CLAUDE.md and the filter section of matrix.md. Each stated form has a row in
tests/known_limits.rs. The Edit claim now says it comes from Claude Code's documentation, and
"by no other route" is gone. cli_hook_fail_closed's open control asserts that .botignore and
the read gate stay on and that a note names the bad pattern.
2026-11-07 02:02:42 +01:00
g4borg 6bf602aa6a fix(fermata): a bad glob costs only itself; commands read what is there, behind a wrapper or a shell
- A glob in [files] or [policy] that does not compile costs only that pattern while open,
  with a note by name beside text output. A [files] list with none left leaves the built-in
  list. Under deny the refusal stays, and the channel filter stays strict.
- A file named `credentials` is on the default list, at any depth.
- A word with a separator counts only if the path is there, the shell may expand it, or a
  redirect names it: packages, branches and hosts' paths are not denied.
- timeout, nice, ionice, stdbuf, xargs and busybox are prefixes; `2>&1` stays in its segment.
- `bash|sh|zsh -c` and `eval` arguments are read as command lines.
- A `<<` with no closing line is no heredoc. A commented line's own comment is dropped.
  Text holding NUL fails to parse. The unknown-field message says so. Durations are bound
  to under 6 characters. More source extensions pass the gate.
- Removed: HarnessAdapter::post_tool_op (dead since 3C was dropped), tool_op back inline.
2026-11-07 02:00:45 +01:00
g4borg 999ed6ba4e docs(fermata): known limits, config reference and READMEs say what the tests show
Known to fail holds only what known_limits.rs pins or Claude Code's docs state;
the multi-line quoted value gets its own limit test. configuration.md follows the
code (unknown fields, [enforcement] settings, marks, plain settings, verb classes)
and every TOML example of it is loaded by tests/docs_toml_examples.rs. Speed
numbers are measured with a release build. matrix.md notes the new refusals.
2026-11-07 01:38:19 +01:00
g4borg d67ccdc039 test(fermata): known_limits.rs, each named limit shown through the binary 2026-11-07 01:32:13 +01:00
g4borg ac2fa03306 fix(fermata): empty masked text becomes [fermata]; a Monitor without a command is left alone; tests for the CRLF and JSON-escaped spellings 2026-11-07 01:29:03 +01:00
g4borg a583cc24dc test(fermata): the Channels table rows that concern the manifest, built as Sieve::load builds it 2026-11-07 01:26:59 +01:00
g4borg c03000ddeb feat(fermata): a Write or Edit that adds a mask is stopped; masked output says so
count_masks counts runs of exactly five stars, or <REDACTED: marks under typed and
named; absent counts 0. write_pairs gives each change's text before and after. The
guard denies when a change holds more marks than what it replaces, and a Write's
"before" is the file on disk, read only if the new text holds a mark. Both projects
of a path call decide. on_mask_write = "allow" turns it off. The refusal says "ask the
user", names the setting and quotes nothing.

Each PostToolUse that masked adds a note beside the output.

cli_hook_fail_closed: a masked Write's only note is now the masks note, asserted
exactly, in place of "no note".
2026-11-07 01:25:30 +01:00
g4borg 6d2311d248 feat(fermata): plain settings (true, 3600, AUTH_ENABLED) make no manifest entry; *AUTH* becomes three patterns 2026-11-07 01:22:02 +01:00
g4borg 8aae653972 fix(fermata): commented .env assignments, symlinked secret files, every YAML document and Python comments and annotations are masked 2026-11-07 01:19:41 +01:00
g4borg 246f714a51 feat(fermata): the default secret list gets its formats; key files mask a private body or one long token
tfstate and its backup parse as JSON and stay stopped on Read. tfvars, credentials and
sh, bash, zsh, ini, conf, cfg parse as Env. Key files are OpaqueText: only a private PEM
block's body or a single token of 16 or more characters enters the manifest, past the
key filter, and such a file never fails, so a binary .key refuses nothing under deny.
A certificate-only PEM passes Read with no entries. A UTF-8 BOM is stripped in
parse_content.
2026-11-07 01:14:07 +01:00
g4borg caa13ae654 feat(fermata): commands meet the path rules by verb class; a path call meets two projects' rules
check_command_paths is wired for Bash, PowerShell and Monitor and merged with check_command, so
allow_prefixes never lifts a path rule. Prints verbs get the rules and the read gate, Other verbs
the rules, Metadata verbs nothing. A path call is decided by the path's project and the session's,
and the worst stands: a Read of ~/.ssh/id_rsa from a project is stopped, and so is ../b/x under b's rules.
2026-11-07 01:07:44 +01:00
g4borg fb7fc80970 feat(fermata): a Read of a secret-list file it cannot mask is stopped; Grep with a path is a Read
SecretFileSet is the one answer to "is this a secret file?", for discovery and
Policy. unmaskable_reason says why a listed file cannot be masked. Policy::check
is now check_path_rules plus check_read_gate, so that commands can take the rules
without the gate (2D). on_unparsed_read = "allow" turns the gate off.

One tool-to-op mapping in claude.rs, read by parse_request and post_tool_op. A
Grep with a path is a Read; with none it stays {}.

A [[file]] override with a format gives the gate a parser. A bad [files] glob
costs the gate, not .botignore or [policy]: a note beside text output, exit 2
from fermata check, a refusal under deny. Text holding NUL counts as a failed
parse: UTF-16 without a BOM is valid UTF-8 and would pass as garbage keys.
2026-11-07 01:04:32 +01:00
g4borg 11328da30f fix(fermata): vendor/ covers what lies below it; relative paths and links meet the rules; the payload's cwd decides
.botignore matches a path or any parent, with the path tried first, so
!vendor/keep beats vendor/. Policy::check takes a relative path against the
root and also checks the path as the file system resolves it, spelled from the
root as given, so a link or a root behind a link hides nothing. session_dir: the
payload's cwd if absolute, else the process directory, for both hooks; fermata
check and the hook make paths absolute.
2026-11-07 00:59:04 +01:00
g4borg 16a8b13fb9 feat(fermata): core::paths names what a command reaches, by verb class; core::extract goes
Words, segments and paths of a command line, for Bash and PowerShell, with a
Prints, Metadata or Other class per path. Not wired to the hook yet (block 2D).
Beyond the plan's rules, to keep it from denying normal work: shell keywords are
no verb, comments and heredoc bodies name nothing, prose and URLs count only as
a real file. A word after < is a printing path and never the verb.
2026-11-07 00:55:12 +01:00
g4borg 4b191b5480 fix(fermata): an unknown config field is an error someone sees; a broken layer costs only that layer
deny_unknown_fields on every config struct. [enforcement] mode, EnforcementMode and
mask-entire-file are gone, and on_parse_error defaults to allow. New settings
on_unparsed_read and on_mask_write, default deny, read by later blocks.

SecretsConfig::load stays strict for the channel filter. load_or_default skips only the
layers that fail, so a typo keeps the other layers and the default list. Hooks note the
broken layer and any skipped() secret file beside output that shows text, not beside
every Write (shows_text). Under deny the refusal is unchanged. fermata check exits 2
with the line number.

A non-UTF-8 layer counts as a failed layer; a layer whose bytes cannot be read stays
silent, as pinned.
2026-11-07 00:46:47 +01:00
g4borg 86ba64b22c perf(fermata): large secret files parse in linear time; KeyMatcher compiled once (M-4) 2026-11-07 00:29:45 +01:00
g4borg 47da98709f docs(fermata): do not use; an experiment, with what it is known to fail at
The public README, crate README, docs, SVGs, crate description and --help no
longer present fermata as protection. The README opens with a warning and a
"Known to fail" list from recheck-2, each item reproduced on this code.

The docs also said things the code does not do: the hook never checks a Bash
command against path rules (threat model L1 to L4), [enforcement] mode has no
effect, [policy.read] takes patterns and not deny, a .botignore directory
pattern misses the files below it, and a relative path never matches.
2026-11-06 23:48:18 +01:00
g4borg fe041051ca docs(fermata): the promises Known limits allows, and the limits named (I-2, N-3, N-4, M-4)
A failed command's output is stated as the largest limit: only a [policy.bash] deny stops
it, and only for the spelling it names. Monitor output and changed-file attachments added.
fermata is documented as no permission approver. Recovery from onFailure block.
2026-11-06 23:36:57 +01:00
g4borg 0902ca2160 fix(fermata): the gate approves nothing; every schema's enums, each pinned per tool (N-2, M-1, M-2, M-3)
PreToolUse answers {} when no rule stopped a call: permissionDecision allow skipped Claude
Code's own prompt. allow_prefixes now only skips fermata's ask rules. PowerShell and Monitor
commands reach [policy.bash]. SCHEMA_VALUES covers the remaining getters of 2.1.314, Artifact
refuses in its read form, and data beside a binary type stays only in a top-level block.
2026-11-06 23:36:57 +01:00
g4borg 5208d3fd03 fix(fermata): a value has one manifest entry per spelling, and overlapping matches are masked whole (N-1)
Read shows a file's bytes, a loaded program shows the decoded text. The manifest held
only one. It now holds the file's text, the decoded text, the JSON- and \n-escaped forms,
each line of a multi-line value from 8 characters, and numbers from 6. .env parses quoted
values over lines and a comment after a value.
2026-11-06 23:36:57 +01:00
g4borg 9a623c8fbd docs(fermata): true redaction promises, known limits, wiring for every tool
The hook matcher goes: Grep, Glob, WebFetch, Agent and MCP output needs the hook
too. onFailure: block on PreToolUse (v2.1.295+) stops a tool when fermata cannot
run. A new Known limits section lists what is not covered, including failed tools,
whose text no hook can rewrite.
2026-11-06 23:36:57 +01:00
g4borg b69fbf3ae2 fix(fermata): PostToolUse redacts any response shape, and a refusal fits each tool's schema
Built-in tools and normal MCP results send tool_response as an object or an
array, which the hook read as empty: nothing was redacted under any setting.
The hook now walks any shape, masks every string and returns the same shape.

Enum and literal values of Claude Code's output schemas (read from v2.1.314)
stay when they match exactly, because a mask there fails the schema and the
original is used. A secret that cannot take a mask refuses the output under
every setting. Refusals: Bash and Read answer a minimal schema-valid output,
others keep their shape with exact enum values only.

Also: an unreadable config layer no longer counts as deny, multi-line string
spellings of deny count, vim's other swap names and Kate's are editor files,
the heuristic warning moves to additionalContext, and PreToolUse answers
quietly for tools it has no rules for.
2026-11-06 23:36:57 +01:00
g4borg 5c3b239f59 fix(fermata): an editor's swap or backup file no longer refuses
One non-UTF-8 .env.swp blocked everything a checkout sent across a link, and would
withhold every tool output under deny. A discovered *.swp, *.swo, *.swn, *.swx or
*~ that cannot be read or parsed is now passed over under every setting. One that
can be parsed stays known to the redactor. .bak, .env.gpg and [[file]] overrides
keep the rule.
2026-11-06 23:36:57 +01:00
g4borg 969cff212f fix(fermata): the hooks refuse under on_parse_error = "deny", and no error quotes a file
PostToolUse replaced nothing when a secret file or the config failed. Under deny
it now puts a refusal naming the file in place of the output, in the tool's own
shape: Claude Code ignores a replacement that does not match a built-in tool's
schema. PreToolUse answers deny for a config or rules it cannot load or apply.

A config that cannot be loaded leaves the setting unknown: a layer with a line
setting deny counts, a layer whose bytes cannot be read counts as deny, and
anything else stays open as today.

Parse errors keep the format and line number and drop the parser's text.
2026-11-06 23:36:57 +01:00
g4borgandClaude Opus 5.5 0dc0b87b9d fix(channels): the secret filter refuses an unparsable file and a secret in an address (I-2, M-3)
I-2: Sieve::load sets on_parse_error to Deny whatever the root says, so fermata's
default no longer fails open and its print of the failing line is not reached. A
[[file]] override now honours Deny too: it only printed a warning under every setting,
a second way open the review did not name. M-3: a to id the built-in rules call a
secret refuses the message, and the reason does not quote it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 04:02:07 +01:00
g4borgandClaude Opus 5.5 488766ac5b feat(server): secret filter on everything that crosses to a peer
OutboundFilter over dirigent_fermata runs in LinkTransport before the cap:
known values of the sender's checkout and the config dir, then the scanner's
High findings, over body, error, persona and as_of project. A root that cannot
be read refuses the message; the reason names no path because it can cross. A
card loses that agent's title and project instead. The instance's own text
crosses a broken config with the built-in rules only, as an asker has no
timeout. Fermata's walker no longer enters skipped directories, which it
walked per message otherwise.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 01:22:16 +01:00
Gabor KörberandClaude Opus 4.6 a0345e5f12 Merge origin/main: resolve fermata botignore→botsecrets conflicts
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-06-11 14:08:56 +02:00
Gabor KörberandClaude Opus 4.6 7b660b3da0 📝 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>
2026-05-26 14:12:44 +02:00
Gabor KörberandClaude Opus 4.6 ac11512f62 ♻️ fermata: unify botignore.toml into .botsecrets [policy] sections
Delete botignore.toml as a config file entirely. Per-operation policy
rules (read/write/bash) now live in .botsecrets under [policy.read],
[policy.write], and [policy.bash]. This reduces fermata's config story
to two files: .botignore (gitignore syntax) and .botsecrets (TOML).

Changes:
- Add PolicyConfig, OpRules, BashRules to secrets/config.rs with
  layer merge support
- Rewrite policy.rs to load from SecretsConfig instead of BotignoreToml
- Remove toml_config.rs module entirely
- Remove botignore.toml from project root strong markers
- Update all tests to use .botsecrets [policy.*] sections
- Update error messages to reference .botsecrets

All 194 tests pass.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-26 12:54:23 +02:00
g4borgandClaude Opus 4.6 168aefd415 🏗️ fermata: redaction-first security model, unified .botsecrets config
Realign fermata around redaction (PostToolUse) as the primary security
layer, with access control (PreToolUse) as supplementary write/bash
protection. Remove botignore.toml — policy rules now live in .botsecrets
[policy] section. Add fermata.toml as an alias for .botsecrets.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-26 01:10:07 +02:00
g4borgandClaude Opus 4.6 77520819f6 📝 fermata: rewrite docs for public-facing export
New user-friendly README modeled after sandcage's layout (Why / Quick Start /
How It Works), plus four focused docs under docs/:

- commands.md — full CLI reference with options, exit codes, examples
- configuration.md — .botignore, botignore.toml, .botsecrets reference
- security-model.md — the Reveal Triangle and defense-in-depth layers
- threat-model.md — L0-L6 coverage, honest limitations, pairing guidance

All Dirigent/monorepo internals stripped — ready for standalone export.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-25 18:27:51 +02:00
Gabor KörberandClaude Opus 4.6 087429d275 ✨ feat(fermata): add secret filtering engine — the security brain
Implement Goals 1–3 and 5 from the reveal-layer security brain goal.
fermata now detects, redacts, and scans for secrets in AI agent tool
output, filling the ecosystem gap where no coding agent filters secrets
post-read.

New core/secrets/ module:
- config.rs: .botsecrets TOML format with hierarchical merge and ~40
  built-in key patterns
- parser.rs: multi-format secret file parser (.env, TOML, YAML, JSON,
  Python assignments, Java properties)
- manifest.rs: file discovery + parsing → known-secrets set
- redactor.rs: Aho-Corasick multi-pattern replacement with 4 styles
- scanner.rs: RegexSet heuristic detection with 35 gitleaks-derived
  patterns (MIT) and Shannon entropy filtering
- patterns.rs: curated rules for AWS, GitHub, Stripe, Slack, JWT, etc.

Hook integration:
- fermata hook --event post-tool-use reads tool output, runs redactor +
  scanner, returns updatedToolOutput for Claude Code
- Backward compatible: --event pre-tool-use (default) unchanged
- Fail-open: errors produce {} and exit 0

Library API:
- Redactor::new(manifest, style).redact(text) → RedactedText
- Scanner::new(config).scan(text) → Vec<Finding>
- Compiles without CLI feature for embedding in other crates

195 tests (130 new), all passing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-25 17:29:07 +02:00
g4borgandClaude Opus 4.6 f77fd73966 fix(fermata): .botignore as fallback root, not ignored; extract SVGs to files
- Walk-up: .botignore no longer stops the search but is remembered as a
  fallback when no strong marker (.git, botignore.toml, .botignore.toml)
  is found — prevents fail-open regression for projects without .git
- Extract inline SVGs to policy-layers.svg and architecture.svg
- READMEs reference SVGs via <img> tags

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-08 23:46:15 +02:00
g4borgandClaude Opus 4.6 424e6814fd docs(export): rework all export READMEs
- fermata: position as security layer, add policy protection layers SVG,
  update walk-up docs to match code change
- dirigate: clarify Dirigent Protocol as ACP superset with parity goal
- anth: tools-first structure (anth_usage then anth_bear), library second
- dirigent: link to tool repos instead of install instructions, add
  architecture SVG, under-construction notice
- purge all localsettings references from examples

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-08 23:37:21 +02:00