Skip to content

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

Closed

Description

@ajianaz

Found in the #594 security audit. Severity: medium. Status: confirmed (failing test).

Affected code

crates/tole-core/src/sensitive.rs:22 is_sensitive_name: .env* (prefix only), .npmrc, .netrc, *.pem, *.key, id_*. Used by read_file (read_file.rs:164), the git diff filter and cora_search hits.

Problem

read_file is Risk::ReadOnly (no approval). Any credential file outside the six patterns is returned verbatim, and its values are usually NOT in the SecretSet (they were never in tole's env), so they reach the provider and the durable log as is. Not sensitive today: prod.env, config.env (docker env_file convention, suffix not prefix), credentials (AWS), .git-credentials, .pgpass, .htpasswd, secrets.yaml, terraform.tfvars, *.p12, *.pfx, .pypirc, .dockercfg, kubeconfig. A hard link to .env under another name is also not caught (only the requested name and the canonical path are checked, both of which are the link's name); low, since creating one needs a command.

Scenario

A repository keeps deploy/production.env (gitignored, present on the dev machine). An injection in an issue asks the model to "check the deploy config"; read_file returns the database password and API keys to the provider without any prompt.

Reproduction

Scratch test crates/tole-core/tests/audit_594.rs::common_secret_files_are_sensitive lists the names above as not sensitive.

Suggested fix

  • Extend the rule: *.env and *.env.* suffixes, credentials, .git-credentials, .pgpass, .htpasswd, .pypirc, .dockercfg, config.json under .docker/, *.p12, *.pfx, *.jks, *.keystore, *.tfvars, kubeconfig, secrets.y*ml; make the list configurable (user layer adds, project layer can only add).
  • Optionally check the inode link count (nlink > 1 on a regular file) and treat it as sensitive when any other name would be.
  • Once feat: shared shape-detector ruleset with uteke for unknown secrets #597 lands, run the shape detector over read_file output too, which covers files no name rule knows.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions