Skip to content

Secrets: a committed .env, API keys, private keys ​

Files and folders: one of the ways AI coding agents bloat software, from lessloc's pattern catalog. lessloc catches it as secret.

What makes secrets (a committed .env, API keys, private keys) a bad practice? ​

The standards that call it a bad practice: CWE-798 Use of Hard-coded Credentials; CWE-540.

What does lessloc do about secrets (a committed .env, API keys, private keys)? ​

lessloc catches it as secret.

  • secret (tier 0): A credential in a known format in the added lines, or a new .env file that would be committed.

Examples ​

Caught as secret:

js
export const stripe = "sk_live_51HxQz2eZvKYlo2C8a9Gm4Rt7Uv0Wx3Yz";

Written well:

js
export const stripe = process.env.STRIPE_KEY;

The other patterns in Files and folders:

Released under the Apache-2.0 license. · llms.txt