Skip to content
Cloa

Contents

  1. IThe map left openOne npm release shipped a 59.8 MB source map.
  2. IIThe thievesAn agent needs only what you shipped.
  3. IIIThe watchCloak reads your build first.
  4. IVThe trialThen it weighs what you shipped.
  5. VThe keepMove what matters behind the walls.
  6. VIThe sealNothing new ships unseen.
  7. VIIThe scribe’s handStop the leak before it is written.
  8. VIIIThree ways inTerminal, Claude Code or CI.
  9. IXThe oathHow Cloak handles your code.
  10. XAt the gateQuestions at the gate.
  11. Ep.Hold fastAudit your next build.

DocsGitHubMIT licencev0.3

Open source · MITv0.3 early access
Cloa

AI agents can steal your app. Know what they’d take, then hide it.

One command checks your build for leaked source and secrets, and tells you what to move or harden. Free and open source.

npx cloak-audit audit
View on GitHubStar

No sign-upNo backendThe audit runs offline

Chapter IThe map left open

In March 2026 one npm release shipped a 59.8 MB source map. Anyone could read the 512,000 lines of TypeScript inside it.

A source map turns a minified bundle back into the original files, comments included.

Claude Code’s npm package, March 2026, reported by heise online

Chapter IIThe thieves

An agent needs only what you shipped.

A source map hands an agent your original files, comments included. Without one, it reads the minified bundle and rebuilds your logic as code you can follow.

1 in 5
sites shipped source mapsHTTP Archive crawl, 2019
70%
of the organisations one scanner checked exposed themEscape, 2025
0
passwords, exploits or logins the agent needsit reads what you shipped

Cloak reads your build the way the agent will, and tells you what to take back first.

Interlude · the reckoning

This is what a source map gives back.

dist/assets/index-9f8e.js · what you shippedrecovered 0%
The minified bundle turns back into the original file, comments included. The example shows a pricing function, calculateQuote, and a comment saying not to ship it to the client.
214
original files in the map
100%
of names and comments restored
1
line you asked never to ship

Chapter IIIThe watch

Cloak reads your build first.

One command checks your build for source maps, secrets, debug builds and exposed endpoints. In an AI app it also finds model keys, browser-side model calls and shipped prompts. It runs offline in seconds and writes a report that opens in any browser.

cloak · demo-appno network

Chapter IVThe trial

Then it weighs what you shipped.

Cloak rates each of your own modules from 1 to 5 by how much a copy would cost you, then says what to do with it: move it server-side, harden it, or leave it.

  1. src/pricing/quote.tsmove server-side
  2. src/api.tsharden
  3. src/config.tsleave
  4. src/App.tsxleave

Example on the demo app. Classification uses your own Anthropic key and asks before it sends anything. A small app costs under one US cent.

Chapter VThe keep

Move what matters behind the walls.

Every finding names its fix. Apply them, build again and run the audit again.

  1. Hide production source mapsvite.config.ts · sourcemap: 'hidden'
    clears F1.1, F1.3
  2. Move the key and the model callsrc/config.ts, src/ai.ts → POST /api/ask
    clears F1.4, F1.5, F1.12
  3. Move pricing server-sidesrc/pricing/quote.ts → POST /api/quote
    moved
  4. Harden what has to staycloak-audit/vite obfuscates src/api.ts, then runs your check
    hardened

Still open3critical2high

Chapter VIThe seal

Nothing new ships unseen.

Run cloak lock once and commit the file. It records what your build exposes: hosts, API routes, inlined environment names, browser-side model providers and sensitive modules. After that, every audit and pull request flags anything new. It never records a secret.

cloak lockexample
$ npx cloak-audit lock
Wrote cloak.lock.json: 3 hosts, 6 API routes,
2 environment variables, 0 model providers,
4 kinds of shipped file.

# a week later, on a pull request
HIGH  F1.14  New host: billing.internal
             (not in cloak.lock.json)

Chapter VIIThe scribe’s hand

Stop the leak before it is written.

An agent writes much of your code now. Inside Claude Code, the edit guard checks each edit before the file changes, and blocks one that turns on production source maps or puts a secret where the browser can read it. Elsewhere, run cloak check-edit.

claude code · edit guardexample
› Edit src/lib/checkout.ts
  blocked  This edit writes a Stripe live secret key
           into src/lib/checkout.ts, which is code
           that ships to browsers.
  fix      Keep the key on the server: read it from
           an environment variable in a server endpoint,
           and have the client call that endpoint.

Interlude · the audit, again

Build again. Audit again.

cloak · demo-app, after the fixesrunning

Example run on the demo app after the fixes: npx cloak-audit audit. Critical 0, high 0, medium 0, low 0, info 1. Since the last run: 0 new, 5 resolved. Passed: no findings at critical or worse.

Chapter VIIIThree ways in

Terminal, Claude Code or CI.

The audit needs no key and no network, wherever you run it.

From your terminal

Nothing to install. Point it at your build folder and read the findings.

  • audit makes no network calls and needs no key.
  • init --prepublish makes npm publish fail on a critical finding.
terminal
$ npx cloak-audit audit      # leaks in your build, offline
$ npx cloak-audit estimate   # what classification would send

$ npx cloak-audit init --prepublish
# npm publish now fails on a critical finding

Chapter IXThe oath

How Cloak handles your code.

Runs on your machine

No account and no backend. Reports stay in .cloak/ in your repo.

Your key, your bill

Classification uses your own Anthropic key. The audit needs no key at all.

Your software only

Cloak scans build output inside the current project. It refuses URLs.

Asks before it sends

Before the first model call, Cloak shows what it will send and what it will cost, then asks.

Secrets stay home

Cloak redacts secrets before any model call. Reports show only their first four characters.

No telemetry

Cloak collects nothing about you, your code or your runs.

Chapter XAt the gate

Questions at the gate.

Anything else, open an issue on GitHub.

Is Cloak free?

Yes. Cloak is open source under the MIT licence, and the audit costs nothing. Classification uses your own Anthropic key. A small app costs under one US cent, and cloak estimate shows the cost first.

Does my code leave my machine?

Not for the audit, which makes no network calls. Classification sends each module’s path, exported names, imports and up to 6,000 characters of source, with secrets redacted, and only once you agree.

What can it check?

The build output of web apps and Electron apps, and the files in your npm package. It looks for source maps, secrets, inlined environment variables, debug builds and exposed endpoints. In AI apps it also finds model API keys, calls to model providers straight from the browser, and system prompts shipped in client code. If Gitleaks or TruffleHog is installed, it runs them too, offline.

Can I scan someone else’s app?

No. Cloak only scans build output inside the current project, and it refuses URLs.

Does it make my code harder to copy?

It can. For logic that has to stay in the browser, the cloak-audit/vite plugin obfuscates the modules worth protecting. Then it runs your own check and fails the build if that breaks. Obfuscation slows a reader down; moving the logic server-side stops one. Hardening works with Vite.

How do I stop a leaky release?

Run npx cloak-audit init --prepublish. From then on npm publish fails while critical findings remain. In CI, the GitHub Action fails the pull request instead.

EpilogueHold fast

Audit your next build.

The audit takes seconds, needs no account and makes no network calls.

npx cloak-audit audit
View on GitHubStar

No sign-upNo backendMIT licence