shtukbasehub

Standard: secrets hygiene (OWASP)

Secrets hygiene by OWASP (Secrets Management Cheat Sheet, ASVS 4.0.3 V2.10.4): no keys or tokens in repository files, .env does not get into git; a finding is only the file, the line and the kind, the value is not printed.

Packagestd-owasp-secretsv0.1.015 files

Standard: secrets hygiene (OWASP)

What the standard is. Basic secrets hygiene by OWASP. Sources: the OWASP Secrets Management Cheat Sheet (https://cheatsheetseries.owasp.org/cheatsheets/Secrets_Management_Cheat_Sheet.html) and requirement V2.10.4 of OWASP ASVS 4.0.3 (https://github.com/OWASP/ASVS/tree/v4.0.3): passwords, API keys and other secrets are not kept in source code or in the repository. A secret lives in the environment or in a secret store; a leaked secret is revoked and issued again.

When to install. Always, when the project has git and at least one external service. Especially when agents write in the project: they easily paste a key from the environment straight into a file.

How to configure. The page /norms/standards/owasp-secrets.md: what not to scan (exclude, lock files by default), allow markers on a line (allowMarkers, secrets:allow and gitleaks:allow by default), the entropy and length threshold for the heuristic (minEntropy, minLength), the file size limit (maxBytes). A line with an allow marker is not checked: that is how an example in documentation or a test key is marked.

Values are not printed. A finding is a file, a line and the kind of secret. The package never prints the value itself: a check's output ends up in logs and in the agent's context.

What is checked

  • SCR-R01 (MUST, enforce): no secrets of known formats: PEM/OpenSSH/PGP private keys (the header and the key body), AWS keys, GitHub, GitLab, Slack, npm, Hugging Face and DigitalOcean tokens, live Stripe keys, Google API keys, OpenAI, Anthropic, SendGrid, Telegram bot tokens, _authToken in .npmrc. Obvious placeholders (EXAMPLE, xxxx, ${…}) are skipped. The known check.
  • SCR-R02 (SHOULD, observe): looks like a secret: a quoted string of 16 characters or more with high entropy under a name like password, token, api_key, secret; a password in an address scheme://user:password@host (except example hosts: example.com, .invalid, .test, localhost); a JWT. It is a heuristic, so it observes. The likely check.
  • SCR-R03 (MUST, enforce): .env is ignored by git (git check-ignore; without git, a line in .gitignore); the repository has no environment files .env, .env.production and similar (the templates .env.example, .env.sample, .env.template are fine) and no private key files (id_rsa, id_ed25519, .p12, .pfx, .jks, .keystore). The env check.
  • SCR-R04 (SHOULD, observe): what a machine does not see: where secrets are stored, who has access to them, how they are revoked. The judge is judges/secrets-hygiene.md.

Files are taken from git: tracked and new ones, without ignored ones (those will not be committed anyway). Without git, by walking folders. Binary files and files larger than maxBytes are skipped.

shtuk run std-owasp-secrets history [--last N | --all] looks for secrets of known formats in the lines that past commits added. This is not a check: a secret from history has to be revoked, and rewriting history is the owner's decision.

What is not checked

  • A secret with no known format and low entropy (a short password): it cannot be told apart from an ordinary string.
  • Whether a found key is real and still alive: the package does not go to services.
  • Secrets in binary files, archives, images and outside the repository (CI, cloud).

The package only reads files and asks git (ls-files, check-ignore, log). It writes nothing.