An AI agent security-audited real WordPress core — 1,492 PHP files, ~619k lines — for ~26,000 tokens instead of the ~5,200,000 it costs just to load the code once. A queryable code graph in XERJ decided what deserved reading; the agent read only candidates. Per-phase measured costs, published end to end.
FOR·SECURITY ENGINEERS·AI-AGENT BUILDERS·PLATFORM TEAMS
ONE BOOL-FILTER QUERY VS grep · UNITS DIFFER: FUNCTION-LEVEL CANDIDATES VS WHOLE FILES · GREP'S LITERAL RECALL IS PERFECT
ASK FOR THE BUG SHAPE.
Locate the gatekeepers, read their real implementations, compile the correct-vs-buggy shape into a query, and pull back only the violators. Precision comes from reading; scale comes from the index.
$ curl -s "$XERJ/wpaudit/_search" -H 'Content-Type: application/json' \
-d '{"query":{"bool":{"filter":[
{"term":{"has_source":"true"}},
{"term":{"sinks":"sql"}},
{"term":{"sanit":"false"}}]}}}'
# a request source + SQL sink in the same function, no sanitizer between
Core came back hardened: 0 missing-capability IDOR across 226 handlers, 0 auto-triggered deserialization gadgets. The one real weakness: wp_http_validate_url does not block 169.254.169.254 (cloud metadata), reachable unauthenticated via pingback_ping. A known-class limitation, not a novel 0-day.
WHAT THIS DOES NOT SHOW.
01
XERJ DOES NOT FIND BUGS.
The AST taint/authz model produces the candidates; XERJ stores and queries them. Pointed at raw file chunks instead of facts, the security value largely evaporates.
02
RECALL IS MODEL-BOUNDED.
A source at file scope, or laundered through $GLOBALS, is invisible to the graph. The trade is recall for precision and tokens — grep counter-examples are published in the walkthrough.
03
EVERY CANDIDATE STILL NEEDS A READ.
The detectors have known false-positive drivers — receiver-typed sinks, self-scoped writes, polymorphic capabilities. The value is that survivors are few enough to read them all.
04
THE AUDIT AUDITED XERJ TOO.
Two real engine bugs surfaced mid-run — term over keyword arrays, boolean term matching. Conclusions were recomputed over pulled _source, so they hold; both are published, and the keyword-array fix landed as a PR.
READ THE WALKTHROUGH.
The research journals, reproduction scripts, and verification harness are all published. The method ships as a copyable Claude Code skill — the taint model is data, not code, so it retargets to your stack.