Blog / A07:2021 Identification and Authentication Failures
A07:2021 · Identification and Authentication Failures

The Test Fixture With Real-Looking Credentials

A username, a password, and a client secret sit in a checked-in test file. The only thing between that and a breach is whether those values still work somewhere.

secret writteninto test filefile committed toreporepo or artifactsharedreader extractscredentialsauthenticates asthe appATTACKER INPUTIMPACTcheck absent
Attack path · secret written into test file → file committed to repo → repo or artifact shared → reader extracts credentials → authenticates as the app

A username, a password, and a client secret sit in a checked-in test file. The only thing between that and a breach is whether those values still work somewhere.

What goes wrong

A test fixture carries a username, a password, and a client secret in plaintext. It reads as harmless because it is 'just a test.' The value of those credentials has nothing to do with the file they live in. It depends entirely on whether they authenticate against a real environment.

If they do, then everyone with repo access, every CI job, every cached build artifact, and anyone who ever cloned the history now holds admin credentials. Version control does not forget. Deleting the line later does not rotate what already sits in a hundred local clones and the reflog.

The honest way to size this bug is to answer one question first. Are these values valid in any shared or deployed system? If yes, this is an incident and the secret needs rotating now. If they only match a local mock, it is a hygiene fix. Do not assume the second answer without checking.

The pattern

Vulnerable
// fixture used by an integration test
const auth = {
  username: 'admin-app',
  password: 'S3cr3t-Passw0rd',
  clientSecret: '9f8c...looks-real'
}
Hardened
// pull secrets from the environment at test time
const auth = {
  username: env('TEST_USER'),
  password: env('TEST_PASSWORD'),
  clientSecret: env('TEST_CLIENT_SECRET')
}
// fixtures reference secrets, they never contain them
How the pipeline adjudicated itDISPROVEN
ABCDEFGH

Grounding and reachability checked out, then the exploit-path gate failed to stand up. The pipeline recorded the finding as disproven and signed that result, so the same false alarm will not come back next quarter.

Ed25519 · per-tenant signing key · gate ledger A–H · verify offline against the published payload hash

Why it matters to you

Secrets in a repo are the cheapest possible win for an attacker who gets read access, and read access leaks constantly through forks, contractors, mirrors, and stolen laptops. The blast radius is set the day the secret is committed, not the day someone notices. Keep real credentials out of version control, and when one slips in, rotate it instead of only deleting the line.

Check your own code