In short: a scanner reads your files and every older version for strings that look like credentials. Deleting a found secret from the code does not make it safe. Revoke it at the service that issued it first, then clean up and prevent a repeat.

What counts as a secret?

A secret is any value that lets someone act as your application or your team. OWASP lists API keys, database credentials, SSH keys and certificates as examples. Whoever holds the value can use it, whether or not they were meant to have it.

Where a secret hides

The obvious place is a file in the current code. There are more places, and the history is the one teams forget.

Where a secret can sit; our check reads three of the seven places1The files as they are now2Older versions of the files, in thehistory3Pipeline and workflow files4Issues, pull requests and wikis5Build logs6Copies: clones, forks and cachedviews7The built bundle sent to visitors
Where a secret can sit; our check reads three of the seven places1The files as they are now2Older versions of the files, inthe history3Pipeline and workflow files4Issues, pull requests and wikis5Build logs6Copies: clones, forks and cachedviews7The built bundle sent tovisitors
  • our check reads this
  • our check does not read this
Seven places where a secret can sit. With a check mark: the files as they are now, the older versions in the history of the default branch, and the pipeline files. The other four are outside what our check reads.

Git keeps every version of every file. A key that was removed last year is still in the commit that added it. GitHub and GitLab also scan issues, pull requests and merge request descriptions. In build logs, GitHub redacts values stored as secrets, but warns that secrets must not be printed when a workflow runs.

A frontend bundle is a place of its own. Vite's documentation says variables with the prefix VITE_ are bundled into the client code and should not hold sensitive information such as API keys.

Why deleting the line does not remove it

Scanners such as gitleaks read the history with git log. A secret in an old commit is found as easily as one in the current file. Anyone who cloned the repository before you deleted the line still has a copy.

Rewriting the history is possible but disruptive. GitHub's documentation warns that commits with sensitive data may still be reachable in clones, forks, cached views and pull requests. It also says a rewrite may not be worth the effort once the secret is revoked.

What to do when one is found

Treat the secret as compromised. GitHub advises rotating the affected credential immediately. Microsoft's guidance for Azure DevOps says the same: once a secret is committed, it is compromised.

What to do when a secret is found, in five stepsRevokeat the service thatissued itReplacewith a new secretStore it safelyoutside the codeCheck the useof the old oneClean upthe history, ifneeded
What to do when a secret is found, in five stepsRevokeat the service that issued itReplacewith a new secretStore it safelyoutside the codeCheck the useof the old oneClean upthe history, if needed
Five steps in a row. Revoke the secret at its issuer and create a new one. Store that outside the code and check what the old one was used for. Only then clean the history. Revoking comes first.

Revoking comes before everything else, because it is the only step that makes the old value useless. Cleaning the history is optional and comes last.

How to prevent it

Prevention works in layers, and each layer can be skipped on its own.

  • A pre-commit hook runs a scanner on your machine before a commit is made. Gitleaks ships a hook for the pre-commit framework. A developer can skip it for one commit.
  • Push protection on the Git host blocks a push that contains a secret. GitHub, GitLab and Azure DevOps each offer it. On GitHub, people with write access can bypass it by giving a reason, and the bypass is logged.
  • A secret store keeps the value out of the code. OWASP advises against long-lived, widely scoped credentials in CI/CD variables and recommends short-lived credentials.
  • A scan in the pipeline catches what the first two missed. GitLab's pipeline secret detection scans commits on the default branch.

What a scanner misses

A scanner is good at secrets with a known shape, such as the keys of large providers. It is weaker at the rest.

  • GitHub lists passwords as a separate, unstructured kind of secret that needs its own detection.
  • Generic patterns on GitHub have no validity check, so a hit does not say whether the secret still works.
  • Push protection covers the most recent versions of a token. Microsoft says older and legacy tokens may not be blocked.
  • Gitleaks looks only at additions in the history, so it reports where a value was added, not whether it works.

OWASP therefore advises using more than one detection tool and comparing the results.

What we check of this

We read the files of your code and the history of your default branch for passwords, keys and tokens. We use the scanner gitleaks at a fixed version. We also read your pipeline files for secrets that belong in the CI's secret store. For every finding we name the file, the line and the version, never the value.

We do not test whether a found secret still works, and we do not read issues, wikis, build logs or the built frontend. We revoke and change nothing. That stays with you.

Join the pilot

Sources, opened on 11 November 2026

Written by the BlueLandscape team with the help of AI. Every statement was checked against the source above.