Commit graph

17 commits

Author SHA1 Message Date
trvon
a27c3366d8
fix(symbolic): cache string size()/length() across assignments
std::string/std::string_view size()/length() was cached only in the member
cache, which assign() clears. So `char* p = malloc(s.size()+1); ...; p[s.size()]`
encoded the two size() calls as DIFFERENT symbols, letting the solver find a
spurious out-of-bounds (yams object_storage_adapter.cpp dup_cstr, plugin_host_services_shim).

Route zero-arg const size()/length() through the assignment-surviving
string-length cache (string_lengths_), so both calls resolve to one length
symbol: the final write lands exactly at the end (in-bounds), while a genuine
size()+1 write still fires.

Adds positive/negative oob tests; full suite 137/137.
2026-08-23 09:11:45 -06:00
trvon
14aedf7417
fix(detect): suppress security-detector false positives
- int-overflow: unsigned wrap is defined, not UB — split to
  fold.unsigned-wrap so signed-UB findings aren't drowned; on by
  default (--report-unsigned-wrap=false opts out)
- use-after-free: model return/throw as path-terminating so
  `delete p; return;` in an error branch can't poison the fall-through
- oob-access: real sizeof for complete structs (was 1); recognize
  std::min/clamp/modulo index bounds
- memory-leak: static-storage singletons + return-to-caller are
  caller-owned, not leaks

YAMS scan: UAF 4→0, struct-OOB ~10→0, singleton-leak ~15→0,
min/modulo-bound OOB →0. 137/137 tests pass.
2026-08-16 14:29:35 -06:00
trvon
86b2f14a43
feat(analysis): harden project-wide scans
- persist TU-owned graphs and guarded configuration evidence
- add closed-world production reachability classification
- calibrate detector precision and reviewed self-scan policy
- terminate poisoned workers instead of longjmp recovery
2026-07-30 18:18:04 -04:00
trvon
50230c809b
checkpoint 2026-06-04 20:20:29 -04:00
trvon
dcbbba73ff
fix: interprocedural buffer-bound pre-pass verification + test
- Verified seedInterproceduralContext() pipeline: SecurityWalker calls it
  before TraverseDecl, OOBObserver scans all call sites for ConstantArrayType
- OOB observer consumes param_buffer_sizes_ for ParmVarDecl base variables
- Test added for interprocedural buffer-bound detection
2026-05-30 00:48:07 -04:00
trvon
c3db07eda3
fix: pass ParmVarDecl to OOB observer for interprocedural buffer tracking
- encoder.cpp: extract VarDecl from ArraySubscriptExpr base when
  trackedArrayVar returns null (covers ParmVarDecls like 'output')
- test_oob_access.cpp: test interprocedural buffer propagation
  (decode_base64 receiving decoded[256] via pointer parameter)
- Root cause: validate_auth is summarized, preventing inline walk.
  Mitigation tracked in docs/internal/interprocedural-notes.md
2026-05-29 23:40:25 -04:00
trvon
9be8deb4f6
feat: enrich findings with path trace, counterexample, variable info
- SizeInfo struct: buffer_name, capacity, index_expr for OOB findings
- path_trace: vector of branch/call events from SafetyObserver
- counterexample: Z3 model key=value pairs for SAT findings
- variable_name, sink_function: named context for LLM steering
- Serialized in FindingEvidence + SARIF properties
2026-05-29 23:13:09 -04:00
trvon
6c38999e60
Honor validated divisors and bounded snprintf 2026-05-24 19:55:43 -04:00
trvon
2c8263fc1c
Recognize bounded divisor and index patterns 2026-05-24 19:41:27 -04:00
trvon
d9477545a0
Use promoted arithmetic widths 2026-05-24 18:18:11 -04:00
trvon
331a68467c
Optimize security detectors and add quality gates 2026-05-23 20:42:05 -04:00
trvon
c4e42cec0a
Add scan router and MCP job queue
Split source and binary scan routing with merge-only hybrid support, binary provenance, and router-backed MCP scan contexts.

Add async MCP scan jobs for long-running scans, detector precision fixes, benchmark scripts, docs, and integration coverage.
2026-05-19 00:24:12 -04:00
trvon
ddedb77a9f
Add strcpy/sprintf buffer overflow detection 2026-05-15 16:13:26 -04:00
trvon
66cda72701
Fix BufferSizeTracker: pointer-to-buffer alias tracking 2026-05-15 15:28:03 -04:00
trvon
7b28ebb31d
P0+P1: model ++/-- in encoder, symbolic array OOB 2026-05-15 15:00:54 -04:00
trvon
f218af3d8b
Add githooks, clang-format all code, fix CI Z3 paths 2026-05-15 00:08:47 -04:00
trvon
3f1234f7bb
fold: bounded symbolic SAST for C++
Clang LibTooling + Z3 BV-64 encoding.
11 detectors: clone, equiv, class-dup, dead, null-deref,
div-by-zero, int-overflow, oob, int-truncation,
sign-conversion, taint-track.

Interfaces: CLI, MCP (JSON-RPC 2.0), LSP.
Output: SARIF 2.1.0, JSON, Markdown.
2026-05-14 23:14:54 -04:00