A4: roadmap-2026-09-04.md moves to .kiro/archive/steering/ so it no longer loads as steering (roadmap.md and safety-net.md replaced it); roadmap.md's pointer follows it. overview.md's spec table is recounted from tasks.md and spec.json (adds ai-service-plane, harnessx-removal, learned-decision-engine, pre-push-safety-net; drops the stale "active one"), and the module line now cites the regenerated audit: 150 modules, 145 load-bearing, 5 standalone, 0 orphaned; 1,964 tests collected. A5: a dated status note at the top of the requirements (or brief) of 16 specs: retired, superseded, dormant or complete, and for model-grounded-detection the removal of judge/calibrate/execution (closing the Req 10 execution-tier option). spec.json phase corrected to implementation-complete where every task is checked (model-grounded- detection, propose-adjudicate-prove, tree-sitter-overlay-extra, corpus-seeded-mechanisms, pair-corpus-honesty); openrouter-sast-harness gets a spec.json with status retired. Nothing deleted, no spec moved. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01EmM1j46qgKMh3zqD1QMwEo
23 KiB
Requirements: OpenRouter SAST Harness
Status 2026-10-02: retired (see the note below). Its OpenCode skill
openultrasast-kiro-impl, which still sent agents to this tasks.md, was deleted. Kept as decision history; nothing in src, tests or CI points here.
Retired 2026-09-30: HarnessX was removed by
harnessx-removal; the agentic plane is ax (ai-service-plane), and evolutionary proposals come from the plane memory. History below is unchanged.
Overview
OpenUltraSAST shall be an independent OpenCode-driven security harness for finding, validating, reporting, and optionally fixing source-code vulnerabilities at scale. It shall use OpenRouter-selected chat models for reasoning, OpenRouter embeddings for semantic retrieval, Docker for isolated analysis, and an explicit evidence ladder to prevent AI suspicion from being reported as verified security impact.
The project shall use Clearwing only as an implementation oracle. It shall not import Clearwing internals, fork Clearwing, or expose Clearwing's broad MCP surface.
Goals
- Provide a repeatable SAST harness that can scan local repositories and produce ranked, evidence-scored findings.
- Make false-positive elimination a primary product goal by separating suspicion, corroboration, verification, reproduction, and patch validation.
- Combine static analysis, semantic retrieval, LLM hunters, adversarial verification, and patch validation into one opencode-native workflow.
- Keep model routing explicit through OpenRouter, with per-role model configuration and no silent substitution.
- Preserve Docker isolation as a first-class security boundary for code execution, harness compilation, fuzzing, and patch validation.
- Integrate Trail of Bits skills as scoped security expertise selected by language, framework, vulnerability class, mapping need, or verification need.
- Emit machine-readable artifacts suitable for CI, triage, and later training or harness evolution.
- Build detector quality against grounded vulnerable-project benchmarks for JavaScript/Node/web, Python/web, Java, and C/C++ instead of relying on toy fixtures or pattern-only tests.
- Help coders and vibecoders understand and fix findings through an evidence-aware explain mode that teaches the secure pattern, not only flags the insecure one.
Completeness Model
Implementation progress shall be reported against functional harness capability, not raw checklist percentage. A task may be complete as scaffold while the product capability remains incomplete.
Completion levels:
scaffold: schemas, CLI shape, local artifacts, tests, or isolated primitives exist.usable: the feature runs end-to-end for a narrow local fixture without manual wiring.integrated: the feature participates in the scan harness with traces, evidence, reports, and degradation handling.production: the feature is robust enough for real repositories, CI budgets, failure recovery, and analyst audit.
Progress reports shall identify both checklist progress and functional completeness. The project shall not describe OpenUltraSAST as a working harness until the usable_harness_mvp gate is satisfied.
Functional gates:
scaffold_quick_scan: quick scan can enumerate files, rank targets, emit basic static findings, and write JSON/Markdown artifacts. This gate does not constitute a security harness.usable_harness_mvp: harness runtime, event tracing, static mapping ingestion, evidence ladder enforcement, independent verification, and JSON/Markdown/SARIF reporting work together on fixture repositories.standard_security_harness: standard mode runs ranked hunters with retrieval packages, selected security skills, independent verification, false-positive learning, and auditable traces.sandboxed_dynamic_harness: Docker sandbox, scoped dynamic probes, sanitizer/build artifacts, and evidence transitions work without hidden network or host mutation.fix_validation_harness: patch proposals, adversarial fix audit, differential/static delta checks, and sandbox validation are integrated and cannot mark patches validated without passing evidence.opencode_product: MCP tools, opencode commands/skills, fusion deepening, CI-ready reports, cost controls, and hardening are complete enough for routine opencode-driven use.benchmark_grounded_finder: benchmark manifests, expected vulnerabilities, tool comparison baselines, recall/precision metrics, and missed-finding regression tracking exist for JavaScript, Python, Java, and C/C++ vulnerable projects.explain_and_fix_workflow: users can ask for an evidence-grounded explanation of a finding, receive prevention guidance, and enter an interactive fixing workflow that routes to the appropriate security skills without silently applying patches.
The current implementation state shall be documented as usable_harness_mvp until later gates are explicitly verified.
Non-Goals
- Do not make network pentesting the core workflow.
- Do not reimplement all of Clearwing.
- Do not report LLM-only claims as verified vulnerabilities.
- Do not require a local embedding model.
- Do not depend on a single OpenRouter model.
- Do not mutate user repositories by default.
Functional Requirements
Repository Intake
- The system shall accept a local repository path as the primary scan target.
- The system should later support git URLs, but initial implementation may require local checkout.
- The system shall snapshot basic repository metadata: root path, commit hash when available, language mix, file count, and ignored paths.
- The system shall respect common ignore files such as
.gitignore,.ignore, and explicit harness config excludes.
Preprocessing
- The system shall enumerate source files and assign initial language, LOC, and path metadata.
- The system shall tag files using lightweight static heuristics, including memory-unsafe code, parser surfaces, crypto surfaces, authentication boundaries, syscall or process boundaries, serialization boundaries, and fuzzable entry points.
- The system shall build a dependency or call graph where practical.
- The system shall ingest optional static analyzer output such as Semgrep SARIF or CodeQL SARIF.
- The system shall preserve preprocessing artifacts for later ranking, retrieval, and audit.
Static Analysis And Mapping Discipline
- The system shall treat Semgrep, CodeQL, differential review, and sharp-edge/API review as mapping disciplines, not just optional external scanners.
- The system shall ingest Semgrep and CodeQL output as SARIF and normalize it into static hints, evidence candidates, and variant-search seeds.
- The system shall support function-level entry-point and reachability analysis to identify attacker-controlled inputs, externally callable functions, public routes, CLI/process boundaries, parser entry points, smart-contract state-changing entry points, callbacks, and privileged/admin-only surfaces.
- The system shall classify entry points by access level and trust boundary, including public/unrestricted, authenticated, role-restricted, contract-only/callback, local-only, and unknown/review-required.
- The system shall preserve condition evidence for entry points, including feature flags, rollout toggles, pause guards, experiment gates, and runtime guard expressions that affect whether a threat actor can reach the code.
- The system shall use function-level reachability modeling to prioritize candidate bugs inside reachable entry-point functions and to demote pattern-only findings that lack a plausible attacker-controlled path.
- The system shall support differential analysis between a base and head revision to identify changed attack surfaces, newly reachable code, and regression-prone fixes.
- The system shall support sharp-edge mapping for APIs, configuration, defaults, cryptographic interfaces, and dangerous framework patterns that create predictable misuse.
- The system shall preserve analyzer provenance so each finding can cite which static tool, rule, diff, entry-point analysis, or skill-derived checklist contributed evidence.
Benchmark-Grounded Detection
- The system shall maintain benchmark manifests for realistic vulnerable projects, not only synthetic single-file fixtures.
- The initial benchmark matrix shall cover JavaScript/Node/web, Python/web, Java, and C/C++.
- Benchmarks shall include vulnerable training projects and curated CWE samples such as NodeGoat, DVNA or similar Node/Express apps, OWASP Juice Shop slices, PyGoat or vulnerable Flask/Django samples, OWASP Benchmark/WebGoat/Juliet Java, Juliet C/C++, vulnerable parser fixtures, and small sanitizer-backed C/C++ crash targets.
- Each benchmark manifest shall record repository path or source, language, framework, setup commands, scan modes to run, expected vulnerability classes, expected locations when known, and known noisy/non-security patterns.
- The benchmark runner shall emit recall, precision where ground truth allows it, false-positive reason distribution, missed expected findings, unsupported vulnerability classes, runtime, model usage, and artifact paths.
- Benchmark results shall compare quick, standard, and deep modes separately so rule coverage, LLM hunting, and dynamic validation are not conflated.
- Benchmark runs shall support comparison against external baselines such as Clearwing, Semgrep, CodeQL, clang-tidy, npm audit, Bandit, or language-appropriate tools when their outputs are available as SARIF or normalized findings.
- Missed benchmark vulnerabilities shall become regression records that feed rule expansion, ranking calibration, retrieval packages, hunter prompts, and skill routing.
- A detector shall not be considered realistic for a language until it demonstrates useful recall on at least one realistic benchmark project and one curated CWE corpus for that language.
- Benchmark artifacts shall be preserved under
.openultrasast/benchmarks/<benchmark-run-id>/with links to the scan artifacts that produced each metric.
OpenRouter Embeddings And Retrieval
- The system shall use OpenRouter embedding endpoints for semantic indexing.
- The system shall chunk source code, docs, static findings, prior mechanisms, and Trail of Bits skill descriptors into separate collections or namespaces.
- The system shall store vectors in a local persistent vector database by default.
- The system shall support reusing an existing index when the repository snapshot has not changed.
- The system shall retrieve bounded context packages for rankers, hunters, verifiers, and patchers.
- The system shall evaluate vector-store candidates against ranking quality, metadata filtering, incremental indexing, local persistence, cost, and reproducibility before selecting a default.
- The vector store shall support precise metadata filters for path, language, symbol, vulnerability class, evidence level, scan ID, and repository snapshot.
Ranking
- The system shall score candidate files on at least three axes: surface, influence, and reachability.
- The system shall compute a composite priority using an explicit formula, initially
surface * 0.5 + influence * 0.2 + reachability * 0.3. - The system shall keep low-surface high-influence files eligible for analysis.
- The system shall combine static heuristics, dependency graph data, entry-point reachability, embeddings, and OpenRouter LLM scoring.
- The system shall record score rationales and model identity.
- The system shall measure ranking quality with fixture repositories and prior scan outcomes, including false-positive rate by tier and missed-true-positive rate where ground truth exists.
- The system shall feed verifier outcomes back into ranking calibration so repeated false-positive patterns lose priority over time.
False-Positive Elimination Loop
- The system shall track every rejected, contradicted, duplicate, unsupported, and unverified finding as false-positive learning data.
- The system shall record why a finding failed: unreachable path, missing attacker control, sanitizer disproved, static rule mismatch, incorrect model assumption, duplicate finding, or insufficient impact.
- The system shall use HarnessX-style adjustment loops to update prompts, retrieval filters, ranking calibration, skill routing, verifier tie-breakers, and static mapping seeds from false-positive outcomes.
- The system shall keep false-positive learnings auditable and reversible; learned suppressions shall cite evidence and scope.
- The system shall prefer evidence-gated demotion over deletion so analysts can inspect why a suspected issue was suppressed or downgraded.
Harness Execution
- The system shall model the scan as a HarnessX-style harness composed of processors, tools, memory, sandbox, trace, and model roles.
- The system shall expose stage hooks for task start, stage start, before model, after model, before tool, after tool, stage end, and task end.
- The system shall contract-check processor inputs and outputs in strict mode for CI and warn mode for local exploration.
- The system shall serialize harness configuration, processor versions, model roles, and prompt hashes into scan artifacts.
Hunter Pool
- The system shall fan out analysis across ranked targets using budgeted tiers.
- The system shall support at least three analysis depths: quick, standard, and deep.
- Quick mode shall rely on static analysis, ranking, and bounded LLM review without code execution.
- Standard mode shall use sandboxed tool-calling hunters and adversarial verification.
- Deep mode shall add harness generation, sanitizer builds, fuzzing, dynamic reproduction, crash reproduction, and patch validation where applicable.
- The system shall record every hunter trajectory as structured JSONL.
- Standard-mode hunters shall be evaluated against benchmark misses before being treated as production-quality detectors.
- Hunter prompts shall be language- and framework-aware for JavaScript/Node/web, Python/web, Java, and C/C++ instead of using one generic vulnerability prompt for all targets.
Evidence Ladder
- Every finding shall carry exactly one current evidence level.
- Evidence levels shall be ordered as:
suspicion,static_corroboration,crash_reproduced,root_cause_explained,exploit_demonstrated,patch_validated. - Findings below
static_corroborationshall not be reported as verified. - Exploit or PoC generation shall require at least
crash_reproducedor equivalent trigger evidence. - Auto-patching shall require at least
root_cause_explainedand shall only advance topatch_validatedafter tests or reproducer validation pass.
Verification And Fusion
- The system shall verify findings using independent context that excludes hunter chain-of-thought and raw hunter reasoning.
- The verifier shall steel-man both the vulnerability case and the false-positive case.
- The verifier shall output explicit tie-breaker evidence requirements.
- The system shall support OpenUltraCode-style fusion for task-required deepening, high-impact findings, uncertain findings, risky fixes, or unresolved disagreement, using two panels and an explicit decider.
- Fusion output shall disclose model IDs, panel roles, degradations, warnings, votes, and final decision source.
- Every adversarial finding shall receive a disposition: accepted, rejected, mitigated, deferred, or blocked.
- Fusion shall be mandatory whenever the task requires deeper reasoning than the normal ranker, hunter, verifier, and static mapping loop can provide.
- Fusion shall not be forced for routine low-risk issues unless the task explicitly asks for deeper analysis or the evidence remains unresolved.
Docker Sandbox
- The system shall run untrusted build, test, fuzz, and PoC commands inside Docker by default.
- Analysis containers shall have network disabled by default.
- Source mounts shall be read-only except in explicit patch workspaces.
- Containers shall use a writable scratch volume or tmpfs.
- Containers shall enforce CPU, memory, pids, timeout, and capability limits.
- The system shall support sanitizer variants, initially ASan and UBSan for C/C++ targets.
- The system should support gVisor or another hardened runtime when available.
Dynamic Analysis
- The system shall support optional dynamic analysis when runtime evidence is needed to verify, reproduce, or de-risk a finding.
- Dynamic analysis may include service startup, local socket checks, netcat-style probes, protocol smoke tests, PoC execution, or Clearwing-style network validation patterns.
- Dynamic network access shall be disabled by default and enabled only through explicit scan configuration or task-required evidence collection.
- Dynamic probes shall run in sandboxed environments with declared network scope, timeouts, command logs, and captured artifacts.
- Dynamic analysis shall contribute evidence but shall not turn OpenUltraSAST into a general network pentest agent.
Patch Oracle
- The system shall optionally generate minimal defensive patches for verified findings.
- The patch workflow shall follow OpenUltraCode discipline: intake, bounded plan, implementation, adversarial review, reconciliation, and fresh verification.
- The patch oracle shall target the smallest safe change.
- The patch oracle shall not rewrite unrelated code or change public signatures unless required and approved.
- Patch validation shall rerun the reproducer, affected tests, or relevant build checks in a writable sandbox.
- Patch artifacts shall be emitted as diffs, not silently applied to the user's repository by default.
- The system shall audit proposed fixes for regression risk using differential analysis and relevant Trail of Bits skills before marking them ready.
Explain Mode And Interactive Fixing
- The system shall expose an explain workflow for a finding, vulnerability class, or benchmark miss.
- Explain mode shall describe the vulnerable pattern, why it matters, what attacker-controlled path or evidence exists, what evidence is missing, and what secure coding habit would have prevented it.
- Explain mode shall distinguish education from verification; an explanation shall not upgrade evidence level unless the required evidence artifact already exists.
- Explain mode shall cite source lines, finding artifacts, verifier results, SARIF/static evidence, dynamic evidence, benchmark metadata, and relevant skill snippets where available.
- Explain mode shall support audience levels such as concise, learner, and reviewer so it can serve coders, vibecoders, and security reviewers without changing the underlying evidence.
- Interactive fixing shall guide the user through a bounded plan, relevant security skill selection, minimal patch proposal, adversarial review, and validation commands.
- Interactive fixing shall route by language and vulnerability class, for example C/C++ memory issues to
c-review,address-sanitizer,libfuzzer, andharness-writing; JavaScript web issues to web/security mapping and dependency checks; Python web issues to injection/deserialization/auth/defaults checks; and Java issues to OWASP Benchmark/WebGoat-style dataflow and framework checks. - Interactive fixing shall never silently apply patches to the user's repository by default. It shall produce a proposed diff and required validation plan first.
- Explain and fix outputs shall emphasize prevention patterns so users learn how not to recreate the same vulnerability class in future code.
Reporting
- The system shall emit JSON, SARIF, Markdown, and a manifest per scan.
- Reports shall sort findings by severity, evidence level, reachability, and confidence.
- Reports shall include model IDs, static evidence, verifier results, reproduction evidence, patch status, and artifact paths.
- Reports shall distinguish suspected, verified, exploited, and patch-validated findings.
MCP And OpenCode Integration
- The project shall expose a narrow MCP server for OpenCode integration.
- MCP tools shall focus on project-level operations: scan, status, findings, evidence, artifacts, patch proposal, and report export.
- The MCP server shall not expose arbitrary internal tools as public MCP methods.
- OpenCode commands shall invoke the harness with explicit model role configuration and visible assumptions.
- MCP and OpenCode integration shall include narrow operations for benchmark status, finding explanation, and interactive patch proposal without exposing arbitrary shell execution.
Non-Functional Requirements
- The system shall be deterministic where possible: fixed config, artifact manifests, prompt hashes, and model identifiers.
- The system shall degrade visibly when optional tools, Docker, embeddings, or specific models are unavailable.
- The system shall avoid hidden network access from analysis containers; any dynamic network access shall be explicit, scoped, logged, and artifact-backed.
- The system shall support CI usage with bounded runtime and cost budgets.
- The system shall keep findings auditable from report back to source, trace, model call, verifier decision, and artifact.
Acceptance Criteria
scaffold_quick_scan: A user can run a local repository scan in quick mode and receive ranked static findings with JSON and Markdown reports. This may use heuristics and static patterns only.usable_harness_mvp: A user can run quick or standard fixture scans through the harness runtime and inspect event traces, normalized static mapping evidence, verifier decisions, and report artifacts.standard_security_harness: A user can run standard mode and receive adversarially verified findings with explicit evidence levels, selected retrieval context, skill routing, and false-positive learning records.sandboxed_dynamic_harness: A user can run deep mode on a small C/C++ parser target and receive sandboxed build/fuzz artifacts when the target is fuzzable.fix_validation_harness: A patch cannot be marked validated unless a sandboxed validation command passes and the fix audit has no accepted blocking findings.opencode_product: A user can drive scans, triage, evidence inspection, report export, fusion, and patch proposal through narrow MCP/OpenCode interfaces without exposing arbitrary shell execution.- A finding cannot be marked verified unless it reaches at least
static_corroborationthrough enforced evidence transitions. - A scan manifest records repository snapshot, harness config, OpenRouter model IDs, embedding model, prompt hashes, processor versions, evidence transitions, and artifact paths.
benchmark_grounded_finder: A user can run a benchmark manifest for JavaScript, Python, Java, or C/C++ and receive language-level recall, missed finding, false-positive, runtime, and artifact reports.explain_and_fix_workflow: A user can request an explanation for a finding or benchmark miss and receive evidence-cited prevention guidance plus an optional interactive fix plan without automatic repository mutation.