Skip to main content
A hardcoded secret is a password, access key or token written directly into a code file. Anyone who can read the code can then use it. Iris Code looks for these values so you can remove them before the code is shared. Removing the line is only half the fix. If a real secret has already left your machine, the old value is not safe to use again and needs replacing.

Two ways of catching one

By variable name. A piece of text stored in a variable called key, token, secret, password, auth, credential or api, including common variants, is reported. By format. Some values are recognisable whatever they are called, because the service that issued them gives them a fixed prefix:
  • GitHub tokens (ghp_)
  • OpenAI and Stripe keys (sk-)
  • AWS access key IDs (AKIA)
  • Google API keys (AIza)
  • Slack tokens (xoxb- / xoxp-)
  • Bearer tokens written into the code
Together, the two checks catch both const apiKey = "..." and a real token stored in a variable called x.
Placeholders are left out automatically: your_key_here, changeme, REPLACE_ME and all-caps templates. Reporting the example in a README would teach people to ignore the warnings. When both checks match the same line, you get one finding rather than two.

CLI scanning

The CLI is the set of Iris Code commands you type in a terminal. iris secrets is free and needs no account:
iris secrets is worth adding to CI, the automated checks that run when code is pushed, even if nobody on the team has Pro. It needs no licence and checks every push for leaked credentials.

Configuration

To switch secrets detection off, set this in .irisconfig.json:
If you want secrets still counted in the health score but not underlined in the editor, leave detection on and set inlineDiagnostics.hardcodedSecrets to false instead.

If one has already been committed

Deleting a key from a file does not delete it from your Git history: every earlier commit still contains it. Git history secrets scans past commits for exactly this case. Either way, replace the credential with a new one. A secret that has reached a shared repository should be treated as compromised.
Security smells covers nine further risky patterns, such as eval usage, SQL built from strings, weak hashing and switched-off certificate checks. They run alongside secrets detection and count toward the same Blockers total.