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:
@@ -397,3 +397,21 @@ fn a_file_override_can_say_opaque() {
|
||||
let p = project(&format!("{DENY}{config}"), "deploy.bin", BINARY);
|
||||
assert!(!replaced(&p.post_bash(VALUE)), "an opaque file never refuses");
|
||||
}
|
||||
|
||||
/// A file named `credentials` has a format, so it is on the list at any depth.
|
||||
#[test]
|
||||
fn a_file_named_credentials_masks_by_key_at_any_depth() {
|
||||
for name in ["credentials", "sub/credentials", "sub/.aws/credentials"] {
|
||||
let p = project("", name, format!("[default]\naws_secret_access_key = {VALUE}\nregion = eu\n").as_bytes());
|
||||
assert_eq!(p.pre_read(name), json!({}), "{name}");
|
||||
let out = p.post_bash(&format!("x {VALUE} y"));
|
||||
assert!(!out.to_string().contains(VALUE) && out.to_string().contains(MASK), "{name}: {out}");
|
||||
}
|
||||
}
|
||||
|
||||
/// A binary one cannot be masked, so a Read of it is stopped.
|
||||
#[test]
|
||||
fn a_file_named_credentials_that_cannot_be_parsed_is_stopped() {
|
||||
let p = project("", "credentials", &[0xff, 0xfe, 0x00, 0xc3, 0x28]);
|
||||
assert_eq!(p.pre_read("credentials")["hookSpecificOutput"]["permissionDecision"], "deny");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user