Case Files

Fourteen security projects and the mechanism behind each one. Every detection, fix and benchmark below was run, and the output shown is what it printed.

Each case covers what the project is, how it works, the evidence it produced, and the judgment calls to be ready to defend in an interview.

cases across 6 repos
14
run in full, output captured
10
tests passing in 7 tools
520
live SIEM dashboard
1

[sync] matches the Security chapter of battlettt.github.io6 of 6 entrieschecked 2026-11-15

Case index

Standalone tools

Built after the portfolio repo, each in its own repository with releases, CI or a test suite of its own.

battlettt/sentinelscan

SentinelScan

AppSec. Chrome extension, Manifest V3, v1.1.

[part] tests verified, live scan pending
  • TypeScript
  • React
  • MV3
  • Vitest
Resume line

Built SentinelScan, a Manifest V3 Chrome extension that grades a website's security posture on demand: header and CSP analysis, a JS-source secrets scanner (9 key formats plus Shannon-entropy detection), Subresource Integrity checks and local drift detection between visits, with every finding mapped to MITRE ATT&CK and covered by 42 unit tests. Nothing leaves the browser.

What it is

A Chrome extension that gives the site in your current tab a security report card when you click it. It runs entirely client-side: no server, no analytics. The only permission that touches pages is activeTab, so it reads a site only when you deliberately scan it, and never in the background.

The five checks

  • Headers and config. CSP quality rather than mere presence, HSTS, frame protection, X-Content-Type-Options, referrer and permissions policy, mixed content, and cookie Secure/SameSite flags. Each finding ships with a paste-ready Express and Nginx fix.
  • Secrets in served JavaScript. Nine known key formats (AWS, Stripe, Slack tokens and webhooks, Google, GitHub, JWTs, private-key headers), plus Shannon entropy over quoted strings 20 to 80 characters long. A string at 4.0 bits per character or more is reported as secret-shaped.
  • Supply chain. Cross-origin scripts loaded without an integrity hash, the gap behind Magecart-style skimming such as the 2018 British Airways breach.
  • Drift. Each scan is stored locally and compared with the previous scan of the same domain. Lost headers, new secrets, new SRI gaps and a lower grade each raise their own finding.
  • ATT&CK mapping. Missing CSP maps to T1189 Drive-by Compromise, missing HSTS or mixed content to T1557 Adversary-in-the-Middle, missing frame protection or SameSite to T1185 Browser Session Hijacking, and missing SRI to T1195 Supply Chain Compromise.

How the grade is computed

One shared scale, so the popup, the toolbar badge and drift detection can never disagree about what a grade means:

src/detectors/headerAnalyzer.ts (excerpt)
weights: high 25  medium 12  low 5  info 2
score  = max(0, 100 - sum of weights)
A+ >= 95   A >= 85   B+ >= 75   B >= 65
B- >= 55   C >= 45   D  >= 30   else F

The bug the unit tests could not see

Live testing in Chrome found problems that 42 passing tests never exercised. The first two were a background-fetch permission issue and unhandled chrome:// pages. The third was a scan that never finished on real sites. Two fixes addressed genuine problems (sequential script fetches with no timeout, then a timeout that stopped at the response headers and left the body read unguarded) but neither changed the symptom.

Instead of a third guess, the extension's Errors panel gave the answer:

chrome://extensions, SentinelScan, Errors
Service worker registration failed. Status code: 15
Uncaught SyntaxError: Cannot use import statement outside a module

Vite had split a shared module into its own chunk, so background.js started with an import. Chrome rejects that unless the manifest declares the worker as a module, so the background script had never run at all. The fix was one line: "type": "module" on background.service_worker. The earlier timeout work stayed in: parallel fetches, a 6-second abort covering request and body, and a 25-script cap.

> talking point

This is the debugging story to tell. Two reasonable fixes in a row did nothing, which was the signal to stop patching and collect evidence. The patched code had never executed. Passing unit tests and a working extension are separate claims, and a packaging problem like a manifest field is invisible to Vitest.

! limitation

The build log does not yet record a clean end-to-end scan of a real site after the manifest fix, and the extension is not on the Chrome Web Store yet (it needs a developer account). The 4.0-bit entropy rule also catches some ids and hashes, which is why those findings are medium severity and worded as a prompt for a manual look.

battlettt/porthawk

Porthawk

Network scanning. Go command-line tool, v1.3.

[ok] verified
  • Go
  • stdlib only
  • TLS
  • fuzzing
Resume line

Wrote Porthawk, a concurrent TCP port scanner in Go with zero dependencies: a bounded worker pool with an optional rate cap, banner-based service and version detection, TLS probing that records protocol, cipher and certificate health, and JSON scan diffing that flags new or changed services; 47 unit tests and 3 fuzz targets run in CI with the race detector.

What it is

An attack-surface inventory for networks you own. Give it hosts, CIDR blocks or ranges and it lists every listening service, names it from the banner it sends, and can compare this week's scan with last week's. Its use cases are defensive: finding a forgotten service, checking that firewall rules block what they should, and spotting expired certificates.

How a scan runs

  • Bounded concurrency. Host and port pairs go onto a jobs channel served by a fixed pool of workers (100 by default). -rate adds a ticker so at most N connection attempts go out per second, for fragile devices like printers and cameras.
  • Probe and identify. A TCP connect with a dial timeout (2s by default) records the handshake latency, then reads a short banner. The banner names the service (SSH, HTTP, SMTP, FTP, MySQL, Redis, VNC and others) and, where it says so, the software version.
  • TLS ports. On 443, 465, 636, 853, 990, 993, 995, 6697 and 8443 it completes a handshake first and records the protocol version, cipher, certificate subject and issuer, validity dates, and whether the certificate is expired, self-signed or mismatched to the host.
  • Change detection. -diff reads an earlier JSON scan, matches results by host and port, and reports what opened, closed or changed. Ports an interrupted scan never reached are reported as closed with a warning, so a partial run cannot pass as a clean one.
  • Guard rails. Banners are reduced to one printable line with all control characters removed before display, and a single scan is capped at 65,536 hosts to prevent accidents.

Sample output (from the README)

$ ./porthawk -t 127.0.0.1,localhost -p 2222,8080,8443,9
porthawk: scanning 2 host(s) x 4 port(s) with 100 workers
HOST       PORT  SERVICE                               TLS   LATENCY
127.0.0.1  2222  ssh (OpenSSH_9.6p1 Ubuntu-3ubuntu13)  -     1.07ms
127.0.0.1  8080  http (SimpleHTTP/0.6)                 -     0.30ms
127.0.0.1  8443  https                                 1.2!  0.80ms
porthawk: 3 open port(s) found in 6ms

The ! after the TLS version marks an expired certificate. A week later, the same command with -diff scan.json reports one service opened, one closed and two upgraded, listing each changed field with its old and new value.

Testing

CI runs go vet, the full test suite, the suite again under -race, and three fuzz targets (FuzzParsePorts, FuzzParseTargets, FuzzCleanBanner). The suite passed again on 2026-10-25 for this page.

> talking point

Fuzz the parsers, not the network code. Port lists, target specs and banners are the three places where untrusted or user-typed text enters the program, so those are the fuzz targets. The rest is covered by unit tests against local listeners, which keeps the suite fast and deterministic.

! limitation

TCP connect scans only. SYN and UDP scanning need raw sockets and root. A service that sends nothing on connect is named by its port number alone, or listed as unknown.

battlettt/authlog-sentinel

AuthLog Sentinel

Detection. Go command-line tool, v1.

[ok] verified
  • Go
  • stdlib only
  • SSH
  • JSON
Resume line

Built AuthLog Sentinel, a zero-dependency Go CLI that parses Linux SSH auth logs and ranks likely brute-force and credential-stuffing sources: per-IP sliding-window analysis, a hand-checkable score (failures + 3 × distinct usernames), duplicate-line handling for sshd's double logging, text and JSON reports, and commented-out iptables/nftables suggestions that never auto-apply, covered by 46 unit and CLI tests.

What it is

A read-only analyzer for /var/log/auth.log, /var/log/secure or journalctl output in syslog format. It groups SSH login failures by source IP, ranks the IPs by a score you can check by hand, and calls out any flagged IP that also logged in successfully. It never touches the firewall, never writes to a system file and makes no network calls.

How detection works

  • Parsing. Five sshd line shapes are recognized. Failed password, failed publickey and invalid-user lines count as failures. Preauth disconnects and accepted logins are kept as context columns. Timestamps can be traditional syslog or RFC 3339. Syslog has no year, so a date more than two days in the future is moved back a year, which handles December logs read in January.
  • One attempt, counted once. sshd often writes both an "Invalid user" line and a "Failed password for invalid user" line for a single attempt. The two are merged when they share an IP and source port within 10 minutes, so stuffing runs are not double-counted.
  • Sliding window. Each IP's failures are sorted by time and a window (60 minutes by default) slides over them. The report shows each IP's worst window, while the TOTAL, PREAUTH and ACCEPTED columns cover the whole input.
  • Score and flag rule. Score is failures + 3 × distinct usernames. An IP is flagged when one window reaches 10 failures, 5 distinct usernames or a score of 25, and the REASONS column names which rule tripped.
  • Hostile input. Usernames are chosen by the attacker, so the text report escapes non-printable characters and quotes names containing spaces or commas. Malformed lines are counted and skipped, never fatal.

Captured output

$ ./authlog-sentinel examples/sample-auth.log (run 2026-11-01, columns cut at USERS)
Lines:      150 read, 137 sshd auth events, 9 ignored, 4 malformed (skipped)
Flag rule:  failures >= 10 OR distinct users >= 5 OR score >= 25

FLAGGED IPs (3), worst first
RANK  IP                     SCORE  FAILS  USERS
1     203.0.113.77           48     12     12
2     198.51.100.23          28     25     1
3     2001:db8:dead:beef::7  14     11     1

WARNING: flagged IP 198.51.100.23 also has 1 accepted login(s); investigate for possible compromise.

The username weight is why the stuffing run ranks first: 12 attempts across 12 usernames scores 48, while 25 guesses at root scores 28. The sample also hides a slow brute force, 198.51.100.200, guessing once every 7 minutes. It never reaches 10 failures in any 60-minute window (44 over the whole log), and rerunning with --window 2h flags it with 18 failures and a score of 21.

Read-only by design

--blocklist prints the flagged addresses and example iptables and nftables rules, every rule commented out. A flagged IP can be a shared NAT or VPN exit, your own monitoring host, or a colleague with a stale saved password, so applying a block stays a human decision. The README points to the durable fixes instead: disable password authentication and root login, and use keys or MFA.

Testing

46 tests (33 top-level, 13 subtests) cover the parser, analyzer, reports, blocklist and end-to-end CLI runs. go vet is clean, and the suite passed again on 2026-11-01 for this page. The sample log is synthetic and uses only documentation IP ranges (RFC 5737 and RFC 3849).

> talking point

This is the production-shaped successor to Project 5's Python detector: the same per-IP sliding window, plus a username dimension, duplicate-line handling, IPv6, JSON output and a worst-window report. The ACCEPTED column is the signal to lead with. A flagged IP with an accepted login is an incident to investigate, not just an address to block.

! limitation

Batch only: it reads the files it is given and exits, with no live tailing. Grouping is per IP, so an attack spread across many addresses that each stay under the thresholds is not correlated. The thresholds are defaults, not a calibrated baseline, and hostnames in from fields (sshd with UseDNS yes) are counted as malformed rather than resolved.

battlettt/phishlens

PhishLens

Email forensics. Python command-line tool, v1.0.

[ok] verified
  • Python
  • stdlib only
  • headers
  • URLs
Resume line

Built PhishLens, a zero-dependency Python CLI that turns pasted email headers and links into a plain-English verdict (looks safe, suspicious, likely phishing) with ranked reasons: SPF, DKIM and DMARC reported separately with alignment to the From domain, display-name and look-alike domain spoofing, Received-chain anomalies, forged "pass" headers, and lexical URL checks; it makes no network or DNS calls, stores nothing and defangs every URL, enforced by 79 tests.

What it is

A triage tool for the question "is this email real?" Paste the headers from "Show original" (or a single link) and it answers with one of three verdicts, the reasons ranked by severity, and what to do next. It works only on the text it is given: it never opens a mailbox, never fetches a link and never looks up a domain.

How a verdict is built

  • Sender identity. It parses From, Reply-To, Return-Path, Message-ID and the Received chain, then checks whether those agree: a Return-Path on another domain, replies routed to a free mailbox, a display name claiming a brand the address does not belong to, and look-alike or IDN domains checked against 22 commonly impersonated brands.
  • Authentication, read not redone. SPF, DKIM and DMARC come from the Authentication-Results the receiving server already wrote, and each is reported on its own with whether it is aligned to the From domain (relaxed, by organizational domain). Nothing is looked up again.
  • Contradictions. A lower "pass" header that disagrees with the receiving server's own result, a DMARC pass for a different domain, or Received-SPF disagreeing with the results are each a finding, because a sender can add headers but cannot change the ones written after it.
  • Links. Every link in a pasted body is checked lexically: punycode and homographs, credentials before an @, IP-literal hosts in decimal, hex or octal form, shorteners, link text naming a different site than the target, brand-as-subdomain decoys, unusual ports and javascript: or data: schemes.
  • Scoring. Any HIGH finding, or enough smaller ones together, gives LIKELY PHISHING; a couple of warning signs give SUSPICIOUS. Context that is normal for real mail, such as a newsletter whose Return-Path belongs to its email service but which still passes DMARC, is listed as "also noted" and does not count against the message.

Captured output

$ python -m phishlens --headers examples/phishing-headers.txt (run 2026-11-04, 5 of 10 finding titles shown)
VERDICT: LIKELY PHISHING
  SPF:   FAIL
  DKIM:  NONE
  DMARC: NONE
  1. [HIGH] The sender's name claims to be PayPal, but the address is not PayPal's
  2. [HIGH] The From domain imitates PayPal
  3. [HIGH] A link in the message is dangerous
  6. [MEDIUM] Authentication results contradict each other
  7. [MEDIUM] Replies would go to a different address than the sender

$ python -m phishlens --headers examples/legitimate-headers.txt
VERDICT: LOOKS SAFE
  SPF:   PASS (aligned)
  DKIM:  PASS (aligned)
  DMARC: PASS

The phishing sample produces 10 findings (3 HIGH, 6 MEDIUM, 1 LOW). Both samples are made up for the project and ship as the built-in --demo. Every URL and domain in a real report is printed defanged (hxxps://example[.]com), so nothing in the output is clickable. The demo page is a static showcase of these two runs, not a live analyzer.

Safe by construction, enforced by tests

The safety claims are tests, not promises. One test replaces the socket connect, connection and DNS functions with ones that fail, then runs the demo and a set of tricky links. Another runs the CLI in an empty temporary directory and asserts the directory is still empty afterwards. A third scans the package source for network, mail, logging, database and file-writing code. A fourth checks every report for live links.

Testing

79 pytest tests: 39 for header parsing and spoofing, 27 for URL tricks and 13 for the CLI and the safety rules. Analysis uses only the Python standard library (3.11 or newer), and pytest is the only extra. The suite passed again on 2026-11-04 for this page.

> talking point

"SPF passed" on its own says little. SPF checks the envelope sender, which the attacker chooses, so a phishing email can pass SPF for its own throwaway domain. What protects the address a reader sees is alignment: did SPF or DKIM pass for a domain matching the From header? That is why PhishLens reports all three results separately with alignment, and why it trusts only the topmost Authentication-Results written by the receiving server.

! limitation

It judges only what is pasted. A fully authenticated email from a domain the attacker owns can still be a scam, and the look-alike checks cover a built-in list of brands. Organizational domains come from a small built-in suffix list rather than the full Public Suffix List, and shortened links are flagged but never expanded, because expanding them means visiting them.

battlettt/plugin-warden

Plugin Warden

Supply chain. Python command-line tool and Claude Agent SDK agent, v0.3.

[ok] verified
  • Python
  • Claude Agent SDK
  • Semgrep
  • Gitleaks
Resume line

Built Plugin Warden, a Python CLI and Claude Agent SDK agent that audits a Claude Code plugin, skill pack or MCP server repository before install: 131 static checks across 18 threat categories plus Gitleaks, OSV-Scanner and Semgrep, a deterministic risk score, and a read-only triage agent that confirms or dismisses each finding with a cited reason and reports what the rules missed; on 4 real repositories (1,912 files) it triaged 131 findings for $2.11, sandboxed by a realpath path guard. v0.2 adds a TOML policy with pinned approvals, a CI gate with SARIF output, a nightly diff of approved plugins against upstream, hashed and optionally HMAC-signed audit evidence packs, and a public registry of 63 tracked repositories. v0.3 detects all 78 malicious samples in a published benchmark while keeping 14 ordinary plugins at low risk, and documents what it cannot catch; 287 offline tests.

What it is

A pre-install audit for Claude Code plugins. Installing a plugin runs someone else's code with your full user access: hooks fire on session start and on every tool call, MCP and LSP servers start as background processes, and skills are instructions Claude follows. Claude Code's permission rules and Bash sandbox govern only Claude's own tools, so hooks, MCP servers, LSP servers, monitors and status-line commands all run outside them. Plugin Warden answers three questions before you install: what would run and when, what in it could hurt you, and how to contain it if you still want it.

How a scan runs

  • Inventory. It clones the repository (or reads a local folder or a marketplace entry) and maps everything Claude Code would load from it: hooks and their triggers, MCP and LSP servers, monitors, skills, agents and commands. Then it traces which scripts each automatic entry point calls.
  • 131 checks. 71 line rules, 50 structural checks and 10 secret patterns across 18 categories, plus Gitleaks, OSV-Scanner and Semgrep. Structural checks read configuration rather than lines: a PreToolUse hook that matches every tool, an MCP server launched with an unpinned npx -y, a symlink that points out of the repository, a file that reads credentials and also makes network calls.
  • Context levels. The same pattern means different things in different places, so severity shifts with where a match sits: +1 in code that runs on its own, 0 in components and the code they call, -1 in code nothing reaches, and -2 in tests, docs and CI. External scanner hits get the same treatment.
  • Agent triage. An Agent SDK agent reads each automatic entry point, follows what it calls, records a confirm or dismiss verdict with a cited reason for every medium-or-higher finding, and reports risks the rules missed. A new finding is accepted only if its quoted code really appears within five lines of the file and line it cites.
  • Troubleshooting chat. A multi-turn session over the report and the repository. It answers with the file and line, who can fix the problem (the plugin author or you), and a validated settings.json fragment.

Coverage in v0.3, measured

v0.3 added 30 checks and a written threat matrix covering 27 areas, from exfiltration and credential theft to surveillance, sandbox-detecting triggers, tampering with other plugins, and destructive encryption. Two of the new checks are structural: a dependency name one edit away from a popular npm or PyPI package, and a file that walks the disk, encrypts and replaces what it finds.

benchmark setsamplesresult
Malicious techniques7878 detected, 70 at review or block
Ordinary plugins14all 14 low risk
Known misses6documented, each asserted to stay below review

The benchmark is a test file, so a change that loses a detection, raises an ordinary plugin to review, or quietly starts catching a listed miss fails the build. The eight detections below review are techniques that are common in honest plugins on their own, such as telemetry or a detached process, so they ask for caution rather than a block.

A noise check over the 21 plugin versions installed on the author's machine found one false positive (a JavaScript variable named nc read as netcat), fixed before release. That is one machine, not a labelled data set, so no precision figure is claimed. The new line rules first doubled scan time on those plugins (35 s to 82 s); literal pre-filters brought it to 61 s, with a test that a pre-filter never hides a match.

How the verdict is computed

The score comes from the findings with fixed weights, never from the model's opinion:

src/plugin_warden/verdict.py (summary)
weights: critical 40  high 15  medium 5  low 1
score  = min(100, sum above low + min(lows, 10))
any critical                 -> Do not install
any high, or score >= 40     -> Review before installing
any medium, or score >= 10   -> Install with precautions
otherwise                    -> Low risk

The cap on low findings came from a real run: 67 low-severity matches in an installed design-skills plugin had pushed it to "Review" on their own. Capped at 10 points, lows can reach "Install with precautions" but never more.

Captured output

The repository ships a deliberately malicious demo plugin, generated at test time so its fake credentials never sit in git. It calls itself claude-official-tools and claims to format code. Its session-start hook fetches and runs a remote script, uploads ~/.ssh, and adds a shell-profile line that survives uninstall, and a second hook approves every tool call.

$ uv run warden scan /tmp/evil-plugin (run 2026-11-07, trimmed)
Static scan: 9 files, 21 findings, 4.6s
Agent review with claude-opus-5-5 (effort high, budget $5.00)
  agent: read scripts/setup.sh
  agent: read scripts/approve.js
  agent: verdicts 21 confirmed
  agent: new finding  Plugin description 'Formats code.' hides credential
         theft, RCE and permission bypass at .claude-plugin/plugin.json:4
  agent: new finding  Remote script output from SessionStart hook flows
         into Claude's context at scripts/setup.sh:2
Agent: 21 findings reviewed, 2 new, 17 turns, $0.22, 64.8s

 DO NOT INSTALL  risk score 100/100
 9 critical  8 high  3 medium  3 low
 Prompt-injection text found: agent dismissals of serious
 findings are ignored in the score.

One chat question then asked how to keep only the format skill. The answer ($0.12, 32 seconds) explained that enabledPlugins has no per-component switch, that disableAllHooks also turns off your own hooks and still leaves the MCP server running, and that permission deny rules cannot reach a hook or an MCP process. The only complete control is not enabling the plugin, followed by the cleanup steps if it was ever enabled.

Results on real plugins

targetfindingsconfirmed / dismissed / newverdict (score)cost
Demo malicious plugin2121 / 0 / 2Do not install (100)$0.22
obra/superpowers142 / 12 / 2Low risk (3)$0.47
Vercel plugin 0.43.05713 / 43 / 1, 1 needs reviewPrecautions (10)$0.76
wshobson/agents, 92 plugins398 / 31 / 2Precautions (14)$0.66
Total, 1,912 files13144 / 86 / 7$2.11

Every run used claude-opus-5-5 at effort high, none reached the $5 default budget, and each recorded its auth source as ANTHROPIC_API_KEY. What the agent found beyond the rules: on wshobson/agents, two hooks that fire on every tool call pass the full tool input on the command line, where any local process can read it with ps, and a review gate that a ./.review-approved file skips entirely. On superpowers, an opt-out usage ping through a vendor-hosted logo, and a Gitleaks "secret" it identified as the public RFC 6455 sample WebSocket key. On Vercel, it dismissed 43 matches with cited reasons, most of them maintainer tooling the plugin never runs.

A static-only pass over all 18 plugins installed on the author's machine (3,534 files) took 2 min 37 s: 12 low risk, 4 install with precautions, 2 review, and no critical findings.

The agent is sandboxed from what it reads

The agent spends its whole run reading text written by whoever published the plugin, so the repository is treated as hostile:

  • No inherited config. setting_sources=[] keeps the repository's .claude/settings.json, hooks and CLAUDE.md from loading, and strict_mcp_config=True ignores any .mcp.json it ships.
  • Read-only tools. Only Read, Grep and Glob plus Warden's own in-process tools, with permission_mode="dontAsk" and an explicit disallowed list: no shell, no writes, no web.
  • Path guard. A PreToolUse hook resolves every path with realpath and denies anything outside the scan root, so a symlink in the repository that points at a private key cannot be followed. Glob patterns containing .. or ~ are refused.
  • Injection guard. If the static rules find text aimed at a model (instruction overrides, concealment, hidden Unicode, hidden comments), the agent's dismissals of high and critical findings stop counting in the score.
  • API key only. Other credential sources are blanked in the agent's environment, and each run records the auth source the CLI reports.

Policy and CI gate

v0.2 turns the scanner into something a team can enforce. One TOML file in git, warden-policy.toml, says which plugins may be enabled, and warden check evaluates it in CI. Everything runs in the team's own repository and pipeline. There is no Plugin Warden server.

  • Two modes. In allowlist mode only plugins with an [[allow]] entry may be enabled. In threshold mode any plugin may be enabled while its scan stays inside the limits (worst accepted verdict, denied categories and rules).
  • Pinned approvals. An approval names the commit that was reviewed, who approved it and why. When it matches the scanned commit it stands in for the thresholds: a person read exactly that code, so the scan verdict does not overrule them. Deny entries still win over any approval.
  • Drift. When upstream moves, the approval stops matching and the check fails with COMMIT-DRIFT until someone looks at the diff and approves the new commit.
  • Exceptions. An exception accepts one rule or category for one plugin. It must carry a reason and an end date, and after that date it stops applying.
  • Fails closed. The check resolves each enabled plugin to its repository through the project's settings. Anything it cannot resolve or fetch is a failure, never a pass.
  • Your own config too. It also scans the project's own .mcp.json and the hooks in its settings, judged by the thresholds alone.

Exit code 0 means everything enabled is allowed, 1 means something is not, and 2 means the policy is invalid. --sarif writes SARIF 2.1.0, so on GitHub a failure appears on the settings line that enabled the plugin.

Watching updates

warden watch asks each approved repository for its current commit with git ls-remote, without cloning. If the commit moved, it scans both the approved commit and the new one and compares the two reports. Findings are matched by rule, file and code rather than by line number, so code that only moved is not reported as new.

levelraised when
alertA new hook, monitor or server, a new high or critical finding, or a worse verdict
noticeNew network hosts, new credential-like environment variables, or new lower-severity findings
noneNothing the scanner tracks changed

Evidence packs

warden evidence writes a folder and a zip for an auditor: the policy as enforced, the decision for every enabled plugin, the scan behind each decision, a readable summary, and a manifest with the SHA-256 of every file. With a key set, the manifest is also signed with HMAC-SHA256. Local paths are scrubbed, because a pack is handed to outsiders. --verify reports any file that changed, went missing or was added.

The summary lists where teams commonly map this in SOC 2 and ISO/IEC 27001, but that mapping is the team's to make with its auditor. Plugin Warden does not certify compliance.

The public registry

The same scans feed a public registry of well-known plugin, skill and MCP server repositories. The first full run on 2026-11-14 used static checks only and scanned 62 of 63 repositories (one fetch timed out), reading 55,205 files. It found 164 components that run on their own in 21 repositories, 64 background processes in 18, and 359 distinct network hosts named in code. It also produced 3,022 rule matches, which are waiting for review and are not published.

Two rules decide what the registry shows, and both exist to be fair to the people whose code is listed:

  • A static-only scan gets no verdict and shows no findings. Rule matches are leads: on the four repositories above the agent dismissed 86 of 131. Without a completed agent review, an entry shows what the code does and a count of matches waiting for review.
  • Serious findings wait for the maintainer. Confirmed high and critical findings are withheld until the maintainer has been notified and 30 days have passed, or until a fix ships.

The registry site went live on 2026-11-15 at battlettt.github.io/plugin-warden. A nightly workflow rescans every repository whose upstream commit moved, so its counts change. On its first deployed run it tracked 63 repositories.

The stored records in git follow the same two rules and keep no code snippets, because a snippet can carry credentials copied from the scanned repository.

Bugs the real runs surfaced

  • Secrets in the report. MCP server env and headers values were copied into the component details, so a token in a plugin's config would have appeared in the report. They are now redacted unless they are ${VAR} references.
  • Config writes assembled in pieces. A path to ~/.claude/settings.json built from separate parts slipped past every line rule. A file-level check now looks for the pieces of a Claude config path together with a write operation.
  • Scanner noise. Gitleaks raised 26 hits in one repository's tests. External hits now go through the same context levels, generic secret rules are medium, and a match is shown only when the scanner redacted it.
  • A timeout that took the batch down. During the registry run, one git fetch timed out and crashed the whole batch. A timeout is now an ordinary target error, and the other repositories carry on.
  • Quadratic matching on minified code. Line rules were quadratic on minified bundles: a single 900 KB line took minutes. Minified files are now matched per statement, with a bounded window as the fallback.
  • Snippets in public data. Registry data first stored raw rule-match snippets from third-party repositories. It now stores only public-safe records, with no snippets.

Testing

289 tests: 287 offline in about 11 seconds, and 2 live. The offline suite drives the agent with a scripted fake and covers target parsing and unsafe-URL rejection, every rule family, context levels, scoring and the injection guard, HTML escaping, secret redaction, the agent's tool validation and path guard (symlink escapes, .. and ~), the API-key-only environment, the chat and the CLI. For the team features it covers policy parsing and every violation code, pinned approvals, exceptions and their expiry, marketplace resolution, fail-closed behavior, SARIF locations, report diffing (including code that only moved), the update watch, evidence pack signing, tamper detection and path scrubbing, the registry's publication rules, the generated site (every page built, repository text escaped, no third-party resources), and in v0.3 a matching line and a near miss for every new rule, a bounded-time check on minified bundles, and the benchmark above. The live tests run the real agent and chat against the demo plugin. CI runs ruff and the offline suite on every push, and the offline suite passed again on 2026-11-15 for this page.

> talking point

The model never sets the score. It can move the verdict only by confirming or dismissing a finding with a cited reason, or by adding one whose quote is checked against the file. When the repository contains text aimed at a model, its dismissals of serious findings stop counting. That is what makes it safe to point an LLM at hostile text: the worst a successful injection can do is suppress new findings, not clear a malicious plugin.

! limitation

Static analysis reads code without running it, so behavior assembled at run time (downloaded code, values from a server, heavy obfuscation) may only show up as "makes network calls" or "decodes and runs data". The agent works within a budget, and the report says when it stopped early. Precautions have real limits too: permission rules and the sandbox do not cover hooks, MCP servers, LSP servers, monitors or status lines, so for those the only complete control is not enabling the plugin. A clean report means the checks that ran found nothing, not that the plugin is safe.

The registry is early. The site is live, but at the last check only one entry (obra/superpowers) had a completed agent review, and the paid review plans and four pilot services on its pricing and services pages have no customers yet. The coverage page lists ten kinds of attack a static scanner cannot catch, including commands assembled from pieces and code fetched at run time.

Cybersecurity Portfolio

Nine projects in one repo, numbered as they are there, from application security through detection, cloud and GRC.

01 01-vulnerable-web-app

Vulnerable-to-Secure Web App

AppSec. Flagship.

[ok] verified
  • React
  • Express
  • MySQL 5.7
  • bcrypt + JWT
Resume line

Built and exploited a full-stack React/Node/MySQL application demonstrating 4 OWASP Top 10 vulnerabilities, then remediated each with parameterized queries, output sanitization, bcrypt password hashing, and JWT-based authorization, documenting the full attack-and-fix lifecycle with live exploit scripts and screenshots.

What it is

A movie-review app built twice: a vulnerable branch (ports 4000/5173) and a secure branch (4001/5174). Every test is run against the first, then rerun unchanged against the second to prove it now fails.

The four flaws and their root causes

  • SQL injection. The login query was built by concatenating user input into SQL text, so input could change the query's structure and skip the password check.
  • Stored XSS. Review text was saved unsanitized and rendered with dangerouslySetInnerHTML, so markup in a review ran for every visitor.
  • Broken authentication. Passwords were stored and compared in plaintext, and the server returned a user object the client was trusted to keep.
  • Broken access control. The admin endpoint trusted an x-role header the client set itself, and review deletion had no ownership check (an IDOR).

The fixes, and why each closes the whole class

  • Parameterized queries. SQL text goes to MySQL with ? placeholders and values travel separately as data, so input can never become syntax.
  • bcrypt (cost 12) and a signed 2-hour JWT replace plaintext comparison and the honor-system user object.
  • Two XSS layers. sanitize-html strips tags on the server, and the client renders review text as plain text, which React escapes by default.
  • A real requireAuth middleware verifies the JWT and attaches the verified identity. Delete now checks review.author_id === req.user.id || req.user.role === 'admin' from that identity, never from anything the client claims.

Evidence after the fix

same test requests against the secure branch
POST /api/login        (injection test)
HTTP 401 {"success":false,"message":"Invalid credentials"}
GET  /api/reviews/search  (injection test)
[]  (0 rows, no error)
GET  /api/admin/users  -H "x-role: admin"  (no token)
HTTP 401 {"error":"Missing token"}

All 8 before-and-after screenshots come from one scripted Playwright walkthrough (capture_exploits.js and capture_fixes.js). The same script runs on both branches, which is part of the proof that the fixes hold.

> talking point

"Why parameterized queries and not escaping?" Escaping is a blocklist of dangerous characters, and blocklists keep missing cases. Parameterization is structural: the database receives the query and the values through separate channels, so it closes the vulnerability class rather than the inputs you thought to block.

02 02-sql-injection-lab

SQL Injection Lab

AppSec. Focused lab.

[ok] verified
  • Express
  • MySQL
  • Python
Resume line

Demonstrated and remediated classic, UNION-based, and blind SQL injection against a live MySQL-backed Node.js application using automated Python exploit scripts; root-caused the flaw to string-concatenated queries and secured it with parameterized queries, verifying all three attacks failed post-fix.

What it is

A small companion to Project 1, built only for this: two endpoints (/login and /search), a seeded MySQL database with 10 users and 10 products, and one Python script per injection class. Passwords are stored as SHA-256 hashes here, a deliberate realism choice that differs from Project 1.

Three classes, three different signals

  • Classic. Input that ends the string early removes the password condition from the login query. Same root cause as Project 1.
  • UNION-based. A product search can be made to return rows from the users table, data the endpoint was never meant to touch.
  • Blind. No rows or errors come back, only a true/false difference in the response (or its timing). The script recovered the first 16 characters of the admin hash this way, matching the real value exactly. Binary search on each character's code took 105 requests in total.

After the fix

With parameterized queries all three return the same empty result: 0 rows on the UNION test, an empty prefix on the blind test and no timing difference. The input is inert data with no query structure left to change.

> talking point

Blind injection is the one to explain slowly. It shows why "we never display database errors" is not a defense: a single yes/no signal, asked enough times, still leaks exact values. Binary search needs about log2(charset) requests per character instead of one per possible character, which is why it took 105 requests for 16 characters. The only real fix is the structural one.

03 03-network-anomaly-detector

Network Traffic Anomaly Detector

Detection. Statistics applied to security telemetry.

[ok] verified
  • Python
  • Scapy
  • scipy.stats
  • matplotlib
Resume line

Developed a Python-based network anomaly detector applying statistical hypothesis testing (z-score baseline deviation across Poisson- and Normal-fitted traffic features) to identify port-scan and data-exfiltration patterns, achieving 100% recall / 80% precision (2.8% false positive rate, F1 = 0.889) on a labeled synthetic dataset (500 one-second windows, held-out evaluation).

What it is

Fit a baseline distribution to normal traffic, then flag deviations with a formal hypothesis test: the one-sample z-test from intro stats, pointed at security telemetry instead of a survey sample.

Why the traffic is simulated

Live capture needs root (macOS BPF devices are root-only), which the build environment did not have:

$ checking live capture
>>> scapy.all.sniff(timeout=5, count=20)
Scapy_Exception: Permission denied: could not open /dev/bpf0.

So capture.py builds real Scapy packet objects (sizes come from len(bytes(pkt)), not constants) without putting them on the wire. Baseline arrivals follow a Poisson process. The simulated scan is a 5-second burst of about 400 small SYN packets, and the simulated exfiltration is a 15-second run of near-MTU outbound payloads.

The method

The baseline is fit on the first 300 seconds only, which are normal by construction. Everything from t=300s on is held out. Each feature gets its own distribution:

  • packet_count is Poisson, tested with z = (x - λ) / √λ.
  • unique_dst_ports and mean_pkt_size are Normal, fit by MLE with scipy.stats.norm.fit and justified by the CLT.

A window is flagged if any |z| exceeds 2.576 (two-tailed, α = 0.01). Three tests per window inflate the false-positive rate to about 1 - 0.99³ ≈ 3%, accepted on purpose because a missed attack costs more than an extra review.

Held-out results

metricvaluefrom
Recall100.0%20 of 20 attack windows caught
Precision80.0%20 of 25 flagged windows were attacks
False positive rate2.8%5 of 180 normal windows; theory predicted about 3%
F1 score0.889TP=20, FN=0, FP=5, TN=175

Both attacks were caught on their first window: t=300s for the scan (zports = +73.36) and t=330s for the exfiltration (zpkts = +12.34). Precision is the complement to the recall headline: 1 in 5 alerts is a false alarm, the visible cost of OR-ing three tests.

! limitation

The simulated attacks make no attempt to blend in (no slow scanning, no timing jitter, no size padding), so an adaptive attacker could likely evade this exact detector. The three tests also ignore feature correlation. A Bonferroni correction or Hotelling's T² would raise precision at some cost in recall.

> talking point

"Why a z-test and not chi-square?" Chi-square compares a whole distribution with an expected one. The question here is narrower: is this one window implausibly far from a fitted mean? That is a one-sample z-test.

04 04-soc-siem-lab

Home SOC / SIEM Lab

Blue team. Live demo.

[part] track A run, track B spec only
  • Python
  • SQLite
  • Flask
  • ELK spec
Resume line

Built a home SOC lab with a Python-based log ingestion pipeline and rule-based SIEM alerting engine (SQLite + sliding time-window detection) processing 190K+ logs/sec with a sub-20-second detection threshold on simulated SSH brute-force and port-scan attacks; verified end-to-end via a live Flask dashboard, with a full incident report grounded in the actual pipeline output.

Two tracks, kept separate

Track A is a Python and SQLite SIEM that was run for real; every number here comes from it. Track B is a full ELK docker-compose.yml for the production path, written to spec but never started because the build machine had no Docker. The README says so plainly.

Pipeline

log_generator.py writes a syslog-style auth.log mixing normal SSH logins from 6 accounts with two embedded attacks. siem_ingest.py parses each line into SQLite and reports anything it cannot parse instead of dropping it. detection_rules.py applies two sliding-window rules: 8 or more failed logins from one IP in 5 minutes, and 8 or more distinct ports from one IP in 30 seconds. dashboard.py serves the results read-only over Flask.

$ python3 run_pipeline.py (captured 2026-08-18)
STEP 1: 170 lines generated, 55 brute-force attempts, 20 port-scan events
STEP 2: Parsed 170/170 lines (0 unparsed)
[ALERT-BRUTE_FORCE_SSH-001] severity=high src=203.0.113.77 count=55
[ALERT-PORT_SCAN-002] severity=medium src=198.51.100.23 count=20

Both attacks were flagged with no false positives among the 91 legitimate logins, including several retry-then-succeed cases planted in the baseline to test exactly that. The dashboard was started and checked with real requests (/healthz, /api/alerts, /api/timeline) and now runs as a public demo.

Performance, benchmarked

$ python3 benchmark_throughput.py && python3 benchmark_mtta.py
Wrote data/bench_auth.log (51.0 MB, 500,000 lines)
Parsed 500000/500000 lines (0 unparsed)  Elapsed: 2.61s
Throughput: 191,586 logs/sec
Brute force: threshold crossed (count=8) after 19.8s
Port scan:   threshold crossed (count=8) after 3.9s
Mean time-to-threshold across both real alerts: 11.8s

Throughput is single-threaded regex parsing plus SQLite inserts on a laptop, using the real log formatters. Time-to-threshold is computed from event timestamps: the rules run in batch over a finished log, so 11.8s is how fast a streaming version would fire, not a measured live alerting SLA.

! limitation

Thresholds follow published tool behavior and common SIEM defaults, not a calibrated production baseline. Track B has never been run.

> talking point

Project 5's brute-force detector uses the same sliding-window algorithm at a smaller scale, and Project 8 imports this pipeline instead of rewriting it. Pointing out those links shows the portfolio is one system, not disconnected exercises.

05 05-security-automation-scripts

Security Automation Scripts

Tooling.

[ok] verified
  • Python stdlib
  • unittest
Resume line

Wrote Python security automation tools: an SSH auth-log brute-force detector using a sliding-window algorithm, and a password-policy auditor estimating offline crack time across three threat models (fast hash, bcrypt, rate-limited login), with unit tests covering the core detection algorithms.

The brute-force detector

A two-pointer sliding window per source IP, O(n) per IP, over OpenSSH-style log lines. A flat count cannot tell a burst from background noise: the sample log has three IPs failing logins, and only one clusters tightly enough to cross the threshold.

$ python3 log_bruteforce_detector.py sample_data/auth.log
Parsed 11 failed-login events. Window: 300s | Threshold: 5
ALERT  203.0.113.9: 8 attempts in 300s window (22:30:01 -> 22:30:15)

The password auditor

Checks length, character classes, common-password membership, sequential runs and repeats, then turns estimated entropy into crack time under three threat models, because what attacks the hash matters as much as the password: unsalted MD5 offline (about 10¹⁰ guesses/s), bcrypt cost 12 offline (about 2×10³/s), and a rate-limited login form (about 10/s).

password (masked)entropyfast hashbcrypt
p******d37.6 bits10.4 seconds1.7 years
c***********************e117.5 bits, fails policy3.75×10¹⁷ yrs1.88×10²⁴ yrs
7*************************!177.4 bits, passes3.97×10³⁵ yrs1.98×10⁴² yrs

The middle row is correcthorsebatterystaple from XKCD 936. It has more entropy than several passwords that pass, yet fails because it is all lowercase. That is deliberate: NIST SP 800-63B now favors length over composition rules, and the tension is a good discussion point.

> talking point

Ten unit tests cover both scripts. One checks that a burst is flagged while the same count spread over hours is not, which tests the sliding-window logic itself rather than whether the script runs.

06 06-grc-risk-assessment

GRC Risk Assessment (NIST CSF)

GRC.

[ok] verified
  • NIST CSF
  • docx, generated
Resume line

Authored a NIST CSF-aligned cybersecurity risk assessment for a simulated mid-size organization: a 12-asset inventory, a 10-item risk register scoring both inherent and residual risk, and a full security policy framework mapped to all five NIST CSF functions, each control traced to a specific identified risk.

A company built for its sector

The assessment covers Meridian Environmental Logistics, built to be realistic for logistics and environmental services rather than a generic template. A company that reports waste and disposal data to regulators has a risk most templates miss: data integrity tied to its operating license, not just to money or uptime. Two of the ten risks exist because of that.

Inherent vs residual

Every risk is scored twice: assuming no controls (inherent) and with today's controls (residual). That turns a list of bad things into a prioritization tool.

riskinherentresidualwhy the gap
R-01 Ransomware on ERP/finance20/25 critical10/25 highBackups and AV already partly mitigate it
R-02 BEC leading to a fraudulent wire15/25 high10/25 highManual callback checks, inconsistently followed

That gap drives the roadmap: close R-02 first with dual approval on wires, and test R-01's untested restores, instead of spending more on a risk that is already partly covered.

Every policy cites a risk

Each control under Identify, Protect, Detect, Respond and Recover names the risks it answers, for example PR.AC: Enforce phishing-resistant MFA on ERP/finance [R-01, R-02, R-09].

How it was built

Generated with docx in Node, so the Word tables and the CSV exports come from one data source and cannot drift apart. That surfaced a layout bug: the 12-column register needed 13,830 DXA against a 9,360 DXA portrait page. The fix gave that table its own landscape section (12,960 DXA) instead of cramming columns.

> talking point

This project leans on the Management Engineering background. GRC teams need people who can read the technical risk correctly, such as why R-01's residual score sits below its inherent score, and explain it in plain language.

07 07-ctf-writeup-blog

CTF Write-Up Blog

Documentation.

[part] scaffold verified, content is a template
  • Jekyll
  • GitHub Pages
Resume line, once real write-ups exist

Maintain a public technical blog documenting methodology for completed TryHackMe, HackTheBox, and OverTheWire challenges: [N] write-ups published, covering [topics].

What it is

A Jekyll blog that GitHub Pages builds with no local Ruby install: push and it is served. The config, layout and post format are complete.

The one deliberate exception

The single post, an OverTheWire Bandit levels 0 to 2 write-up, is labeled a template in its own banner and in the README. The rooms have not been done yet, and a fabricated write-up is exactly what an interviewer's next question would expose.

The format to keep

Room and context, then approach (dead ends included, the most useful part), then root cause or key technique, then takeaways. Consistent posts show the documentation habit a SOC or IR role needs.

! before you use it

Leave the resume line out, and do not link the blog, until real rooms written in your own words replace the template.

08 08-capstone-detection-response

Capstone: Detection & Response

Blue team. Capstone.

[part] simulation verified, one deterministic run
  • Python
  • SQLite
  • MITRE ATT&CK
Resume line

Simulated and detected a multi-stage attack chain (initial access, lateral movement, exfiltration) against a home-built SIEM pipeline, mapped to MITRE ATT&CK (T1110, T1078, T1021.004, T1041) with correlation logic tying all three stages to one identity, producing a full incident response report with timeline, root cause, and remediation recommendations.

Built on Project 4 by import

The capstone imports Project 4's log_generator, siem_ingest and detection_rules modules instead of copying them. It adds one event type (data_exfil) and one column (bytes_transferred), and Project 4's own pipeline was rerun afterwards with identical results.

The simulated intrusion

  1. Initial access (T1110, T1078): 22 password guesses against internet-facing web01, ending in a valid login as employee rpatel.
  2. Lateral movement (T1021.004): the same account moves from web01 to app02 and db01 over SSH.
  3. Exfiltration (T1041): about 812 MB leaves db01 over port 443, where it blends with normal HTTPS egress.

Detection run

$ python3 run_pipeline.py (captured 2026-08-18)
Parsed 99/99 lines (0 unparsed): auth_failed:25 auth_success:73 data_exfil:1
[ALERT-BRUTE_FORCE_SSH-001] src=203.0.113.50 count=22
[CHAIN-001] Full attack chain detected for account 'rpatel':
  brute force -> valid-account login on web01 -> lateral movement to
  app02, db01 -> 1 exfiltration event totalling 812.3 MB.
> talking point: detection-engineering judgment

The correlation rule fires only when all three stages tie back to the same identity in causal order, then raises one chain alert instead of three noisy ones. It trades a little latency for an alert an analyst can act on, which is the difference between a SIEM that cries wolf and one people trust.

! limitation

The lateral-movement rule is identity-scoped: it relies on stage 1 having flagged rpatel. A production version would also baseline each account's normal hosts, so first-time access to a new host is flagged even without an earlier brute-force alert.

09 09-cloud-iac-security-scanner

Cloud / IaC Misconfiguration Scanner

Cloud security. Static analysis.

[ok] verified
  • Python stdlib
  • Terraform
  • unittest
Resume line

Built a Python static-analysis tool that parses Terraform IaC and flags AWS misconfigurations (public S3 ACLs, world-open SSH/RDP security groups, wildcard IAM admin policies, unencrypted RDS/EBS storage) across 5 rule checks; verified against a deliberately vulnerable Terraform set (7/7 findings correctly flagged) and a remediated set (0 false positives), with 9 passing unit tests covering the parser and rule logic.

What it is

A scanner that reads Terraform .tf files and flags common AWS misconfigurations before the infrastructure is ever applied. It never calls the AWS API and needs no account, so every result is reproducible at no cost. It follows the same before-and-after pattern as Project 1: a deliberately vulnerable Terraform set and a fixed one.

Five rules

ruleseveritychecks
CLOUD-S3-PUBLIC-ACLhighBucket ACL is public-read or public-read-write
CLOUD-SG-OPEN-ADMIN-PORThighSSH (22) or RDP (3389) open to 0.0.0.0/0
CLOUD-IAM-WILDCARD-ADMINhighPolicy allows Action: "*" on Resource: "*"
CLOUD-STORAGE-UNENCRYPTEDmediumRDS instance or EBS volume with encryption off
CLOUD-S3-NO-VERSIONINGlowNo versioning block, or versioning disabled

Captured output

$ python3 run_scan.py vulnerable ; python3 run_scan.py fixed
Scanned 5 resource(s) in vulnerable/
[HIGH] CLOUD-IAM-WILDCARD-ADMIN  aws_iam_policy.deploy_bot
[HIGH] CLOUD-S3-PUBLIC-ACL  aws_s3_bucket.reports
[HIGH] CLOUD-SG-OPEN-ADMIN-PORT  aws_security_group.web (SSH)
[HIGH] CLOUD-SG-OPEN-ADMIN-PORT  aws_security_group.web (RDP)
[MEDIUM] CLOUD-STORAGE-UNENCRYPTED  aws_db_instance.prod
[MEDIUM] CLOUD-STORAGE-UNENCRYPTED  aws_ebs_volume.app_data
[LOW] CLOUD-S3-NO-VERSIONING  aws_s3_bucket.reports
7 finding(s): 4 HIGH, 2 MEDIUM, 1 LOW

Scanned 5 resource(s) in fixed/
No findings. 0 misconfigurations detected.

The exit code is 1 when findings exist and 0 on a clean scan, so it can gate a CI pipeline as-is.

> talking point

Each of these misconfigurations is one line of Terraform and easy to miss in review. A check that runs on every change and fails the build turns a reviewer's memory into a gate. It also fills the portfolio's cloud gap: everything else is on-prem.

! limitation

The parser (scanner/hcl_lite.py) is scoped on purpose: resource blocks, flat attributes, one level of nested blocks and heredocs, but no for_each, dynamic blocks, modules or interpolation functions. Production Terraform would need a real parser such as python-hcl2. The rules echo CIS AWS Foundations themes but are not certified CIS mappings.