98 lines
11 KiB
Markdown
98 lines
11 KiB
Markdown
# Known failures
|
|
|
|
> **Do not use this software.** fermata is an experiment. It does not protect your secrets, and secrets can and do reach the model while it is installed.
|
|
|
|
This page lists where fermata is known to fail. The list is not complete.
|
|
|
|
Each entry names its test in `tests/known_limits.rs`. That test runs the fermata binary with fake values and asserts that the failure happens. An entry marked "Claude Code's documentation" comes from that documentation and from the v2.1.314 bundle, and has no test. The test suite never runs Claude Code, and none of this has been checked in a live session.
|
|
|
|
In the commands below, `.env` is under a rule in `.botignore` or `[policy.read]`, unless the entry says otherwise.
|
|
|
|
## A tool that fails
|
|
|
|
This is the largest limit for values fermata knows.
|
|
|
|
- A failed tool's output goes down a path no hook can rewrite. That includes a Bash command with a non-zero exit code and an MCP error result. `cat .env; false` shows the file if no rule names it, and so does a failing `npm test` that prints its environment, `curl -v -f` with a token header on a 500, or a failing `set -x` script. (Claude Code's documentation. Test: `the_failed_tool_event_is_not_hooked`.)
|
|
- A rule stops only what names the file. `cat .env; false`, `cat ./.env; false` and `source .env; false` are stopped. `env; false`, `grep -r TOKEN .; false`, `printenv; false` and a failing `npm test` pass. (Test: `cat_env_then_false_is_stopped_only_under_a_rule_and_only_for_what_names_the_file`.)
|
|
- On the default configuration a parseable `.env` is not stopped at all, by any route. (Test: `on_default_config_a_parseable_env_is_not_stopped_at_all`.)
|
|
|
|
## Commands a rule does not see
|
|
|
|
The check reads the command's text, not what the shell makes of it.
|
|
|
|
- A substitution that builds the name, and a script that opens the file: `cat $(printf '.e%s' nv)`, `python -c "print(open('.env').read())"`, `sh run.sh`. (Test: `a_variable_a_substitution_and_a_script_hide_the_file_from_the_command_rules`.)
|
|
- A form where the name is not a word of its own: `echo "$(cat .env)"`, `bash <<EOF` with `cat .env` in its body, `find . -name .env -exec cat {} \;`, `curl -d @.env`, `curl -F file=@.env`, `git show HEAD:.env`, `git show :.env`, `cat .{env,x}`, and a short flag's attached value (`git commit -F.env`, `tool -f.env`). (Test: `a_command_that_names_the_file_in_a_form_the_check_does_not_read_passes`.)
|
|
- A command line the check does not read as one: a shell behind a wrapper's flag value (`sudo -u root bash -c 'cat .env'`), a shell or language off the list (`rc -c`, `python3 -c`), and an encoded line (`pwsh -EncodedCommand`). (Test: `a_command_line_the_check_does_not_read_as_one_passes`.)
|
|
- A flag named `--exclude=`, `--exclude-dir=`, `--ignore=` or `--grep=` hides its value, for any program, since what a script does with it is not read: `tool --exclude=.env`. (Test: `a_flag_named_like_an_exclude_hides_its_value_for_any_program`.)
|
|
- A script given by an absolute path cannot be told from the real wrapper: `/home/me/scripts/env ls .env` passes, as `/usr/bin/env ls .env` should. (Test: `a_script_given_by_an_absolute_path_passes_when_its_first_word_is_a_metadata_verb`.)
|
|
- A printing verb off the list: `python -c`, `perl -e`. (Test: `a_printing_verb_off_the_list_is_not_checked_against_the_rules_unless_it_names_the_file`.)
|
|
- A ruled file run as the program itself: `./.env`, `sudo vendor/bin/x` under a rule on `vendor/`. (Test: `a_ruled_file_run_as_the_program_passes`.)
|
|
- A change of directory: `cd ../other && cat .env`. A secret file in no project has no rules at all. (Test: `a_command_that_prints_a_secret_file_outside_the_project_passes`.)
|
|
- A command run in one project does not meet another project's rules: `cat ../other/x` passes, while a Read of that file is stopped. (Test: `a_command_in_one_project_is_not_stopped_by_another_projects_rule`.)
|
|
- A write by a verb off the writing list: `git clone https://example.invalid/x vendor/new`, `unzip a.zip -d vendor/new`, `tar cf vendor/new a.txt`, `python make.py vendor/new`, `perl -pi`, `awk -i inplace`. A glob over directories in the target (`touch vend*/new`) is not read either. (Test: `a_new_file_named_to_a_verb_off_the_writing_list_is_not_checked`.)
|
|
|
|
## Secret files fermata cannot mask
|
|
|
|
A Read, a Grep with that `path` and a printing command that names such a file are stopped. Other routes are not.
|
|
|
|
- A route that does not name the file: `grep -r TOKEN .`, `ls -R`, `tar cf x.tar .`, a script that opens it. This holds for `*.p12`, `*.pfx`, `.netrc`, `.htpasswd` and a text `*.key`. (Test: `an_unmaskable_file_is_reached_by_a_route_that_does_not_name_it`.)
|
|
- A printing verb off the list: `dd if=server.p12`, `perl -ne print server.p12`, `python3 show.py server.p12`. (Test: `a_printing_verb_not_on_the_list_passes_the_read_gate`.)
|
|
- A form the gate does not read: `sudo -u root cat id_rsa`, where the flag's value becomes the verb; `bash -c -o pipefail 'cat id_rsa'`, where that word does; `cat <&3 id_rsa`, where `<&` ends the segment; `cat */id_rsa` and `cat ./s*/a.key`, a glob over directories; `./env cat id_rsa`, `bin/sudo cat id_rsa` and `./busybox cat id_rsa`, each a script as far as the check knows. A rule on the file's name still stops each of them. (Test: `a_flag_value_as_verb_and_a_glob_over_directories_pass_the_read_gate`.)
|
|
- The stop needs the PreToolUse hook. Without it a Read reaches the model, and PostToolUse has nothing to mask in it. (Test: `the_read_gate_stands_only_in_a_pre_tool_use_hook`.)
|
|
- A text with `{{` or `{%` that does not parse passes as a template, and a literal value in it reaches the model. (Test: `a_template_holding_a_literal_value_passes_a_read`.)
|
|
- A certificate file may hold other text, so a value spelled as that text passes: a comment (`# fake-value`), an indented line (` api_token: fake-value`), `subject=` or `issuer=`, a title above a `====` line, and whatever a certificate block holds. (Test: `a_comment_or_an_attribute_line_beside_a_certificate_passes`.)
|
|
- A UTF-16 or Latin-1 `.env`, and JSON with comments, are stopped on a Read. Their values are not masked in the output of other commands. (Test: `a_utf16_or_latin1_file_or_json_with_comments_is_not_masked_when_no_command_names_it`.)
|
|
|
|
## Values that never enter the list of known secrets
|
|
|
|
These values then reach the model.
|
|
|
|
- A key the key filter does not match, in a parsed file. (Test: `a_key_the_filter_does_not_match_leaves_its_value_in_a_parsed_file`.)
|
|
- A `.tfvars` heredoc. (Test: `a_tfvars_heredoc_is_not_masked`.)
|
|
- A `*.tfvars` other than `terraform.tfvars` and `*.auto.tfvars`. (Test: `a_tfvars_file_off_the_list_is_not_masked`.)
|
|
- A comment in a TOML or YAML secret file. (Test: `a_comment_in_a_toml_or_yaml_secret_file_is_not_masked`.)
|
|
- The first value of a duplicate JSON key. (Test: `the_first_value_of_a_duplicate_json_key_is_not_masked`.)
|
|
- A `.env` value inside a quoted value that spans several lines, when a program prints it alone. With `API_TOKEN="abc` over a line `DB_PASSWORD=fake-pass` and a closing quote on a later line, `echo $DB_PASSWORD` shows it. (Test: `a_value_inside_a_quoted_value_that_spans_lines_is_not_masked_when_printed_alone`.)
|
|
- Python triple quotes, on one line or over several. (Tests: `a_python_triple_quoted_value_on_one_line_is_not_masked`, `a_python_triple_quoted_value_over_several_lines_is_not_masked`.)
|
|
- Shell-quoted spellings such as `'a'\''b-x` and `abc"def"-x`, when a program prints the decoded value. (Test: `a_shell_quoted_value_is_not_masked_when_a_program_prints_it_decoded`.)
|
|
- A number under 6 characters. (Test: `a_number_under_six_characters_is_not_masked`.)
|
|
- A secret number that an MCP tool returns as a JSON number. (Test: `a_secret_number_in_mcp_structured_content_is_not_masked`.)
|
|
- A secret equal to a plain setting word (`true`, `3600`, a short duration). It makes no entry. (Test: `tests/core_value_class.rs`.)
|
|
- A secret file outside the working project: a Read of `../other/.env` and `cat ../other/.env` pass. (Test: `a_secret_file_outside_the_project_is_not_masked_and_a_read_of_it_passes`.)
|
|
- A run with no `.git`, `.botsecrets`, `.botignore` or `fermata.toml` above the working directory: nothing is loaded, and the output passes. (Test: `a_run_outside_any_project_is_not_masked`.)
|
|
|
|
## Masks that do too much or too little
|
|
|
|
- A short password's word is masked everywhere, in other files too. `DB_PASSWORD=postgres` masks `postgres` in every output. (Test: `a_short_passwords_word_is_masked_in_other_files_too`.) An Edit copied from such masked text fails, since Claude Code's Edit needs the real text. (Claude Code's documentation.)
|
|
- A line of fewer than 8 characters of a multi-line value passes when printed alone, by a grep or a line range. (Test: `a_short_line_of_a_multi_line_value_is_not_masked`.)
|
|
- A value split across strings, or encoded, does not match: a value divided between `stdout` and `stderr` or two MCP content blocks, base64, URL encoding, a value cut short. (Test: `a_value_split_across_strings_or_encoded_is_not_masked`.)
|
|
- A binary field stays as it is: `base64` in a built-in's output, image data, Bash's image `stdout`. A mask there would break the next API request. (Test: `a_binary_field_is_not_masked`.)
|
|
- A secret the heuristic scanner finds gets a warning, and the value stays. (Test: `a_heuristic_finding_is_warned_about_and_not_masked`.)
|
|
- A secret equal to a schema's fixed word stays in that field. A later Claude Code's new enums are not known. (Test: `a_secret_equal_to_a_schema_enum_value_is_not_masked`; Claude Code's bundle for the later enums.)
|
|
|
|
## Routes no hook sees
|
|
|
|
All of these come from Claude Code's documentation and bundle, and have no test.
|
|
|
|
- Monitor's output. Each line of a Monitor's command goes to the model as an event, and PostToolUse only sees `{taskId, timeoutMs}`. `tail -f server.log` passes logged tokens straight through.
|
|
- A changed file's attachment. After a Read, a file that changes on disk comes back to the model with a snippet. Read `.env`, rotate the token, and the next turn carries the new value. `@`-mentions likely take the same route; that has not been traced.
|
|
- A hook that times out lets the output through.
|
|
|
|
## The write guard
|
|
|
|
The guard stops a Write or Edit that adds a mask to a file. It does not cover these.
|
|
|
|
- A shell command that writes a mask: `sed -i 's/x/*****/' a.txt`, `echo '*****' > new.txt`. (Test: `a_shell_command_that_writes_a_mask_is_not_checked`.)
|
|
- `style = "absent"` leaves nothing to count. (Test: `the_absent_style_leaves_nothing_for_the_guard_to_count`.)
|
|
- A real run of exactly five asterisks in a Write is stopped as if it were a mask. (Test: `a_real_five_star_run_is_stopped_as_if_it_were_a_mask`.)
|
|
|
|
## Harmless commands a rule stops
|
|
|
|
- A verb given by a path counts as no metadata verb: `/bin/ls .env`.
|
|
- `git` with any flag before its command other than `--no-pager`, `-P`, `--no-optional-locks` and `-C`: `git -c core.pager=x status .env`.
|
|
- A word with a separator and `$`, `*` or `?` may be a path once the shell expands it: `git log vendor/$BRANCH`, `curl example.invalid/vendor/$ID`, `composer require vendor/*` under a rule on `vendor/`.
|
|
- The text after `=` in a flag off the short exclude list: `tool --name=.env`. The spaced form of an exclude flag counts only for `grep`, `tar` and `rsync`: `git log --grep .env`.
|
|
- A value flag of a tool other than `grep` and `rg`, or one off their list: `grep --color always .env a.txt` takes `always` as the pattern.
|
|
|
|
(Test for all five: `a_harmless_command_a_rule_still_stops`.)
|