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.
This commit is contained in:
@@ -18,6 +18,8 @@ This is the largest limit for values fermata knows.
|
||||
|
||||
## Commands a rule does not see
|
||||
|
||||
Command checks are best effort, and will be rebuilt on a shell parser. What a program opens internally was never in fermata's scope.
|
||||
|
||||
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`.)
|
||||
@@ -31,6 +33,11 @@ The check reads the command's text, not what the shell makes of it.
|
||||
- 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`.)
|
||||
- An output flag's value given with `=` or `:` (`tool -o=vendor/new`, `sort -o=vendor/new`, `Copy-Item a.txt -Destination:vendor\new`), and BSD's `sed -I`. (Test: `a_write_given_by_an_equals_sign_a_colon_or_sed_capital_i_is_not_checked`.)
|
||||
- A shell line that ends in a backslash: `bash -c 'cat "$1"; echo \' _ .env`. The check reads the arguments through a line it appends, and the backslash joins that line to `echo`. Bash prints the file. The gate form with `id_rsa` passes too. (Test: `a_shell_line_ending_in_a_backslash_hides_its_arguments`.)
|
||||
- A cluster where `f` comes before a final `e`: `grep -fe .env`, `rg -fe .env`, `sed -nfe .env`, `awk -fe .env`. The check takes `.env` for the pattern, while the program reads a pattern file named `e` and then reads `.env`. The gate forms with `id_rsa` pass too. (Test: `a_pattern_flag_after_a_file_flag_in_one_cluster_hides_the_file`.)
|
||||
- A write through a shell's arguments: `bash -c 'rm "$1"' _ a.txt`, `bash -c 'cp b.txt "$1"' _ vendor/new`, `sh -c 'rm "$0"' a.txt`, and the same with `mv`, `sed -i`, `touch` and `tee`. The arguments are read only as what the shell may print, so no write rule sees them. (Test: `a_write_through_a_shells_positional_arguments_is_not_checked`.)
|
||||
- A shell flag cluster with `o` or `O` before `c`: `bash -oc pipefail 'cat .env'`, `bash -Oc extglob 'cat .env'`. The check takes `pipefail` for the line. (Test: `a_shell_cluster_with_o_before_c_takes_the_options_value_for_the_line`.)
|
||||
- A PowerShell switch by a short form or another prefix: `pwsh -nol -c 'cat .env'`, `-noe`, `-i`, `-NoProf`, `-NonInter`, and `powershell` the same. The check takes the switch to hold a value, so it skips the `-c`. Only fermata's verdict is tested, since pwsh was not run. (Test: `a_powershell_switch_by_a_short_form_hides_the_command`.)
|
||||
|
||||
## Secret files fermata cannot mask
|
||||
|
||||
@@ -97,3 +104,5 @@ The guard stops a Write or Edit that adds a mask to a file. It does not cover th
|
||||
- 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`.)
|
||||
|
||||
- A shell's argument that its line only echoes or tests: `bash -c 'echo "$1"' _ .env`, `bash -c 'test -f "$1"' _ .env`. Every argument after the line is read as printed. (Test: `a_shell_argument_its_line_only_echoes_is_stopped`.)
|
||||
|
||||
Reference in New Issue
Block a user