2026 · SECURITY TOOL

StackBadger

A published security harness that documents infeasible detection paths instead of disguising them as capabilities.

PUBLISHED Generalized the authentication adapters and led the safe extraction process.
On this page

WHAT IT IS

A penetration-testing harness that attacks apps from the outside.

StackBadger is a black-box penetration-testing harness, meaning automated attacks that probe a deployed web app's sign-in, data access and payment webhooks (the notices a payment processor sends the app) from the outside. I built it inside the repo for TariffRefunded, another product on this register, starting on May 4, 2026, and published it as its own repo on June 10 under the MIT license, which lets anyone use and change the code. Everything it knows about a target sits in a profile, which the harness assembles from what the live site serves plus an optional YAML settings file that the person running it writes.

StackBadger screenshot

WHAT CHANGED

A product-specific harness became reusable tooling.

The first version had TariffRefunded's details hardcoded into it. A portability pass on May 5 removed that product knowledge, and an external-attacker mode let a run work with no server-side secrets. On May 16 a fingerprinter, which works out a target's services from its live site or source, landed with a schema for the profile, a fixed definition of the fields a profile may hold. By May 18 three more login providers, the hosted services an app uses to sign people in, had adapters (the sign-in code for one provider) beside the original Clerk one. The repo's contributing rules now require every probe to take target details from the active profile and never hardcode a name from one application.

CONTROL

Writes and any target beyond localhost need explicit confirmation.

Every run is read-only unless the operator turns on write tests, the tests that change data on the target, and any host other than localhost needs two confirmation settings that each name that exact host; the layers below show the flags. The host gates are enforced in run.sh, the script that drives every run, and they are tested through stubs, stand-in pieces that replace the real ones inside a test. CI, the checks GitHub runs on every push and pull request, runs only offline self-tests and never touches a live target.

LESSONS

Two patterns from this build.

  • Apply your exclusion lists, the paths and database tables a run must never touch, to every tool, including a bundled scanner that crawls the site on its own. Code review on June 11 found the crawler and attack phases of OWASP ZAP, the open-source scanner StackBadger orchestrates, still reaching excluded paths, and a second round made ZAP's exclude patterns match from the start of a path and ignore capitalization.
  • Resolve the target once and confirm the host the operator typed, so every safety check agrees on the site being tested. Two more June 11 review fixes did this: the gate now checks the host given on the command line, before a redirect can send the client elsewhere, and the effective target, the host actually under test, is worked out once so every later check reads the same value.

PROJECT DESIGN

How it works.

Layered CLI pentest harness — profile-driven, pluggable adapters, dual reports
CLI / orchestration
run.sh (preflight, sign-in, mode gating)Agent runbook (LAUNCH.md)CONFIRM_TARGET / CONFIRM_AUTHORIZED gates
Discovery / profiles
discover.py — black-box stack fingerprintingprofile.py + profile_assembler.py (YAML + live discovery)
Auth adapters
AbstractAuthAdapter baseClerkFirebaseSupabase GoTrueNextAuth
Attack modules
23 test categories — auth bypass, IDORRLS / Firestore / storage misconfigInjection, webhook spoofing, file upload
Reports
pytest JSON + ZAP XML → HTML + agent JSONTwo-layer secret scrubbing

Key modules

Engine

Discovery engine

Fingerprints a target's auth/DB/storage stack from live bundles or source.

Auth

Auth adapter factory

One abstract base with four pluggable provider sign-ins.

Profiles

Profile loader

Merges live discovery with optional YAML overrides into a runtime profile carrying no pre-authored secrets.

Attacks

Attack suite

23 test-category modules today (13 at release), among them auth bypass, IDOR, RLS/storage misconfig, injection, webhook spoofing, file upload.

Reporting

Secret scrubber

Two-layer redaction strips seeded credentials, then Bearer/JWT/cookie patterns, before any report is written.

CLI

Run orchestrator

A bash driver that runs preflight, signs in, gates write probes, scans, and aggregates the reports.

SECURITY & OPERATIONS

Security and operations.

Safe-by-default probe gating
Probe run
Read-only by default — no writes happen unless you ask
Write probes require the --full flag plus an explicit @pytest.mark.write_probe marker on the test
CONFIRM_TARGET and CONFIRM_AUTHORIZED gates enforced in run.sh for any host other than localhost, plus a doctor.py preflight check
exclude_paths / exclude_tables on by default across every probe seam
  • Read-only probing is the default; write probes require both a command-line flag and an explicit per-test marker.
  • Twin confirmation gates — CONFIRM_TARGET and CONFIRM_AUTHORIZED — plus a preflight doctor check stand between the operator and any probe against a host other than localhost.
  • Written authorization is a stated precondition in the security policy, not a footnote.
  • Exclusion paths and tables are on by default across every probe seam, tightened through two rounds of code review.

BUILDER NOTES

Builder notes.

  • 23 test categories: auth bypass, IDOR, RLS bypass, storage, webhook spoofing, injection, file upload abuse, and more.
  • Four auth adapters behind a shared abstract base and factory registry.
  • Stack fingerprinting works black-box from a URL or white-box from source, and the README documents what it deliberately can't detect — pinned by a test.
  • Dual report output: HTML for humans, JSON for agents, with an evidence-scrubbing layer.

WRITING

Field notes from this work.

Full build narrative

A black-box security test harness for AI-built apps: point it at a deployed product and it probes authentication, data access, and payment webhooks the way an outside attacker would, then writes up the findings. 23 test categories plus an orchestrated ZAP scanner, all driven by a small profile that describes the target's stack.

Born inside TariffRefunded as an internal weapon, then generalized: five login providers researched beyond the original Clerk, four auth adapters shipped behind one shared abstract base class. Published by following a manual export checklist: archive only tracked files, scrub every brand reference, decode anything credential-shaped to prove it's synthetic, start a fresh repository.

Trust belongs in the schema, not the application.
The operating principle behind every project here. A rule the database enforces can't be forgotten in a hurry. Constraints, denied-by-default access, append-only logs — the controls that hold are the ones the system won't run without.