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.
This commit is contained in:
2026-11-07 01:14:07 +01:00
parent caa13ae654
commit 246f714a51
7 changed files with 579 additions and 22 deletions
+3 -3
View File
@@ -72,8 +72,8 @@ fn reason(out: &Value) -> &str {
out["hookSpecificOutput"]["permissionDecisionReason"].as_str().unwrap()
}
/// What each row of the secret list that stays stopped holds. `.tfvars`, `.aws/credentials`
/// and `secrets.sh` get a parser next and leave this list then, so they are not on it.
/// What each row of the secret list that stays stopped holds. Row by row, with what each
/// masks elsewhere: `tests/cli_hook_secret_formats.rs`.
fn unmaskable_files() -> Vec<(&'static str, Vec<u8>)> {
let private_pem = format!("-----BEGIN PRIVATE KEY-----\n{VALUE}\n-----END PRIVATE KEY-----\n").into_bytes();
vec![
@@ -95,7 +95,7 @@ fn unmaskable_files() -> Vec<(&'static str, Vec<u8>)> {
}
#[test]
fn a_read_of_a_file_with_no_parser_is_stopped_under_every_on_parse_error() {
fn a_read_of_a_file_it_cannot_mask_is_stopped_under_every_on_parse_error() {
for setting in SETTINGS {
for (name, content) in unmaskable_files() {
let p = project(setting, &[(name, &content)]);