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.
This commit is contained in:
2026-11-07 02:00:45 +01:00
parent 999ed6ba4e
commit 6bf602aa6a
20 changed files with 579 additions and 140 deletions
+15
View File
@@ -90,6 +90,21 @@ fn mask_entire_file_refuses() {
refuses(&[(".botsecrets", b"[[file]]\npath = \"a.txt\"\nmask-entire-file = true\n")]);
}
/// UTF-16 with no byte order mark is valid UTF-8 holding NUL: it "parsed" into keys no
/// filter knows. A channel refuses it, as any secret file that cannot be parsed.
#[test]
fn a_utf16_file_with_no_bom_refuses() {
let utf16: Vec<u8> = format!("API_TOKEN={VALUE}\n").encode_utf16().flat_map(u16::to_le_bytes).collect();
refuses(&[(".env", &utf16)]);
}
/// A file named `credentials` is on the list, so a non-UTF-8 one refuses at any depth.
#[test]
fn a_non_utf8_file_named_credentials_refuses() {
refuses(&[("credentials", BINARY)]);
refuses(&[("sub/credentials", BINARY)]);
}
/// Only `*.tfstate` (JSON) can be broken as text. `*.tfvars`, `.aws/credentials` and
/// `secrets.{sh,ini,conf,cfg}` go through the lenient env reader, which accepts any
/// UTF-8 text, so for them the new refusal is the non-UTF-8 one. The plan's table says