Scan your whole stack
Latest version: v0.2.2
tarpit-guard was last scanned on 28 Nov 2026 at version 0.2.2. Risk score 1 of 100 (low). No malicious behavior was detected.
| Version | Published | Status |
|---|---|---|
| 0.2.2 LATEST | 28 Nov 2026 | 1 rule fired |
Findings for v0.2.2. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.
A file matches the output style of a JavaScript obfuscator, such as many identifiers named _0x followed by hex digits or an indexed string-array lookup. Some commercial packages obfuscate their code legitimately; obfuscation also hides what code does. On its own this is not evidence of malicious behavior.
LOWThe score describes 0.2.2; other versions have their own rules, not their own score.
The publisher’s own README, as collected from the registry.
A pre-flight guard for AI code-analysis agents. It scores a file or repository for signs of deliberate anti-analysis hardening, the obfuscation and "token-burning" tricks that tools like BLA apply to make AI reverse-engineering expensive, and tells an agent, before it spends a budget, whether a target is a tarpit and what to do instead.
One ~1K-token check that prevents a 60K-token mistake.
Contributions welcome, especially real-world samples that widen the test corpus. See Contributing, or pick up a good first issue.
Source-hardening tools defend software by making it hostile to static analysis. A tiny, readable source file is transformed into a large, deliberately confusing one that still behaves identically:
| Original | Hardened | |
|---|---|---|
| Size | 418 B | 184 KB (~440x) |
| Lines | 15 | 2,998 |
| Secret string in cleartext | yes | no (encrypted) |
| Output when run | identical | identical |
The hardened file pads real logic with decoy functions, wraps branches behind opaque-predicate math, encrypts string literals behind runtime decoder loops, and plants jargon "canaries" written specifically to mislead a reading agent.
For an AI agent, the trap is cost. Read-and-trace the whole thing and you burn input tokens on ingestion and reasoning tokens on dead ends, and often still reach a wrong conclusion. The cheap counter is not to out-analyze the obfuscation. It is to detect the tarpit first and stop: don't read it, don't trace it, skip it or hand it to a human. A ~1K-token check replaces a 60K-token dead end.
tarpit-guard is that detection step.
It is a detector and triage guard. It answers one question: does this look deliberately hardened, and if so, what is the cheaper way in? It emits a score, the signals that fired, and a recommended strategy.
It is not a deobfuscator, a cracker, or a secret extractor. It never reverses anyone's protection or recovers hidden values. That is precisely the reverse-engineering these hardening tools exist to stop, and building it would make this project the thing it is meant to warn about. The line is deliberate and permanent: tarpit-guard reads shape, never meaning.
The engine is pure Python standard library. No dependencies, no network, nothing to install for the core. It runs entirely on local text.
node_modules, .git, dist, build, and the like, and look for tool fingerprints.Because every signal is a count or ratio over text, the check is orders of magnitude cheaper than the analysis it protects.
Detection keys on signals that benign code, even heavily minified code, essentially never produces. This is deliberate. The hard problem is not spotting that a file is machine-generated (minified bundles are too). It is telling hostile obfuscation apart from ordinary minification. Size and line-length are explicitly not primary signals, because that is exactly what minification trips.
| Signal | Weight | What it catches |
|---|---|---|
opaque_predicate_density |
0.28 | Math.imul tautology chains that guard real branches behind always-true math (BLA) |
hex_identifier_array |
0.28 | dense _0x... string-array identifiers (javascript-obfuscator family) |
decoder_loops |
0.22 | fromCharCode + charCodeAt loops that reconstruct encrypted string literals at runtime |
obfuscator_control_tricks |
0.12 | self-defending / control-flow tricks (!![], .split('\|') dispatch) |
decoy_vocabulary_density |
0.06 | planted jargon clusters (enclave / attestation / TPM / canary) meant to mislead a reader |
garbled_identifier_ratio |
0.04 | mangled names such as encodeFrozenScopeV4ue7 |
On top of the weighted score, four categorical markers apply a decisive floor, because they are signatures essentially impossible in hand-written or merely-minified code: a dense _0x identifier array, three or more runtime decoder loops, Math.imul opaque-predicate chains, or repeated !![] self-defending tricks. Any one present pushes the file over the line.
Conversely, a file dominated by 1 to 2 character identifiers (the minification tell, 60 to 70% in jQuery/Lodash builds versus about 10% in hostile files) with none of those markers is recognized as benign minification and capped low, with the strategy "read the original source or a source map, not the bundle."
The evidence block reports the raw counts (Math.imul, hex identifiers, decoder pairs, decoy hits, short-identifier ratio, and so on) so a human or agent can sanity-check why a file scored as it did.
Some artifacts are near-certain evidence of deliberate hardening on their own, independent of file contents. Directory scans report them separately as a strong standalone signal:
| Fingerprint | Tool |
|---|---|
.bla-hardened/ directory |
BLA |
.blarc |
BLA |
bla-harden-summary.json |
BLA |
The fingerprint map is a plain table in detector.py and is meant to grow as more hardeners are catalogued.
hardened is true. Tunable with --threshold (CLI) or the threshold argument (MCP).eval_corpus.py scores a labelled corpus (corpus/) of clean source, real minified bundles, and hostile obfuscation, and reports false positives and false negatives. It doubles as a regression test (non-zero exit on any miss).
v0.2 results (threshold 55):
| Bucket | File | Score | Verdict |
|---|---|---|---|
| clean | jquery.source.js / lodash.source.js | 0.0 | ok |
| clean | detector.py (contains the decoy word list) | 9.5 | ok |
| minified | jquery.min.js | 0.0 | ok |
| minified | lodash.min.js | 0.0 | ok |
| obfuscated | bla_hardened_app.js | 78.0 | TARPIT |
| obfuscated | js-obfuscator_sample.js | 85.0 | TARPIT |
0 false positives, 0 false negatives. Highest benign score 9.5, lowest hostile score 78.0, a +68.5 margin, stable across any threshold from about 10 to about 77. (For contrast, v0.1 leaned on file size and scored minified jQuery above a real obfuscated file. That regression is what this corpus exists to prevent.)
From PyPI:
pip install tarpit-guard # core CLI, standard library only
pip install "tarpit-guard[mcp]" # adds the FastMCP server (fastmcp>=2.0)
Or run it without installing (needs pipx):
pipx run tarpit-guard path/to/code
For development (from a clone):
git clone https://github.com/ManiraM-1/tarpit-guard.git
cd tarpit-guard
pip install -e ".[mcp]"
Requires Python 3.9+.
tarpit-guard path/to/file.js # score a single file
tarpit-guard path/to/repo # scan a tree + report fingerprints
tarpit-guard path/to/repo --quiet # only show flagged files
tarpit-guard path/to/repo --json # machine-readable report
tarpit-guard path/to/repo --threshold 45
tarpit-guard --mcp # start the MCP server instead (needs the [mcp] extra)
python -m tarpit_guard.cli path/to/file.js # if the console script is not on PATH
See SCHEMA.md for the frozen --json and MCP output schema contract.
Exit codes make it a drop-in CI gate:
| Code | Meaning |
|---|---|
0 |
nothing flagged |
1 |
at least one tarpit found |
2 |
path not found |
# e.g. fail a job if a dependency ships hardened artifacts
- run: tarpit-guard ./vendor --quiet
Install with the MCP extra, then run the server over stdio:
pip install "tarpit-guard[mcp]"
tarpit-guard-mcp # or: tarpit-guard --mcp, or: python -m tarpit_guard.mcp_server
To add it to an MCP client such as Claude Desktop, Cursor or VS Code, use this config. It needs uv, and nothing has to be installed first:
{
"mcpServers": {
"tarpit-guard": {
"command": "uvx",
"args": ["--from", "tarpit-guard[mcp]", "tarpit-guard-mcp"]
}
}
}
It exposes three tools:
| Tool | Use |
|---|---|
check_file(path) |
score one file before reading it |
check_source(text, label) |
score a raw snippet without touching disk |
scan_repo(root, threshold) |
sweep a tree for fingerprints and tarpit files |
The intended agent loop:
encounter unfamiliar file
|
v
check_file(path)
|
hardened? --no--> analyze normally
|
yes
|
v
stop: don't read or trace it,
skip the file, or flag it
for a human
The guard turns "read everything and hope" into a deliberate, budgeted decision.
$ tarpit-guard ./BLA
Tool fingerprints found (strong signal of deliberate hardening):
[bla] dir: ./BLA/.bla-hardened
[bla] file: ./BLA/.blarc
[bla] file: ./BLA/.bla-hardened/bla-harden-summary.json
[TARPIT] score= 78 conf=1.00 ./BLA/.bla-hardened/app.js
182865B / 2998 lines, Math.imul x246, decoder_pairs=8, garbled_idents=190, decoy_hits=487
fired: opaque_predicate_density, decoder_loops, decoy_vocabulary_density
-> Treat as a tarpit. Stop here: do not read, trace, or try to deobfuscate
this file. Skip it and move on, or flag it for a human.
[ok] score= 0.0 conf=0.00 ./BLA/app.js
tarpit-guard/
|- pyproject.toml
|- README.md
|- LICENSE
|- .gitignore
|- eval_corpus.py # scores corpus/, reports false positives/negatives
|- corpus/ # labelled samples: clean / minified / obfuscated
|- tarpit_guard/
|- __init__.py # public API: analyze_file, analyze_text, repo_fingerprints
|- detector.py # scoring engine (stdlib only)
|- cli.py # command-line entry point
|- mcp_server.py # FastMCP wrapper
This is a v0.2 heuristic, and honesty about its edges matters more than a clean pitch:
corpus/, eval_corpus.py).Does this crack or defeat BLA? No. It detects that hardening is present and recommends a cheaper strategy. It never reverses the protection or extracts secrets.
Is "burning all the AI's tokens" real? Partly. Hardening genuinely raises the cost of static analysis and genuinely hides string secrets. It does not always exhaust a budget, but it reliably wastes one: an agent that reads and traces a hardened file spends heavily and often still reaches the wrong conclusion. tarpit-guard exists so the agent notices early and stops instead.
Why stdlib-only for the core? Portability and auditability. The thing that inspects untrusted code should itself be tiny, dependency-free, and easy to read.
Contributions are very welcome. This is early, and the most valuable help is data, not just code. A detector is only as good as the corpus it is tested against. See CONTRIBUTING.md for the full guide.
Good first contributions:
Find threats in your stack.
OX Radar can check high-priority threats, like critical package CVEs, against your context.
Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.
The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).
The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.