Secrets scanning

Secrets scanning looks for passwords, API keys, tokens and private keys in your code. AquilaX masks them in the results.

Included in every plan, including Free.

In AquilaX

AquilaX secrets finding for an API key in app.js, with the key partly masked
AquilaX masks the key in the title and the code. This is a fake key in a test app.

Screenshots that show scan results use our public test apps, which are vulnerable on purpose. Select an image to enlarge it.

What it looks for

API keys and tokens

Keys and tokens for cloud and online services.

Passwords

Passwords in source code and settings files.

Private keys

Private keys saved in a repository.

Examples

These examples show common problems and safer ways to write the code. They are not AquilaX results, and scanner coverage can vary.

Cloud keys in a settings file

CWE-798AWSCritical
Vulnerable · settings.py
AWS_ACCESS_KEY_ID = "AKIAIOSFODNN7EXAMPLE"
AWS_SECRET_ACCESS_KEY = "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"

s3 = boto3.client("s3",
    aws_access_key_id=AWS_ACCESS_KEY_ID,
    aws_secret_access_key=AWS_SECRET_ACCESS_KEY)
Why it's exploitable

These are AWS's documentation keys. Real ones look exactly the same. Bots scan public GitHub for AKIA strings and start using them within minutes.

In a private repo the key still sits on every laptop, CI runner and backup that has a clone.

The fix
# rotate the key first: deleting the line doesn't revoke it
# then let boto3 find credentials (IAM role, SSO, env)
s3 = boto3.client("s3")

"Removed" from the repo, still in history

Git historyCritical
Vulnerable · .env (deleted)
$ git log --oneline -- .env
9f2c1ab remove .env from repo
41d07e3 initial commit

$ git show 41d07e3:.env
DATABASE_URL=postgres://app:[email protected]/app
STRIPE_SECRET_KEY=sk_live_51H...
Why it's exploitable

Deleting a file adds a new commit. The old commit is still there, and anyone with a clone can read it with one command.

The fix
# 1. rotate both credentials now
# 2. then purge history and force-push
$ git filter-repo --path .env --invert-paths
$ echo ".env" >> .gitignore

An API key shipped to every browser

Next.jsOpenAICritical
Vulnerable · app/chat/page.tsx
// .env
NEXT_PUBLIC_OPENAI_API_KEY=sk-proj-...

// client component
fetch("https://api.openai.com/v1/chat/completions", {
  headers: {
    Authorization: `Bearer ${process.env.NEXT_PUBLIC_OPENAI_API_KEY}`,
  }, ...
Why it's exploitable

Next.js inlines every NEXT_PUBLIC_ variable into the JavaScript bundle at build time. Anyone can open DevTools, search for sk-, and spend your credit.

The fix
// app/api/chat/route.ts runs on the server
const key = process.env.OPENAI_API_KEY;  // no NEXT_PUBLIC_
// the browser calls /api/chat, never OpenAI directly

What to know

  • If a secret is real, replace it first. Deleting it from the latest version of a file does not make it safe.
  • Check access logs for signs that someone has used the secret.
  • Store secrets in a secrets manager or protected CI/CD variables.
  • Scanners can miss secrets and report test values. Review the results.

See all scanners How to fix findings

Questions and answers

What should I do if a secret is found?

Check whether it is real. If it is, revoke or replace it, check the access logs and remove it from the code.

Are secrets shown in the results?

No. AquilaX masks passwords and secrets found in code.

Is it enough to delete a secret from the code?

No. It may still be in your Git history or in copies of the repository. Revoke or replace it first, then follow your process for removing it.

Can AquilaX replace a leaked secret for me?

No. Revoke or replace it in the service where it was created. Then update any apps that use it and check their access logs.

What if the finding is only a test value?

Make sure it does not give access to anything. If it is safe, mark the finding as False Positive. Use values that are clearly fake in examples and tests.

Can I check only the files changed in a pull request?

Yes. Use a diff scan to check the changed files. Run full scans regularly, because a diff scan does not check the rest of the project.

Where should I store secrets?

Use a secrets manager or protected CI/CD variables. Give each app only the access it needs, and change secrets when needed.

Which plan includes this scanner?

Included in every plan, including Free. Compare plans.

Try it on one of your repositories

Create a free account and run a scan. If you need Ultimate, self-hosting or a larger rollout, talk to our team.

No credit card needed. Read the documentation