Skip to content

fix(security)!: treat common credential files as sensitive - #698

Merged
ajianaz merged 1 commit into
developfrom
security/sensitive-files
Nov 14, 2026
Merged

ajianaz merged 1 commit into
developfrom
security/sensitive-files

Conversation

@ajianaz

@ajianaz ajianaz commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Closes #683

What

The sensitive-file name rule now covers the common credential files that read_file, the git diff filter and cora_search hits missed, and the list is configurable.

Why

read_file is read-only (no approval). A file such as deploy/production.env or ~/.git-credentials was returned verbatim, and its values are usually not in the secret set, so they reached the provider and the session log.

Changes

  • crates/tole-core/src/sensitive.rs: new names *.env, *.env.*, credentials, .git-credentials, .pgpass, .htpasswd, .pypirc, .dockercfg, .docker/config.json, *.tfvars, kubeconfig, secrets.y*ml. *.p12, *.pfx, *.jks, *.keystore are key material, shown as one marker like *.pem. The diff filter and search-hit redaction use the same file rule.
  • New sensitive_files config list of name globs (* wildcards, no directory part, validated). The user layer's list is used and the project layer's list is added to it; a project can never remove a name. The host installs it with sensitive::set_extra.
  • CHANGELOG entry marked BREAKING (a verbatim read of these files now needs read_file_raw).
  • Not done: the optional hard-link (nlink > 1) check, and running the shape detector over read_file output (waits on feat: shared shape-detector ruleset with uteke for unknown secrets #597).

Testing

  • tests/sensitive_files.rs (name list plus an end-to-end read_file redaction of prod.env) fails on develop and passes here.
  • Unit tests for the new names, glob matching, the diff and hit paths, and the config validation and layering.
  • Mutation checks: dropping the *.env suffix rule, the .docker parent check, the user-layer union, or the extra-glob lookup each makes a test fail.
  • fmt, clippy --workspace --all-targets --all-features -D warnings, cargo test --workspace and tole-core --no-default-features pass. A few e2e tests (agents, session_effort_e2e, wire_size_missions) were flaky on the shared build machine; agents::parent_spawns_child_polls_until_settled also failed on a clean develop in one run.

read_file, the git diff filter and cora_search hits now redact *.env,
*.env.*, credentials, .git-credentials, .pgpass, .htpasswd, .pypirc,
.dockercfg, .docker/config.json, *.p12, *.pfx, *.jks, *.keystore,
*.tfvars, kubeconfig and secrets.y*ml. A new sensitive_files config list
adds name globs; the project layer can only add to the user layer's.
@github-actions

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

@ajianaz
ajianaz merged commit 51991f1 into develop Nov 14, 2026
19 checks passed
@ajianaz
ajianaz deleted the security/sensitive-files branch November 20, 2026 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

security(files): the sensitive-file rule misses common credential files (prod.env, credentials, .git-credentials, .pgpass, *.p12)

2 participants