CWE-798Data exposureSeverity · High

Secrets in the repository

A cloud key, database password or API token committed to code, config or a workflow. Anyone who reads the repository, or its history, holds that access.

At a glance

Controls
CWE-798 · A07:2021 Identification and Authentication Failures
Typical severityHigh
ReferenceCWE-798
OWASP Top 10A07:2021 Identification and Authentication Failures

What it is

Secrets end up in source control when a developer hard-codes a key, commits a config file or pastes a token into a deploy workflow. Deleting the line later does not remove it. The secret stays in the repository history and in every copy of it.

Anyone with read access to the code, a leaked copy or a public fork can use the secret directly. That can mean full access to a database, a cloud account or a payment provider. AI-assisted attackers scan code and history for secret patterns at scale and test each key they find straight away.

Where it hides

What a reviewer can look for in the code and in the behaviour, before anyone proves it.

  • Config files and environment templates committed by mistake
  • CI and deploy workflow files with tokens written inline
  • Test scripts and seed scripts with real credentials
  • Old commits where a secret was added and later deleted

How MATT tests it

The proof runs against the deployed product, on every release, whoever wrote the code.

  1. 01Scan the current code and the full commit history through read-only GitHub access for secret patterns.
  2. 02Confirm each candidate is live with a harmless, read-only identity call to its provider.
  3. 03Report the location and scope of each live secret without using it for anything further.
The rule, in plain English

No secret may be stored in source control.

Executable check

scan: every file in the repository at HEAD scan: every commit in the history expect: zero matches for key, token and password patterns expect: secrets referenced only by name from a secret store

Every rule MATT holds →

What the fix looks like

  1. 01

    Revoke and rotate every exposed secret first, since history keeps the old value.

  2. 02

    Move secrets into a secret manager or the CI platform's encrypted secrets.

  3. 03

    Add a secret scanner to pre‑commit hooks and to the pipeline so new leaks fail the build.

  4. 04

    Give each secret the smallest scope it needs, so one leak opens as little as possible.

A check that was never written is found by proving the deployed behaviour, fixed with the engineer who shipped it, and kept fixed by running the control on every change. What is ExploitOps? →

ExploitOps discovery call

Understand where your security loop breaks.

A call with a MATT co-founder to understand your product and whether an ExploitOps Review is worth doing. If there is a real need, we scope one with the research team.

Let’s understand your priority

What brings you to MATT?

What would you like help with?
01 / 02