Loophalt — a lightweight static security scanner that catches hardcoded secrets, SQLi, XSS, command injection, path traversal, weak crypto and more across JS/TS, Python, Go and PHP.

🌐 Website: https://frinjo.me/loophalt · 📦 Latest release: v1.4.0
Renamed in v1.4.0: Loophalt was previously called Loophole. Old commands (
python3 loophole.py ...),.loophole.jsonconfigs and.loopholeignorefiles keep working — see the changelog.
This project is tested with BrowserStack.
Loophalt is a zero-dependency static security scanner that finds the holes in your code — hardcoded secrets, SQL injection, XSS, command injection, weak crypto and more — across JavaScript/TypeScript, Python, Go, PHP, Ruby, Rust, C# and Dockerfiles, plus Terraform and Kubernetes manifests. 115 rules, taint tracking, SARIF output — one Python file, no dependencies, no network calls. It also explains why each finding matters, suggests a fix, and can print mechanical fix suggestions as diffs without ever touching your files.
python3 loophalt.py scan ./src
# or, with the wrapper on your PATH:
loophalt scan ./src
$ loophalt scan ./app.py
Loophalt found 3 issue(s): 1 critical, 2 high
── CRITICAL (1) ──────────────────────────────────────────────────
CMD002 Command injection via shell (Python)
app.py:9
› os.system("ping -c1 " + host)
── HIGH (2) ──────────────────────────────────────────────────────
SEC002 Hardcoded password
app.py:3
› password = "hunter2secret"
SQLI002 SQL injection via string formatting (Python)
app.py:6
› return conn.execute("SELECT * FROM users WHERE name = '" + name + "'")
📊 Measured, not marketed: on a hand-labelled corpus Loophalt detects 72% of vulnerable files — 100% when the dangerous value is built at the sink — with the misses published too. Full method and numbers: BENCHMARK.md.
Also from Loophalt: MergeGate — free, open-source PR triage for maintainers: AI-slop scoring and duplicate/competing-PR detection in one GitHub Action. (This repo runs it on its own PRs.)
Most scanners are either heavyweight SaaS products or regex grep-scripts with noisy output. Loophalt sits in the middle:
req.query, ctx.query
(Koa), request.query (Fastify), request.args,
$_GET, r.URL.Query(), …) and flags when they flow into dangerous
sinks, including direct query($_GET['id']) usage.textContent,
execFile with literals, crypto.randomUUID, env-var secrets and friends
are all recognized as safe.--fix-dry prints unified diffs
for safe mechanical fixes. It never modifies your files.# scan a directory or file
python3 loophalt.py scan ./src
# scan several paths in one invocation — one merged report, one exit code
python3 loophalt.py scan ./src ./tools extra.py
# JSON report for tooling
python3 loophalt.py scan ./src --json report.json
# SARIF for GitHub code scanning
python3 loophalt.py scan ./src --sarif results.sarif
# GitHub workflow-command annotations: one ::error/::warning per finding,
# shown inline on the PR diff with no SARIF upload step
python3 loophalt.py scan ./src --format annotations
# (--annotations is shorthand for --format annotations)
# self-contained HTML report (inline CSS, no external assets)
python3 loophalt.py scan ./src --html report.html
# JUnit XML for CI dashboards (Jenkins, GitLab CI, Azure DevOps, CircleCI)
python3 loophalt.py scan ./src --junit report.xml
# GitLab SAST report for the Security Dashboard / merge request widget
python3 loophalt.py scan ./src --gitlab gl-sast-report.json
# adopt on an existing codebase: record today's findings as a baseline,
# then fail CI only on NEW ones
python3 loophalt.py scan ./src --write-baseline baseline.json
python3 loophalt.py scan ./src --baseline baseline.json
# every finding carries a priority score and band (P1–P4) in the
# terminal, JSON and SARIF reports — severity + taint verification +
# rule class — so the fix-first order is obvious: clear the P1s first
# show suggested fixes as diffs (read-only)
python3 loophalt.py scan ./src --fix-dry
# scan piped code instead of a file (editor / pre-commit / pipeline input)
echo 'eval(x)' | python3 loophalt.py scan - --stdin-lang py
# list all rules
python3 loophalt.py scan --rules .
# show what one rule checks, its severity and how to fix it
python3 loophalt.py scan --explain SEC001
# only critical findings, skip tests
python3 loophalt.py scan ./src --severity critical --exclude 'tests/*'
Exit code is 1 when any critical/high finding exists (CI-friendly), 0 otherwise.
Use --fail-on {critical,high,medium,never} to change the threshold
(default: high). --fail-on medium also fails on medium findings;
--fail-on never always exits 0 (report-only). The threshold compares
against post-override severities (.loophalt.json), and suppressed findings
are excluded. --severity is the minimum severity for the whole run:
findings below it appear in no output — console, JSON/SARIF/HTML/JUnit/
GitLab reports, summary counts and baseline records — and never affect the
exit code
No good first issue or help wanted issues are currently available.
Thanks for helping make codebases safer. Loophalt is a single-file Python
scanner (loophalt.py) with zero dependencies — contributions should keep it
that way: standard library only, Python 3.8+.
git clone https://github.com/loophalt/loophalt
cd loophalt
python3 loophalt.py scan ./some-project
python3 tests/selftest.py # must pass before you open a PR
No build step, no virtualenv, no pip install. If it needs a dependency, it doesn't belong in Loophalt.
Every check is a function in loophalt.py named rule_<ID> taking a scan
context (ctx):
def rule_SEC042(ctx):
...
One exception: the SQL-injection family (SQLI001–SQLI007) is implemented
as per-language helpers _sqli_js, _sqli_py, _sqli_go, _sqli_php,
_sqli_rb and _sqli_rs instead of a single rule_SQLI... function.
Rule IDs are grouped by family:
| Prefix | Family |
|---|---|
ASSERT | assert used for runtime input validation |
AUTH | missing authentication on sensitive routes |
BIND | services bound to all network interfaces (0.0.0.0) |
CLEAR | cleartext protocols (FTP/Telnet) |
CMD | command injection |
CMP | timing-unsafe secret/token comparison |
COOKIE | insecure cookies |
CORS | CORS misconfiguration |
CRLF | user input written into response headers |
CRY | weak cryptography |
CSRF | cross-site request forgery |
DBG | debug mode / endpoints exposed |
DESER | insecure deserialization |
DISP | dynamic dispatch on user-controlled input (Ruby send) |
DOCK | Dockerfile misconfiguration (root user, unpinned images) |
DOS | unbounded reads on request bodies |
ERR | stack traces / exception details sent to clients |
EVAL | dynamic code evaluation |
EXC | silently swallowed exceptions |
EXTRACT | unsafe archive extraction |
HDR | missing security headers |
JWT | JWT validation flaws |
KUB | Kubernetes manifest misconfiguration |
LDAP | LDAP injection |
LOG | secrets passed to logging calls |
LS | secrets stored in browser storage |
MASS | mass assignment with raw params |
MSG | postMessage sent without a target origin |
NOSQL | NoSQL injection |
PATH | path traversal / file handling |
PERM | world-writable file permissions |
PPROF | Go pprof debug endpoints exposed |
PROTO | prototype pollution |
RAND | insecure randomness |
REDIR | open redirect |
REDOS | regular-expression denial of service |
SEC | secrets, credentials, general security |
SQLI | SQL injection |
SSH | SSH host-key verification disabled |
SSRF | server-side request forgery |
SSTI | server-side template injection |
TF | Terraform misconfiguration (public S3, open security groups) |
TIMEOUT | HTTP requests with no timeout |
TLS | TLS verification flaws |
TMO | Go HTTP server started with no timeouts |
UPL | insecure file upload |
XPATH | XPath injection |
XSS | cross-site scripting |
XXE | XML external entities |
ZIP | unsafe archive extraction (Zip Slip) |
Run python3 loophalt.py scan --rules for the authoritative list of rules
and families — it always reflects the scanner, even if this table lags.
A rule reports a Finding with a rule id, severity
(critical / high / medium), a plain-English title, file and line,
the offending snippet — and, most importantly, why it is dangerous and how to
fix it. A finding without a fix suggestion is incomplete.
rule_ functions).loophalt.py. Prefer precise patterns and, where the
family supports it, taint information over raw keyword matching — false
positives are the enemy.tests/fixtures/, and cover the rule in tests/selftest.py.python3 loophalt.py scan . must stay clean.