Repository navigation
feat(whitebox): code-graph taint engine + graph-grounded AI triage - #164
Merged
Merged
Conversation
Replace the semgrep wrapper as the white-box core with a code property graph (networkx) and an interprocedural source->sink taint search: - Python frontend (stdlib ast): Flask, FastAPI, Django/DRF, Tornado, aiohttp, Lambda; src/ layouts; nested functions; deferred calls (RQ enqueue, celery .delay, threads, executors, BackgroundTasks); lambdas. - JS/TS frontend (tree-sitter): Express routers incl. handler factories and wrappers, require/import/export, callbacks, TS destructured req. - Matched call/return (call-site stack), versioned locals, per-class sanitizers, type-coerced params; BOLA candidates with ownership-check suppression; mass assignment on whole-body sources; ReDoS sinks. - Findings carry the hop-by-hop path, entry points and routes; SARIF codeFlows. - Pattern hits are fused: duplicates of proven flows dropped, unproven injection hits demoted and given graph reachability. semgrep is opt-in. - Graybox reachability comes from the graph instead of graft/same-file. AI on top of the graph: - batched triage sees the proven path instead of a snippet; - --agent N: tool-use verifier with read-only, repo-confined graph tools that submits a verdict plus a PoC request; - --infer-specs: taint frontier + model-labelled sinks/sanitizers fed back via --specs. Also fix the default screen model id (claude-haiku-5 -> claude-haiku-5-5). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- drop unused FrozenSet import (py_frontend) and _WHOLE_BODY constant (js_frontend) - detect tree-sitter with importlib.util.find_spec instead of an unused import - fixture: remove unused `fs` require; close the file in unused_helper with `with` - test: locate the dead-code line in the fixture instead of hard-coding it Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 of 3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces the semgrep wrapper as the white-box core with a code property graph + interprocedural taint engine (
whitebox/offat_wb/cpg/), and builds the AI layer on top of the proven data-flow paths instead of code snippets.Engine
MultiDiGraphwith functions, params, versioned locals,selffields, call sites, args, returns and sources. Edges areflow(with per-classsanitizes), call-site-labelledcall/ret, andcalls. Exportable as JSON or GraphML (--graph-out).ast): Flask, FastAPI, Django/DRF, Tornado, aiohttp, Lambda,src/layouts, nested functions, lambdas, and deferred calls (queue.enqueue(fn, x),fn.delay(x),Thread(target=fn), executors).app.get(p, asyncHandler(login()))),require/import/export, callbacks, and TS destructuredreq.x = int(x)kills taint), per-class sanitizers, coerced params (int,<int:id>), BOLA with ownership-check suppression, whole-body-only mass assignment, and string-only sources excluded from NoSQL operator smuggling.codeFlows.--semgrep).AI
--agent N: a tool-use verifier (claude-opus-5-5) with read-only, repo-confined graph tools. It tries to refute first, then submits a verdict and a PoC request. Repo content is framed as untrusted data.--infer-specs: computes the taint frontier and has the model label unknown sinks and sanitizers, which feed back via--specs.claude-haiku-5→claude-haiku-5-5).Benchmarks (graph engine only, no AI)
See
docs/ai-roadmap.mdfor the design and the roadmap.Test plan
whitebox(16, including 12 new intest_cpg.py),graybox,triager,platform,reporter,bundleunit tests pass🤖 Generated with Claude Code