circle-ir-ai 4.38.0 → 4.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +52 -0
- package/dist/agents/mastra/workflow.d.ts +16 -0
- package/dist/agents/mastra/workflow.d.ts.map +1 -1
- package/dist/agents/mastra/workflow.js +118 -22
- package/dist/agents/mastra/workflow.js.map +1 -1
- package/dist/blast-radius/index.d.ts +1 -1
- package/dist/blast-radius/index.d.ts.map +1 -1
- package/dist/blast-radius/index.js +1 -1
- package/dist/blast-radius/index.js.map +1 -1
- package/dist/blast-radius/radius.d.ts +32 -3
- package/dist/blast-radius/radius.d.ts.map +1 -1
- package/dist/blast-radius/radius.js +133 -17
- package/dist/blast-radius/radius.js.map +1 -1
- package/dist/blast-radius/types.d.ts +1 -1
- package/dist/blast-radius/types.d.ts.map +1 -1
- package/dist/cache/tree-cache.d.ts +10 -0
- package/dist/cache/tree-cache.d.ts.map +1 -1
- package/dist/cache/tree-cache.js +3 -1
- package/dist/cache/tree-cache.js.map +1 -1
- package/dist/cache/verify-cache.d.ts +7 -0
- package/dist/cache/verify-cache.d.ts.map +1 -1
- package/dist/cache/verify-cache.js +19 -2
- package/dist/cache/verify-cache.js.map +1 -1
- package/dist/dead-code/detector.d.ts +29 -2
- package/dist/dead-code/detector.d.ts.map +1 -1
- package/dist/dead-code/detector.js.map +1 -1
- package/dist/dead-code/engine.d.ts +35 -1
- package/dist/dead-code/engine.d.ts.map +1 -1
- package/dist/dead-code/engine.js +247 -3
- package/dist/dead-code/engine.js.map +1 -1
- package/dist/dead-code/illata-client.d.ts +160 -0
- package/dist/dead-code/illata-client.d.ts.map +1 -0
- package/dist/dead-code/illata-client.js +291 -0
- package/dist/dead-code/illata-client.js.map +1 -0
- package/dist/dead-code/index.d.ts +1 -0
- package/dist/dead-code/index.d.ts.map +1 -1
- package/dist/dead-code/index.js +1 -0
- package/dist/dead-code/index.js.map +1 -1
- package/dist/dead-code/rules/dead-code-java.dl +132 -0
- package/dist/health-score/calculator.js +1 -1
- package/dist/health-score/calculator.js.map +1 -1
- package/dist/llm/config.d.ts +21 -0
- package/dist/llm/config.d.ts.map +1 -1
- package/dist/llm/config.js +36 -0
- package/dist/llm/config.js.map +1 -1
- package/dist/llm/cwe-rubrics.d.ts +17 -0
- package/dist/llm/cwe-rubrics.d.ts.map +1 -0
- package/dist/llm/cwe-rubrics.js +51 -0
- package/dist/llm/cwe-rubrics.js.map +1 -0
- package/dist/llm/model-route-dispatcher.d.ts +17 -0
- package/dist/llm/model-route-dispatcher.d.ts.map +1 -1
- package/dist/llm/model-route-dispatcher.js +53 -3
- package/dist/llm/model-route-dispatcher.js.map +1 -1
- package/dist/llm/model-route.d.ts.map +1 -1
- package/dist/llm/model-route.js +4 -1
- package/dist/llm/model-route.js.map +1 -1
- package/dist/llm/verification.d.ts +1 -0
- package/dist/llm/verification.d.ts.map +1 -1
- package/dist/llm/verification.js +14 -6
- package/dist/llm/verification.js.map +1 -1
- package/dist/quality/calculator.d.ts.map +1 -1
- package/dist/quality/calculator.js +11 -2
- package/dist/quality/calculator.js.map +1 -1
- package/dist/scope/product-paths.d.ts +31 -9
- package/dist/scope/product-paths.d.ts.map +1 -1
- package/dist/scope/product-paths.js +152 -25
- package/dist/scope/product-paths.js.map +1 -1
- package/dist/secret-scan/scanner.d.ts +5 -0
- package/dist/secret-scan/scanner.d.ts.map +1 -1
- package/dist/secret-scan/scanner.js +72 -2
- package/dist/secret-scan/scanner.js.map +1 -1
- package/dist/security-scan/finding-labels.d.ts +3 -0
- package/dist/security-scan/finding-labels.d.ts.map +1 -0
- package/dist/security-scan/finding-labels.js +18 -0
- package/dist/security-scan/finding-labels.js.map +1 -0
- package/dist/security-scan/scanner.d.ts +26 -4
- package/dist/security-scan/scanner.d.ts.map +1 -1
- package/dist/security-scan/scanner.js +56 -9
- package/dist/security-scan/scanner.js.map +1 -1
- package/dist/specifica/binary-entries.d.ts +96 -0
- package/dist/specifica/binary-entries.d.ts.map +1 -0
- package/dist/specifica/binary-entries.js +318 -0
- package/dist/specifica/binary-entries.js.map +1 -0
- package/dist/specifica/evidence-extractor.d.ts.map +1 -1
- package/dist/specifica/evidence-extractor.js +12 -1
- package/dist/specifica/evidence-extractor.js.map +1 -1
- package/dist/specifica/file-routes.d.ts.map +1 -1
- package/dist/specifica/file-routes.js +2 -1
- package/dist/specifica/file-routes.js.map +1 -1
- package/dist/specifica/library-surface-python-rust.d.ts +56 -0
- package/dist/specifica/library-surface-python-rust.d.ts.map +1 -0
- package/dist/specifica/library-surface-python-rust.js +466 -0
- package/dist/specifica/library-surface-python-rust.js.map +1 -0
- package/dist/specifica/library-surface.d.ts +13 -1
- package/dist/specifica/library-surface.d.ts.map +1 -1
- package/dist/specifica/library-surface.js +41 -1
- package/dist/specifica/library-surface.js.map +1 -1
- package/dist/specifica/spec-tree.d.ts +25 -1
- package/dist/specifica/spec-tree.d.ts.map +1 -1
- package/dist/specifica/spec-tree.js +226 -47
- package/dist/specifica/spec-tree.js.map +1 -1
- package/dist/specifica/toml-lines.d.ts +33 -0
- package/dist/specifica/toml-lines.d.ts.map +1 -0
- package/dist/specifica/toml-lines.js +77 -0
- package/dist/specifica/toml-lines.js.map +1 -0
- package/dist/specifica/tree-types.d.ts +2 -2
- package/dist/specifica/tree-types.d.ts.map +1 -1
- package/dist/specifica/tree-writer.d.ts +1 -0
- package/dist/specifica/tree-writer.d.ts.map +1 -1
- package/dist/specifica/tree-writer.js +4 -1
- package/dist/specifica/tree-writer.js.map +1 -1
- package/dist/specifica/ts-rule-sources.d.ts +10 -1
- package/dist/specifica/ts-rule-sources.d.ts.map +1 -1
- package/dist/specifica/ts-rule-sources.js +98 -1
- package/dist/specifica/ts-rule-sources.js.map +1 -1
- package/dist/specifica/use-cases.d.ts +72 -3
- package/dist/specifica/use-cases.d.ts.map +1 -1
- package/dist/specifica/use-cases.js +230 -10
- package/dist/specifica/use-cases.js.map +1 -1
- package/dist/trust/compare.d.ts.map +1 -1
- package/dist/trust/compare.js +11 -1
- package/dist/trust/compare.js.map +1 -1
- package/dist/trust/passes/ai-config-detect.d.ts +4 -0
- package/dist/trust/passes/ai-config-detect.d.ts.map +1 -1
- package/dist/trust/passes/ai-config-detect.js +21 -1
- package/dist/trust/passes/ai-config-detect.js.map +1 -1
- package/dist/trust/passes/prompt-injection.d.ts.map +1 -1
- package/dist/trust/passes/prompt-injection.js +34 -3
- package/dist/trust/passes/prompt-injection.js.map +1 -1
- package/dist/utils/file-skip.d.ts +11 -0
- package/dist/utils/file-skip.d.ts.map +1 -1
- package/dist/utils/file-skip.js +29 -0
- package/dist/utils/file-skip.js.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,58 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [4.41.0] - 2026-11-29
|
|
11
|
+
|
|
12
|
+
Minor, on circle-ir **4.25.0** (was 4.24.0, exact). No change to circle-ir-ai's own code; what moves is what circle-ir finds, so scan, quality, trust and spec results can move.
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
- **`circle-ir` 4.24.0 → 4.25.0 (exact).** What reaches circle-ir-ai's answers (circle-ir CHANGELOG [4.25.0], cognium-dev#1506): a request value used as a template's source text (Jinja2, Mako, Django, Flask `render_template_string`, Handlebars, EJS, Pug, Go `text/template`, FreeMarker, Velocity and others) is reported as `template_injection` (CWE-1336), no longer `code_injection` (CWE-94), and a template name, file or data model is not template injection (a request value as a template name is `path_traversal`); new sink types `idor` (CWE-639) and `improper_type_validation` (CWE-1287), and Flask IDOR and an untyped Express query value cast with `as string` are speculative, so they show only where speculative findings are asked for; taint reaches more code: FastAPI and webargs / flask-apispec inputs, h3 request reads, Vue single-file component `v-html` bindings, React and Angular HTML sinks, mass assignment through ORM writes (CWE-915), stored XSS from database reads, Node `fs/promises` path sinks, Go sqlx query sinks, Django `__regex` lookups and wider ReDoS and prototype-pollution checks; `analyzeProject` follows calls through module imports, constructor-injected services and HTTP routes from a backend to its front end, and drops an `external_taint_escape` that a resolved cross-file path already explains; traces list the assignments that carry the value; a Java path-traversal flow from a command-line tool's own arguments carries the tag `tool-arguments:local-input` at half confidence; logging only the shape of request input is no longer log injection. New exports `PASS_REGISTRY`, `shippedPasses()` and `getPassInfo()`. `cognium-ai` and `circle-pack` stay on circle-ir 4.24.0 / 4.23.0 until this release is published.
|
|
16
|
+
|
|
17
|
+
## [4.40.0] - 2026-11-28
|
|
18
|
+
|
|
19
|
+
Minor, on circle-ir **4.24.0** (was 4.23.0, exact). 4.39.0 (release PR #1134, 2026-11-22) was never published; everything in it ships here, with what merged after it (#1121, #1141, #1142, #1143, #1144, #1146, #1150, #1156, #1163, #1179, #1186, #1198). From 4.39.0: the learned spec reads more entry points: a Python package's and a Rust library crate's public surface (#1128), binaries as a new use-case kind, `binary` (#1130), and Django and Django REST Framework routes (#1122), and Python and Rust levels give domain rules (#1129). The secret scan finds Azure connection strings and Twilio auth tokens in source files (#1126). The product-scope rule moves to `product-paths/4` (`product-paths/3`, #1124; test shell scripts are tests, #1133), so default scan, quality, trust and spec results can move. Static scan findings' `source.file`, `sink.file` and `alternateSources[].file` are now the absolute path instead of the basename, which stays in a new `fileName` (#1133); tooling that matched those fields on the basename should read `fileName`. No root export or output field is removed or renamed. Since 4.39.0: the batch verifier can refute (`COGNIUM_AI_VERIFY_MODE=explicit-all`) and a flow-backed finding is never removed by it (#1143); a verification that never answered never marks a finding exploitable (#1142); AI mode keeps `flow_backed` (#1141); a per-CWE rubric for CWE-78 behind `COGNIUM_AI_VERIFY_CWE_RUBRICS=1` (#1163); Java dead code through Illata behind `CIRCLE_IR_AI_DEAD_CODE_ENGINE=illata`, off by default (#1144); the learned spec reads Maven plugin goals and skips a library's readable copy beside its minified build (#1156, #1179); trust reads MCP and agent configs under `.cursor/`, `.vscode/` and `.claude/` (#1121); Django routes get their `include()` prefixes once on circle-ir 4.24.0 (#1198). Answers also move with circle-ir 4.24.0 (see Changed). No root export or output field is removed or renamed.
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
- **`circle-ir` 4.23.0 → 4.24.0 (exact).** `@cognium/mcp-server` 0.9.3 pins the same version, and its optional peer is `circle-ir-ai` `>=4.40.0`: the server refuses a module built on another `circle-ir` minor, so circle-ir-ai 4.39.0 and earlier drop out of `/api/mcp` beside it. What reaches circle-ir-ai's answers (circle-ir CHANGELOG [4.24.0]): `Class.forName(tainted)` is reported once, as `code_injection` (CWE-94), no longer also as `deserialization` (CWE-502) (cognium-dev#1384; the yamlbeans golden true positive is now CWE-94, #1198); dead code lifts a module or class to `may-be-live` when a member is not dead, and a module-level field follows its module (cognium-dev#1366, #1418); `buildPythonGraph()` routes compose Django `include()` prefixes and take DRF verbs (cognium-dev#1352); JS/TS navigation follows `.call` / `.apply` / `.bind` (cognium-dev#1337), so blast radius resolves a method run that way; a Maven `${property}` version declared in the same pom resolves (selectors and inventory show the version); Java enum members are in `types` by default, method references are call sites (`reference_form`), and calls in field initializers carry `in_method` `<clinit>` / `<init>`; `generateFindings` ids are a stable digest of `Finding.key`, no longer `vuln<N>`; `analyze()` on a C or C++ file returns an IR marked `unsupported` instead of throwing; `orphan-module` judges JS/TS files only.
|
|
23
|
+
|
|
24
|
+
### Added
|
|
25
|
+
- **The learned spec reads a Python package's and a Rust library crate's public surface.** The library public-surface rule (#1063) read TS/JS only, so a Python library or a Rust lib crate got "0 use case(s) … No entry points found". Python: the entry is `<pkg>/__init__.py` (or `src/<pkg>/__init__.py`), the package `pyproject.toml` `[project] name` names, else every top-level package; public names are `__all__` when it lists string literals, else the `from .x import y as y` re-exports and the entry's own public classes and module functions (circle-ir's package visibility, no leading `_`), each followed to the module that declares it. Rust: the entry is `lib.rs` (`[lib] path`, else `src/lib.rs`); the surface is its `pub fn` / `pub struct` / `pub enum` / `pub trait` (visibility from circle-ir's annotations and modifiers; `pub(crate)` left out) and `pub use` re-exports followed into `crate::`/`self::`/`super::` module files; circle-ir has no visibility on imports, so the import line it gives is read to tell `pub use` from `use` (and for the path of a glob). A crate with only `main.rs` stays empty. pallets/click 08b803c: 0 → 8 surface areas, 64 exports; dtolnay/semver 280ebcb: 0 → 2 areas, 7 exports; BurntSushi/memchr bd6068c: 0 → 1 area, 15 exports. Not read yet: items reached only through `pub mod` (not re-exported by `pub use`).
|
|
26
|
+
- **Python and Rust levels give domain rules.** The throw facts behind spec rules (`extractTsRuleFacts`) read Python `raise X("…")` and Rust `return Err(…)`, `bail!("…")` and `anyhow!("…")`; before, only a line holding `throw` counted, so only Java and TS levels had a domain rule. A raise inside a use case is a use-case rule, and one elsewhere is a static rule that the level classifies like any other. A bare throw with a generic message ("invalid", "bad request", "something went wrong") and an internal error (`NotImplementedError`, `AssertionError`) give no Python or Rust rule. TS and Java rules are unchanged: `Error("invalid argument")` (TS) and `IllegalArgumentException("Invalid input")` (Java) keep their rules (cognium-ai#1129 review). circle-ir has no CFG for Python or Rust, so these rules are "may throw", without a condition.
|
|
27
|
+
- **The learned spec reads binaries as entry points: a new use-case kind, `binary`.** A Rust binary with no route and no CLI framework got an empty spec level ("No entry points found"; nine such binaries in axon-overlay). The tree now reads Rust `fn main` in `src/main.rs` (named by `Cargo.toml` `[package] name`), `src/bin/<name>.rs`, `src/bin/<name>/main.rs` and every `[[bin]]` (its `name` and `path`). When `main`, or a same-file function it calls, matches the command-line arguments on string literals (`match args[1].as_str() { "keygen" => …, "job" | "jobs" => … }`, also `Some("keygen")`), each literal arm is one use case (`run overlay keygen`, area = the binary's name), handled by the function the arm calls; flag arms (`"-h"`, `"--help"`) and the catch-all are skipped, and aliases are one use case. Otherwise the binary is one use case on `main`, area `Binaries`. Python `[project.scripts]` (and Poetry's `[tool.poetry.scripts]`) entries are one use case each, on the function the entry names (`pkg/mod.py`, `pkg/mod/__init__.py`, also under `src/`; a Typer or Click object on the line that binds it). New module `src/specifica/binary-entries.ts`; `extractUseCases` takes `binaries` and `scripts`, which the spec tree reads from the `Cargo.toml` / `pyproject.toml` nearest each level file. `EntryKind` gains `'binary'` and `UseCaseResult.counts` a `binary` count; rules.json `useCases[].kind` can now be `binary` (circle-pack's OpenAPI enum in `docs.ts` still lists the six earlier kinds). Hand-rolled HTTP routing inside a binary is not read. A tree with no Rust binary and no `[project.scripts]` is unchanged. A `src/main.rs` is a binary only when a `Cargo.toml` declares it (`[package] name`, or a `[[bin]]`); `src/bin/*` is one by layout alone, so a lone `main.rs` with no manifest stays empty. A binary or script beside a library does not hide it: a crate with `lib.rs` and a binary, or a Python package that declares a script, gets both its binary use cases and the public surface table in spec.md. Manifests are read line by line (new `src/specifica/toml-lines.ts`, also behind `tomlString` and `manifestDependencies`): the multi-line section regexes took 7.9 s on an 80 KB Cargo.toml; a 1 MB one now parses in well under a second. The spec tree reads its manifests (`package.json`, `Cargo.toml`, `pyproject.toml`, `wrangler.*`, `go.mod`) through one reader that refuses a symlink, a path whose real path leaves the repository root, and a file over 256 KiB (`MANIFEST_MAX_BYTES`); each is listed in the new `BuiltTree.skippedManifests` (`too-large` / `symlink` / `outside-root`).
|
|
28
|
+
- **Per-CWE rubric in the batch verify prompt, CWE-78 first, behind `COGNIUM_AI_VERIFY_CWE_RUBRICS=1` (cognium-ai#899).** With the option on, a batch whose sinks include CWE-78 (also spelled `CWE-078`) gets a short rubric after the SINKS list: what makes an OS command injection exploitable (a shell parses the command, or the attacker picks the program) and what makes it safe (a constant program with the value as its own argument and no shell, an allowlist or a strict pattern, not a blocklist). It sits in the request data, so the fixed prompt prefix and provider prefix caching (#244) are unchanged; the verify-cache key gains a `cwe-rubrics/<hash>` part only for those batches. Default off: with the option unset, or for a batch with no rubric CWE, the prompt and cache key are byte-identical to before. New module `src/llm/cwe-rubrics.ts` (`renderCweRubrics`, also exported from `llm/verification`). CWE-502 and CWE-94 rubrics and the taint chain (C.4) are not in this slice; the default flips only on the labelled verify-set measurement on #242.
|
|
29
|
+
- **The batch verifier can refute: `COGNIUM_AI_VERIFY_MODE=explicit-all` (#1143).** By default (`omit-non-tp`) a cost-efficient verifier model lists only TRUE_POSITIVE pairs, so every verdict it returns reads as an approval. With the switch on, every verifier model answers one verdict per submitted pair (TRUE_POSITIVE / FALSE_POSITIVE / UNCERTAIN), the contract thinking models already use, and a missing pair means "not assessed". Unset or `omit-non-tp` keeps the default; any other value is ignored with one warning. The verify-cache and in-process dedup keys carry the mode only when the switch is on, so default keys are unchanged. **Proof beats model:** on the verified branch, a static finding circle-ir backs with a taint flow (`flow_backed: true`) is never removed by the verifier; with no verified finding at its sink it is kept, labelled with what the verifier said (`FALSE_POSITIVE` with `refuted_by: 'verifier'` or `'omission'`, `UNCERTAIN`, or `UNVERIFIED`) and `kept_by: 'flow_backed'`. Findings without that proof can still be refuted away. New counters: `stats.findingsKeptByProof`; scan `meta.verification.findingsKeptByProof` and `promptMode: 'explicit-all'` (each only when set).
|
|
30
|
+
- **Java dead code through Illata, behind a flag (off by default).** `engine: 'illata'` (or `CIRCLE_IR_AI_DEAD_CODE_ENGINE=illata`) sends a Java project's dead-code question to the `illata-query` sidecar: the graph's facts (`facts@2`, Arrow) and the rule text `dead-code/rules/dead-code-java.dl` (shipped in `dist/` by `npm run build`) go to a temporary directory, and its rows map onto the same `DeadCodeResult`. The binary comes from the `illataQueryBin` option, `ILLATA_QUERY_BIN`, then `PATH`; any failure (missing binary, exit code, timeout, bad or short answer) logs one line and answers with circle-ir's `deadCode()`, with `engine.fallback` saying why. Additive types: `engine.name` `'illata'`, `engine.facts` / `program` / `queryMs` / `fallback`, `result.snapshot`, `result.store`, options `illataQueryBin` / `illataTimeoutMs`. With the flag off the binary is never resolved or run, and results are unchanged (#1144).
|
|
31
|
+
|
|
32
|
+
### Fixed
|
|
33
|
+
- **Product scope `product-paths/4`: test shell scripts are tests (cognium-ai#1127 E7).** An SSRF was reported in a test shell script (`curl` to a hard-coded localhost). The rule now leaves out, with reason `test`, a shell script (`.sh`, `.bash`, `.zsh`, `.ksh`) named `test`, `tests`, `test-<name>`, `test_<name>`, `<name>-test(s)` or `<name>_test(s)` anywhere (`test-api.sh`, `src/scripts/test-ssrf.sh`, `services/api/run_tests.sh`), and every shell script in a `test/` or `tests/` directory at any depth (`services/api/test/smoke.sh`, rule `shell-in-test-dir`). `attest.sh`, `latest.sh`, `testing.sh` stay product code, and so does anything under `src/main/` (a test-named script there drops its glob from `patterns`, as the other file markers do). `classify`, `patterns`, `isTestPath`, `testPathPredicate`, `filterToProductScope` and the `excluded_reasons.test` count agree. Default scan, quality, trust and spec results can move; `productScope: false` / `SCOPE_ALL_PATHS=1` still reads every path. On a fixture with 10 such scripts beside 8 product scripts, `scan --no-llm` read 8 of the 10 before (only the two under nested `test/` / `tests/` were dropped, by the test-tree excludes) and 0 after; trust's walker kept all 10 before and 0 after. `rule_version` is now `product-paths/4`.
|
|
34
|
+
- **Static scan findings carry the absolute path in `source.file` and `sink.file` (cognium-ai#1127 note).** circle-ir's `generateFindings()` is given the file's basename, and the static path (and the static fallback after an LLM failure) spread its rows, so `findings[].source.file`, `sink.file` and `alternateSources[].file` held `user.js` while `filePath` was absolute. They are now the absolute path, as CLAUDE.md "Path emission" says; the basename stays as an additive `fileName` on each. SAST-pass rows and the LLM path already emitted absolute paths. The sink-shape filter and the per-sink grouping still read the engine's own value, so which findings are kept does not change. If your tooling matched these fields on the basename, read `fileName` instead.
|
|
35
|
+
- **Secret scan: Azure connection strings and Twilio auth tokens in source files, and Twilio SIDs.** For a file circle-ir parses (`.js`, `.py`, …) the working-tree scan kept only circle-ir's `hardcoded-credential` rows, so a provider shape that rule misses had no second chance: an Azure storage `AccountKey` inside a connection string (the variable is named for the string, not the key) and a Twilio auth token (32 hex) were missed (`benchmark:secrets` pattern-miss 2, box1 res-020). After the engine rows, the scanner now runs a short list of provider patterns over the source file (`azure-connection-string` and `azure-storage-key` from `HISTORY_SCAN_PATTERNS`, and a new `twilio-auth-token`): at most one row per line, never on a line the engine already flagged, shaped as a text-pass row (`patternId: 'hardcoded-credential'`, the provider id in `providerPatternId`). The Azurite emulator account (`devstoreaccount1`) and its published key are not flagged. A 32-hex value is also a hash, so the Twilio token counts only in a file that uses Twilio (`twilio`, or an `AC` account SID in the file); a token in a file that never names Twilio is still missed. An engine named-credential row is dropped when the variable name ends in `SID` and the value is an `AC`/`SK` + 32-hex SID, an identifier (`TWILIO_API_KEY_SID`). History scanning and the text pass are unchanged. The secrets corpus now labels the AWS access key ID on line 7 of `plist/case-01-xml-stripe-keys` (its description already named it). `benchmark:secrets`: TPR 96.4% → 100.0%, case-FPR 0/29 unchanged, extra detections on positives 2 → 0.
|
|
36
|
+
- **Quality test-coverage pass (cognium-ai#1090 item 9).** The `test-coverage` pass score now matches the measured coverage percentage in its findings instead of the whole quality-dimension score. The CLI no longer prints a `Complete` progress line before 100%.
|
|
37
|
+
- **The learned spec reads Django and Django REST Framework routes.** A Django route is registered in `urls.py` and handled in `views.py`, so no single file's `runtime_registrations` holds it, and the spec tree read only those: a Django or DRF app got "0 use case(s) … No entry points found" (HackSoftware/Django-Styleguide-Example a70ef43d on 4.38.0, box3 res-013). The tree now also reads the routes circle-ir's Python graph resolves across files (`buildPythonGraph` entries, framework `django`): `path()`, `re_path()` and `url()` patterns pointing at `APIView` / `GenericAPIView` subclasses (one use case per method the view defines, named after the view: "User list api (GET /api/users)") and at function views, `@api_view` included (method `ANY`). `include()` prefixes are composed from circle-ir's calls in each `urls.py` (`path("api/", include("pkg.urls"))`, the `("pkg.urls", "ns")` tuple, and `url(r'^api/', …)` with its anchors dropped); a URLconf reached through `include(<name of a list>)` keeps its registered paths rather than a guessed prefix. Flask and FastAPI routes still come from each file's registrations only. Django-Styleguide-Example: 0 → 10 use cases in 5 areas; gothinkster/django-realworld-example-app: 0 → 12 in 5. Trees with no Django route are byte-identical (spring-petclinic, cortex, controldeck). Not yet seen, and asked of circle-ir: DRF `router.register` ViewSets, routes inside an inline `include([...])` list, and the verbs of generic views whose handlers DRF defines (`ListCreateAPIView` reads `ANY`).
|
|
38
|
+
- **Scan text report jargon (cognium-ai#1090 item 8).** Default security scan text output humanizes `interprocedural_param` and similar internal finding types; the unbacked-flow note uses plain language instead of `flow_backed`.
|
|
39
|
+
- **Blast radius tests: a re-export search cut at its bound fails closed for its own import only (review of #1103, round 5).** `followImport` stopped at 10,000 (module, name) pairs, and a cut made every TypeScript function count as a plain decorator, so every `known` answer with an `unreached` in the repository became `unknown`, whatever the decorator. The narrowed graph, with fewer modules behind the import, could stay under the bound and answer `known`, so narrowed and whole disagreed. Now:
|
|
40
|
+
- the bound is the larger of 10,000 and 4 times the graph's files (`BLAST_FOLLOW_BUDGET`; `testsOf` option `followMaxStates`, and `followImport`'s new last argument, set it). A search visits each module once per name, so an `export *` closure of any size is followed to its end;
|
|
41
|
+
- a search that is still cut fails closed for that import alone: its decorator may be any declaration a search can reach (`followableNames`): the imported name, every name an `export { … }` list or an `export default` / `export =` exports from, the names those are imported under, and, when one of them may be a default export, every module's default export. Other functions stay as the graph has them.
|
|
42
|
+
|
|
43
|
+
With the bound lowered to 50 under a 60-module `export *` chain, the changed `helper` that nothing calls stays `known` / unreached (it was `unknown`), and the decorator's own change stays `unknown`. A 10,050-module chain is now followed to its end at the default bound.
|
|
44
|
+
- **Blast radius tests: `update` and `data` count in a file that makes Lit or Vue components, not in every file that imports Vue (review of #1103, round 5).** A file that imported anything from `vue` made a plain class's `update` / `data` framework-called, so in a Vue 3 composable (`import { ref } from 'vue'`) or a file with only `import type { Ref } from 'vue'`, an uncalled `Repo.update` answered `unknown` instead of `known` / unreached. The file now counts only when it imports, as a value (`import type` and `type` specifiers are left out), `LitElement`, `ReactiveElement`, `Vue` or `defineComponent` from any module, anything from a class-component package (`vue-class-component`, `vue-property-decorator`, `vue-facing-decorator`, `nuxt-property-decorator`), anything from a Lit package (`html` alone too, and a side-effect `import 'lit'`), `vue`'s default export or the whole of `vue` (`import * as`, `require()`, `import()`), or when its code writes a `@Component` or `@Options` decorator. Lit keeps main's breadth on purpose: a leaf element whose `LitElement` comes through a base class in its own file (`class X extends BaseElement`) usually imports only `html` from `lit`, and its `update` runs under test without a call the graph records; only imports that are all types leave a Lit file out (review of #1124). The last also covers a Vue class whose decorators come through a local wrapper (`import { Component } from './vue-wrap'`) over a `@Component({ template: … })` whose lines do not balance their brackets, which answered `known` / unreached because the header reading stopped inside the decorator's arguments. The class's own header still counts as before (`extends LitElement` anywhere in its heritage clause, `@Component` / `@Options` above it). Not covered: a Lit element whose `LitElement` comes through a base class in another file, in a file that imports nothing from Lit as a value. Telling a plain class from a Lit one there needs each class's heritage from the graph, asked of circle-ir in cogniumhq/cognium-dev#1343.
|
|
45
|
+
- **Product scope `product-paths/3`: Python test packages read the package's own files, singular and plural alike (review of #1109, round 2).** The walk that looks below a `test` directory for a test file also looked inside fixture data, so a Go package `internal/test/` (`helper.go`) with a fixture `testdata/test_input.py` was left out as a test. It now skips fixture, vendored and generated folders and hyphenated example and benchmark folders (`testdata/`, `fixtures/`, `vendor/`, `generated/`, `*-examples/` …). A plural `tests` without `__init__.py` counted only a test file in it, so `mypkg/tests/helpers.py` beside `mypkg/tests/unit/test_core.py` was product code while the same shape under a singular `test` was a test; plural `tests` now looks below it too. A `tests` holding `__init__.py` is still one on that alone, and a singular `test` still is not (Django's public `django/test/`). `rule_version` is now `product-paths/3`.
|
|
46
|
+
- **`testPathPredicate` reads the listing inside folders the rule leaves out for another reason (review of #1109, round 2).** For a path under `examples/`, `vendor/` and the like, it read `isTestPath` from the path alone, so a Maven or Gradle module's test source sets other than `src/test/` (`examples/app/src/androidTest/`, `src/testDebug/`, `vendor/lib/src/integrationTest/`, Kotlin Multiplatform's `samples/kmp/src/commonTest/`) were not tests there, and a Kotlin Multiplatform `src/commonMain/` did not protect what is in it. That matters when such a folder is read anyway (`productScope: false`, or an include that brings it back): those files gave use cases, rules and env reads. It now asks the disk what the walker would: a `src/` beside a build file holding `main` or a `<name>Main` makes its test source sets tests (`src/testFixtures/` stays fixture data) and its source sets product code, `test` / `tests` directories are read as Python test packages, and `test/`, `tests/`, `e2e/`, `cypress/` right under a nested package root are tests. `isTestPath` itself is unchanged. Still read from the path alone there: a `lib/` or `app/` below the first segment, and one that holds its own manifest.
|
|
47
|
+
|
|
48
|
+
Measured against main at 7b202d2f, both from source. The rule classifies every file of spring-petclinic 500158f, cortex c22f406, ControlDeck 69bf259, Django-Styleguide-Example a70ef43 and KaMPKit 4af0200 as before (summaries identical). `testPathPredicate` moves 5 files, all in ControlDeck: `controldeck-web/scripts/e2e/hello-world/` (the hello-world end-to-end test, its stack and its GitHub and gateway fakes) is a test, as `e2e/` right under the `@repo/scripts` package; the rule leaves `scripts/` out as tooling. Blast radius on ControlDeck 69bf259, the 4, 40 and 101-item sets: every item's and the batch's answer is the same as main's (batches 41, 665 and 1,460 tests reached), narrowed equals whole, and `tests: false` is byte-identical apart from the `rule` string.
|
|
49
|
+
- **The learned spec reads Maven plugin goals (controldeck#717).** A Maven plugin's entry points are its goals, `@Mojo(name = "…")` classes run by `execute()`; the spec read neither, so a plugin with no routes or commands showed no Java use case, and the event handlers of a script bundled under `src/main/resources` (OWASP BenchmarkUtils' `bootstrap.js`) were its only use cases. Each `@Mojo` class with a `name` is now a `cli` use case with method `GOAL` (`goal create-scorecard`; spec.md trigger `GOAL create-scorecard`), anchored on `execute()` (the class when it has none), with the same-file calls and domain rules a command gets. Once a goal is found, a bundled script is no longer read as the library surface either. The bundled script's own event-handler use cases (`on click.bs.modal.data-api`) are left out by the next entry.
|
|
50
|
+
- **A library's readable copy beside its minified build is skipped (controldeck#717, the other half).** `bootstrap.js` next to `bootstrap.min.js` was read as first-party code: on OWASP BenchmarkUtils it gave the plugin module 9 of its 14 use cases (`on click.bs.modal.data-api`) and both of its domain rules (Bootstrap's own throws). `preFlightSkip` now skips a `.js`/`.mjs`/`.cjs`/`.css` file when a `.min.`/`-min.` twin sits in the same directory **and** the file opens with the `/*!` licence banner minifiers keep, reason `vendored library copy (bootstrap.js beside bootstrap.min.js)`. A project's own `app.js` beside its own `app.min.js` (no banner), a bannered file with no twin, and a twin in another directory are still read. `SKIP_VENDORED=0` turns it off with the other vendored skips. Every walker that calls `preFlightSkip` follows (spec, scan, dead code, health). BenchmarkUtils, static spec: the plugin module 14 use cases and 2 rules → 5 use cases (its five Maven goals) and 0 rules. The trade-off: a library repository's own bannered `foo.js` beside its own committed `foo.min.js` looks the same and is skipped too; such a repo sets `SKIP_VENDORED=0`. The banner check is `/^\s*\/\*!/` (a byte-order mark is whitespace to `\s`).
|
|
51
|
+
- **Trust reads MCP and agent configs under `.cursor/`, `.vscode/` and `.claude/` (cognium-ai#1056).** `walkAiConfigFiles` skipped every directory whose name starts with a dot, so the configs editors and coding agents keep there (`.cursor/mcp.json`, `.vscode/mcp.json`, a `.claude/settings.json` with `mcpServers`) were never read. It now enters those three; other hidden directories and `WALK_SKIP_DIRS` are still skipped. The walk feeds the excessive-permissions and prompt-injection passes (prompt-injection re-attaches only those three dot trees after product-scope filtering, so default trust still skips other hidden dirs). A repository with such a config can get new AI-safety findings and a lower trust score, or a BLOCKED tier on a critical one.
|
|
52
|
+
- **AI mode keeps `flow_backed`; a finding the static detector never emitted is tagged `origin: 'ai'` (#1141).** With LLM enrichment and the verifier on, `verification.flow_backed` was dropped, so `--flow-backed-only` kept every AI-mode finding. The pattern-match step now forwards circle-ir's taint flows (the tree-cache envelope gains `flows`; its prompt version moves `tree-v2` → `tree-v3`, so cached trees are recomputed once) and the report stamps `flow_backed` on the verified branch and on the no-verdict, refuted and verify-off branches, by circle-ir's own rule (a flow of the same sink type reaches the sink line). A verified finding the static detector never emitted for its sink is kept and tagged `verification.origin: 'ai'`. Legacy callers that pass no flows are unchanged.
|
|
53
|
+
- **A verification that never answered never marks a finding exploitable (#1142).** When the verifier gave no verdict for a finding (timeout, breaker open, parse failure, or the LLM stage throwing into the static fallback), `exploitable` fell back to the static baseline, so a critical or high finding could ship as `exploitable: true` with no verdict. Such findings now get `exploitable: false`, `verification.status: 'skipped'` and a `skip_reason` (`llm-stage-error` for the fallback), keep their static severity and stay `mode: 'attempted'`, `verdict: 'UNVERIFIED'`. With verification off the static baseline is kept, as before. `cognium-ai`'s `exploitable: false` severity cap (#214) skips these findings, so "not asserted" is not demoted as if refuted.
|
|
54
|
+
- **Trust compare matches the doc-coverage summary across differently named roots (#1146, Refs #1145).** The coverage summary is now a project-wide finding key, so two identical trees compared under different directory names no longer report a new/fixed pair for it; root locations relative to the working directory are resolved against the compare root.
|
|
55
|
+
- **A whole-file route's span ends on the file's last line (#1186, Refs #1183).** A file `PAGE` use case cited `endLine` one past the last line on a file ending in a newline; the span now uses the line count with one trailing newline stripped.
|
|
56
|
+
- **Dead code: a field is not reported dead beside a dynamically reached sibling (#1150, Refs #952).** A product-layer guard on circle-ir's `deadCode()`: an instance field is not reported dead when a sibling method is `may-be-live` with unresolved sites (`(this as any)[name]()`); the hidden field is counted as `may-be-live`, so live + may-be-live + dead still equals what `deadCode()` answered. circle-ir 4.24.0 lifts these containers itself (cognium-dev#1366).
|
|
57
|
+
- **Django routes get their `include()` prefixes once on circle-ir 4.24.0 (#1198).** circle-ir 4.24.0 composes the prefixes into each graph route's `path` (`registeredPath` and `mounts` beside it, cognium-dev#1352), and the spec composed them again on top: `url(r'^api/', include('shop.urls'))` gave `/api/api/items`. The spec now puts its own prefixes on the registered path (`registeredPath`, or `path` on older circle-ir), so a route is prefixed once; where it cannot place a URLconf (below `include(<name of a list>)`) the registered path stays, as before, rather than circle-ir's partial prefix (`/shop/items` for a route Django serves at `/login/shop/items`); otherwise it takes circle-ir's composed path. Still works on circle-ir 4.23.0. A function view under DRF's `@api_view(["GET"])` now reads `GET` (circle-ir 4.24.0), not `ANY`; a plain function view stays `ANY`. `GraphRoute` gains `composedPath`.
|
|
58
|
+
|
|
59
|
+
### Known issues
|
|
60
|
+
- Blast radius tests: a regular-expression literal longer than 1,000 characters (`REGEX_MAX_CHARS`) is read as code by both readings of `plainDecoratorNames`, so a backquote or `\/*` in it can hide the plain decorators written after it, and an uncalled function they name can answer `known` / unreached (review of #1103, round 5). The bound keeps the reading linear in the text; 4.38.0's "What it does not cover" did not list it.
|
|
61
|
+
|
|
10
62
|
## [4.38.0] - 2026-11-21
|
|
11
63
|
|
|
12
64
|
Minor, still on circle-ir 4.23.0. Blast radius adds `tests`, the tests that reach a change (#1072); it is on by default and costs more, and `tests: false` restores the earlier cost, with the same answer apart from `tests`. The product-scope rule moves to `product-paths/2` and changes which files it keeps: a test-file marker counts only right before the extension (`r.$id.spec.index.tsx` is product code), and test source sets (Maven, Gradle, Android, Kotlin Multiplatform), .NET test projects and Python test packages are tests wherever they sit, as are test and fixture folders in a package's `lib/` and `cypress/`. So default scan, quality, trust and spec results can move. `productScope: false` / `SCOPE_ALL_PATHS=1` still reads every path, and with it scan now reaches `test/e2e` trees too. The learned spec tree keeps Java packages named `samples`, `spec` or `fixtures` and names the repository level after the repository, and the trust and quality walkers read directories in sorted order. No root export or output field is removed or renamed.
|
|
@@ -68,6 +68,12 @@ export interface WorkflowOutput {
|
|
|
68
68
|
* verifier and omitted from a successful answer. Optional; absent means 0.
|
|
69
69
|
*/
|
|
70
70
|
findingsRefutedByOmission?: number;
|
|
71
|
+
/**
|
|
72
|
+
* Flow-backed findings the verifier did not confirm (FALSE_POSITIVE,
|
|
73
|
+
* UNCERTAIN or no verdict), kept with `verification.kept_by: 'flow_backed'`
|
|
74
|
+
* because the taint flow is proof. Optional; absent means 0.
|
|
75
|
+
*/
|
|
76
|
+
findingsKeptByProof?: number;
|
|
71
77
|
/** cognium-ai#564 — the failure reason(s), present only when a chunk failed. */
|
|
72
78
|
verificationError?: string;
|
|
73
79
|
totalTimeMs: number;
|
|
@@ -167,6 +173,16 @@ taintContext?: {
|
|
|
167
173
|
* index only; the no-verification findings still come from `mergedSources`.
|
|
168
174
|
*/
|
|
169
175
|
detectorSources?: any[];
|
|
176
|
+
/**
|
|
177
|
+
* circle-ir's `taint.flows` (from `runPatternMatch`). With it, every
|
|
178
|
+
* finding carries `verification.flow_backed` — true when a flow of the
|
|
179
|
+
* same sink type reaches the sink line, circle-ir's own rule — so the
|
|
180
|
+
* flow-backed tier works in AI mode. Absent (legacy callers): undefined.
|
|
181
|
+
*/
|
|
182
|
+
flows?: Array<{
|
|
183
|
+
sink_type: string;
|
|
184
|
+
sink_line: number;
|
|
185
|
+
}>;
|
|
170
186
|
}): WorkflowOutput;
|
|
171
187
|
/**
|
|
172
188
|
* Run security analysis on a single file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../../../src/agents/mastra/workflow.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAoC,GAAG,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAQxH,OAAO,KAAK,EACV,SAAS,EAEV,MAAM,0CAA0C,CAAC;AAKlD,OAAO,
|
|
1
|
+
{"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../../../src/agents/mastra/workflow.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAoC,GAAG,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAQxH,OAAO,KAAK,EACV,SAAS,EAEV,MAAM,0CAA0C,CAAC;AAKlD,OAAO,EAAgD,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAgBnG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAwB,KAAK,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACpF,OAAO,EAEL,KAAK,cAAc,EACpB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EACL,gBAAgB,EAChB,UAAU,EACV,SAAS,EACT,UAAU,EACV,UAAU,GACX,MAAM,YAAY,CAAC;AAMpB,MAAM,MAAM,oBAAoB,GAAG,UAAU,GAAG,SAAS,GAAG,aAAa,CAAC;AAE1E,MAAM,WAAW,aAAa;IA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;;;OAIG;IACH,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B;;;;;;;OAOG;IACH,cAAc,CAAC,EAAE,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,MAAM,CAAC;IAClE,gEAAgE;IAChE,iBAAiB,CAAC,EAAE,WAAW,CAAC,eAAe,CAAC,mBAAmB,CAAC,CAAC,CAAC;CACvE,GACA,OAAO,CAAC,cAAc,CAAC,CAuLzB;AAED;;GAEG;AACH,wBAAuB,iBAAiB,CACtC,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE;IACR,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAC5C,SAAS,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAC/B,yDAAyD;IACzD,cAAc,CAAC,EAAE,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,MAAM,CAAC;CACnE,GACA,cAAc,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,GAAG,CAAA;CAAE,CAAC,CA8F9D;AAGD,eAAO,MAAM,wBAAwB;IACnC,EAAE;IACF,GAAG;IACH,MAAM;CACP,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CACrC,gBAAgB,EAAE,MAAM,EACxB,YAAY,EAAE,MAAM,GAAG,SAAS,EAChC,gBAAgB,EAAE,MAAM,GAAG,SAAS,EACpC,aAAa,EAAE,OAAO,GACrB,MAAM,CAmBR"}
|
|
@@ -11,7 +11,7 @@ import { generateFindings, getRuleInfo } from 'circle-ir';
|
|
|
11
11
|
import { isPhantomLineSink, isSuppressedSinkShape } from '../../security-scan/sink-filters.js';
|
|
12
12
|
import { classifySource, classifySourceForVerifier, applyClassificationGate, } from '../../security-scan/source-classifier.js';
|
|
13
13
|
import { shouldGateInterproceduralParam, classifyEntryPointTier, } from '../../analysis/entry-point-detection.js';
|
|
14
|
-
import { getDefaultLLMConfig,
|
|
14
|
+
import { getDefaultLLMConfig, resolveVerifyPromptMode } from '../../llm/config.js';
|
|
15
15
|
import { withLLMContext } from '../../llm/debug-context.js';
|
|
16
16
|
import { activeModelLabel } from '../../llm/model-route.js';
|
|
17
17
|
import { fileNeedsEnrichment } from '../../llm/pre-filter.js';
|
|
@@ -155,6 +155,9 @@ coordinate, dependencyContext) {
|
|
|
155
155
|
// cognium-ai#330 — forward calls so enrichment sinks can be anchored in
|
|
156
156
|
// `runMerge` the same way discovery mode does in `DiscoveryEngine`.
|
|
157
157
|
calls: (result.calls ?? []),
|
|
158
|
+
// `runReport` stamps `verification.flow_backed` from these, as the
|
|
159
|
+
// static scanner does; without them AI mode had no proven-flow tier.
|
|
160
|
+
flows: (result.taint.flows ?? []).map((f) => ({ sink_type: f.sink_type, sink_line: f.sink_line })),
|
|
158
161
|
};
|
|
159
162
|
// cognium-ai#153 — populate persistent tree cache. Disk-write errors
|
|
160
163
|
// never fail the workflow. #158 Round 2 — coordinate is honored by
|
|
@@ -598,7 +601,10 @@ contextProfile) {
|
|
|
598
601
|
}.phases.verification.model);
|
|
599
602
|
// cognium-ai#777 — reasoning models often return `{"pairs":[]}` without assessing
|
|
600
603
|
// pairs; treating omission as refutation over-labels real findings FALSE_POSITIVE.
|
|
601
|
-
|
|
604
|
+
// Under the explicit-all contract (thinking models, or
|
|
605
|
+
// COGNIUM_AI_VERIFY_MODE=explicit-all) a missing pair means "not assessed",
|
|
606
|
+
// and refutation is an explicit FALSE_POSITIVE.
|
|
607
|
+
const treatOmissionAsRefutation = resolveVerifyPromptMode(verifierModel) === 'omit-non-tp';
|
|
602
608
|
if (!enableVerification || mergedSources.length === 0 || mergedSinks.length === 0) {
|
|
603
609
|
return {
|
|
604
610
|
verificationResults: [],
|
|
@@ -844,6 +850,19 @@ taintContext) {
|
|
|
844
850
|
// still reads C+H). Computed once and shared with the no-verification branch.
|
|
845
851
|
const effectiveDfg = dfg ?? { defs: [], uses: [], chains: [] };
|
|
846
852
|
const detectorFindings = generateFindings(mergedSources, mergedSinks, effectiveDfg, filePath, sourceCode, taintContext?.language, taintContext?.sanitizers ?? [], (types ?? []));
|
|
853
|
+
// Same rule as circle-ir's `generateFindings` (findings.ts): backed when a
|
|
854
|
+
// flow of the same sink type reaches the sink line; undefined when no flows
|
|
855
|
+
// were passed ("not asked"), false when they were and none reaches it.
|
|
856
|
+
const flowBackedSinks = new Set((taintContext?.flows ?? [])
|
|
857
|
+
.filter((f) => typeof f.sink_line === 'number')
|
|
858
|
+
.map((f) => `${f.sink_type}@${f.sink_line}`));
|
|
859
|
+
const flowBackedOf = (type, line) => taintContext?.flows === undefined ? undefined : flowBackedSinks.has(`${type}@${line}`);
|
|
860
|
+
const withFlowBacked = (v, type, line) => {
|
|
861
|
+
const fb = flowBackedOf(type, line);
|
|
862
|
+
if (fb === undefined)
|
|
863
|
+
return v;
|
|
864
|
+
return v === null ? { flow_backed: fb } : { ...v, flow_backed: fb };
|
|
865
|
+
};
|
|
847
866
|
// Severity index: the detector over the merged sources plus the static
|
|
848
867
|
// sources the #128 gate dropped (see `taintContext.detectorSources`), so a
|
|
849
868
|
// sink the static scanner reports keeps that severity on the verify path.
|
|
@@ -1030,6 +1049,15 @@ taintContext) {
|
|
|
1030
1049
|
reasoning_source: hasReasoning ? 'llm' : 'template',
|
|
1031
1050
|
reasoning: hasReasoning ? reasoning : verification.reasoning,
|
|
1032
1051
|
};
|
|
1052
|
+
verification = withFlowBacked(verification, sink.type, sink.line);
|
|
1053
|
+
// A finding the static detector never emitted for this sink exists
|
|
1054
|
+
// only because the AI (enrichment + verifier) produced it. Tag it so
|
|
1055
|
+
// scoring can count it apart from verified static findings; kept,
|
|
1056
|
+
// not dropped (see the #264 note above). `graph_path_exists: false`
|
|
1057
|
+
// is not enough on its own: static findings can carry it too.
|
|
1058
|
+
if (detectorSeverity === undefined) {
|
|
1059
|
+
verification = { ...verification, origin: 'ai' };
|
|
1060
|
+
}
|
|
1033
1061
|
const vuln = {
|
|
1034
1062
|
id: `vuln:${vr.sourceId}:${vr.sinkId}`,
|
|
1035
1063
|
// cognium-ai#146 — surface the sink type at the vulnerability
|
|
@@ -1148,7 +1176,40 @@ taintContext) {
|
|
|
1148
1176
|
};
|
|
1149
1177
|
const verifiedBranch = verificationEnabled && verificationResults.length > 0;
|
|
1150
1178
|
const verifiedLocs = new Set(vulnerabilities.map((v) => `${v.sink?.line}:${v.type}`));
|
|
1151
|
-
|
|
1179
|
+
// Proof beats model. A static finding circle-ir backs with a taint flow
|
|
1180
|
+
// (`flow_backed: true`) is never removed by the verifier: when no verified
|
|
1181
|
+
// finding covers its sink, it is kept and labelled with what the verifier
|
|
1182
|
+
// said (FALSE_POSITIVE, explicit or by omission; UNCERTAIN; or no verdict),
|
|
1183
|
+
// plus `kept_by: 'flow_backed'`. Findings without that proof may still be
|
|
1184
|
+
// refuted away. A pair the verifier confirmed but a gate above dropped
|
|
1185
|
+
// (sink shape, FRAMEWORK_INTERNAL source) is a gate decision, not the
|
|
1186
|
+
// model's, and stays dropped.
|
|
1187
|
+
const verdictByPair = new Map();
|
|
1188
|
+
for (const vr of verificationResults) {
|
|
1189
|
+
const sourceLine = parseInt(String(vr.sourceId).split(':')[1], 10);
|
|
1190
|
+
const sinkLine = parseInt(String(vr.sinkId).split(':')[1], 10);
|
|
1191
|
+
verdictByPair.set(`${sourceLine}:${sinkLine}`, vr.result);
|
|
1192
|
+
}
|
|
1193
|
+
const verdictsOf = (finding) => {
|
|
1194
|
+
const srcs = finding.evidence?.sources ?? [{ line: finding.source.line }];
|
|
1195
|
+
return srcs
|
|
1196
|
+
.map((s) => verdictByPair.get(`${s.line}:${finding.sink.line}`))
|
|
1197
|
+
.filter((r) => r !== undefined);
|
|
1198
|
+
};
|
|
1199
|
+
const keptByProof = (finding) => verifiedBranch &&
|
|
1200
|
+
flowBackedOf(finding.type, finding.sink.line) === true &&
|
|
1201
|
+
!verdictsOf(finding).some((r) => r.verdict === 'TRUE_POSITIVE');
|
|
1202
|
+
const explicitVerdictOf = (finding, verdict) => verdictsOf(finding).find((r) => r.verdict === verdict);
|
|
1203
|
+
const verifierNarrative = (r) => {
|
|
1204
|
+
const reasoning = String(r?.reasoning ?? '').trim();
|
|
1205
|
+
return {
|
|
1206
|
+
reasoning_source: reasoning.length > 0 ? 'llm' : 'template',
|
|
1207
|
+
reasoning: reasoning.length > 0 ? reasoning : 'The LLM verifier gave no reasoning.',
|
|
1208
|
+
confidence: typeof r?.confidence === 'number' ? r.confidence : 0,
|
|
1209
|
+
};
|
|
1210
|
+
};
|
|
1211
|
+
const withProofKeep = (finding, v) => keptByProof(finding) ? { ...v, graph_path_exists: true, kept_by: 'flow_backed' } : v;
|
|
1212
|
+
if (!verifiedBranch || failedPairKeys.size > 0 || taintContext?.flows !== undefined) {
|
|
1152
1213
|
// #26: No verification — delegate to circle-ir's `generateFindings()`
|
|
1153
1214
|
// instead of the previous N×M source×sink cross-product.
|
|
1154
1215
|
//
|
|
@@ -1182,10 +1243,10 @@ taintContext) {
|
|
|
1182
1243
|
// the FP gap on cognium-ai #90–#94).
|
|
1183
1244
|
// #264 — reuse the detector index computed once above (parity gate shares it).
|
|
1184
1245
|
// cognium-ai#564 — on the verified branch only the failed-chunk pairs'
|
|
1185
|
-
// findings
|
|
1186
|
-
// verified finding.
|
|
1246
|
+
// findings (and the flow-backed ones kept by proof, above) are emitted
|
|
1247
|
+
// here, and never one whose sink already carries a verified finding.
|
|
1187
1248
|
const findings = verifiedBranch
|
|
1188
|
-
? detectorFindings.filter((f) => hitsFailedPair(f) && !verifiedLocs.has(`${f.sink.line}:${f.type}`))
|
|
1249
|
+
? detectorFindings.filter((f) => (hitsFailedPair(f) || keptByProof(f)) && !verifiedLocs.has(`${f.sink.line}:${f.type}`))
|
|
1189
1250
|
: detectorFindings;
|
|
1190
1251
|
// Map circle-ir Finding[] back into the legacy workflow vulnerability
|
|
1191
1252
|
// shape so existing consumers (cognium-ai CLI, circle-pack API) don't
|
|
@@ -1254,9 +1315,9 @@ taintContext) {
|
|
|
1254
1315
|
// says the verifier never answered, so downstream keeps the static
|
|
1255
1316
|
// exploitability and severity (fail open) instead of treating the
|
|
1256
1317
|
// finding as refuted.
|
|
1257
|
-
verification: !verificationEnabled
|
|
1318
|
+
verification: withFlowBacked(!verificationEnabled
|
|
1258
1319
|
? null // pure static path — no LLM verification attempted
|
|
1259
|
-
: hitsFailedPair(finding)
|
|
1320
|
+
: withProofKeep(finding, hitsFailedPair(finding)
|
|
1260
1321
|
? {
|
|
1261
1322
|
verdict: 'UNVERIFIED',
|
|
1262
1323
|
attempted: true,
|
|
@@ -1264,25 +1325,47 @@ taintContext) {
|
|
|
1264
1325
|
mode: 'attempted',
|
|
1265
1326
|
verification_error: verificationError ?? 'verification_chunk_failed',
|
|
1266
1327
|
}
|
|
1267
|
-
:
|
|
1328
|
+
: explicitVerdictOf(finding, 'FALSE_POSITIVE')
|
|
1268
1329
|
? {
|
|
1269
|
-
//
|
|
1270
|
-
// (
|
|
1271
|
-
//
|
|
1272
|
-
// recall on every LLM scan, which is a product decision;
|
|
1273
|
-
// labelling it lets consumers see the refutation.
|
|
1330
|
+
// The verifier refuted a pair behind this finding explicitly
|
|
1331
|
+
// (explicit-all contract). Only reached for a finding kept
|
|
1332
|
+
// by proof; without a flow the refutation drops it.
|
|
1274
1333
|
verdict: 'FALSE_POSITIVE',
|
|
1275
1334
|
attempted: true,
|
|
1276
1335
|
llm_verified: false,
|
|
1277
1336
|
mode: 'llm',
|
|
1278
|
-
refuted_by: '
|
|
1279
|
-
|
|
1280
|
-
reasoning: 'Submitted to the LLM verifier, which did not confirm it: the batch verifier ' +
|
|
1281
|
-
'omits every pair it does not judge a TRUE_POSITIVE (cognium-ai#471).',
|
|
1282
|
-
confidence: 0,
|
|
1337
|
+
refuted_by: 'verifier',
|
|
1338
|
+
...verifierNarrative(explicitVerdictOf(finding, 'FALSE_POSITIVE')),
|
|
1283
1339
|
exploitability: 'none',
|
|
1284
1340
|
}
|
|
1285
|
-
:
|
|
1341
|
+
: verdictsOf(finding).length === 0 && refutedByOmission(finding)
|
|
1342
|
+
? {
|
|
1343
|
+
// cognium-ai#471 — the verifier answered, and its answer
|
|
1344
|
+
// (per the batch prompt's omit-non-TP contract) is "not a
|
|
1345
|
+
// true positive". Kept, not dropped: dropping would change
|
|
1346
|
+
// recall on every LLM scan, which is a product decision;
|
|
1347
|
+
// labelling it lets consumers see the refutation.
|
|
1348
|
+
verdict: 'FALSE_POSITIVE',
|
|
1349
|
+
attempted: true,
|
|
1350
|
+
llm_verified: false,
|
|
1351
|
+
mode: 'llm',
|
|
1352
|
+
refuted_by: 'omission',
|
|
1353
|
+
reasoning_source: 'template',
|
|
1354
|
+
reasoning: 'Submitted to the LLM verifier, which did not confirm it: the batch verifier ' +
|
|
1355
|
+
'omits every pair it does not judge a TRUE_POSITIVE (cognium-ai#471).',
|
|
1356
|
+
confidence: 0,
|
|
1357
|
+
exploitability: 'none',
|
|
1358
|
+
}
|
|
1359
|
+
: explicitVerdictOf(finding, 'UNCERTAIN')
|
|
1360
|
+
? {
|
|
1361
|
+
verdict: 'UNCERTAIN',
|
|
1362
|
+
attempted: true,
|
|
1363
|
+
llm_verified: false,
|
|
1364
|
+
mode: 'llm',
|
|
1365
|
+
...verifierNarrative(explicitVerdictOf(finding, 'UNCERTAIN')),
|
|
1366
|
+
}
|
|
1367
|
+
: { verdict: 'UNVERIFIED', attempted: true, llm_verified: false, mode: 'attempted' }), // #331 three-state
|
|
1368
|
+
finding.type, finding.sink.line),
|
|
1286
1369
|
// #26: surface the provenance label so downstream consumers
|
|
1287
1370
|
// (cognium-ai CLI output, SARIF emitter) can distinguish
|
|
1288
1371
|
// static-only / LLM-only / mixed findings without re-deriving.
|
|
@@ -1311,6 +1394,9 @@ taintContext) {
|
|
|
1311
1394
|
// cognium-ai#471 — findings kept with `verdict: 'FALSE_POSITIVE'`
|
|
1312
1395
|
// because the verifier omitted (refuted) every pair behind them.
|
|
1313
1396
|
findingsRefutedByOmission: vulnerabilities.filter((v) => v.verification?.refuted_by === 'omission').length,
|
|
1397
|
+
// Flow-backed findings the verifier did not confirm, kept because the
|
|
1398
|
+
// taint flow is proof (`kept_by: 'flow_backed'`).
|
|
1399
|
+
findingsKeptByProof: vulnerabilities.filter((v) => v.verification?.kept_by === 'flow_backed').length,
|
|
1314
1400
|
...(verificationError !== undefined ? { verificationError } : {}),
|
|
1315
1401
|
totalTimeMs: patternMatchTimeMs + enrichTimeMs + verifyTimeMs,
|
|
1316
1402
|
},
|
|
@@ -1418,7 +1504,12 @@ export async function analyzeFile(filePath, sourceCode, options) {
|
|
|
1418
1504
|
treatOmissionAsRefutation: verifyResult.treatOmissionAsRefutation,
|
|
1419
1505
|
},
|
|
1420
1506
|
// cognium-ai#460 — full generateFindings argument list.
|
|
1421
|
-
{
|
|
1507
|
+
{
|
|
1508
|
+
language,
|
|
1509
|
+
sanitizers: patternResult.sanitizers,
|
|
1510
|
+
detectorSources: patternResult.patternSources,
|
|
1511
|
+
flows: patternResult.flows,
|
|
1512
|
+
});
|
|
1422
1513
|
// cognium-ai#154 (L5c) — surface the cluster vector extracted while the
|
|
1423
1514
|
// IR was live in `runPatternMatch`. Keeps `runReport`'s signature
|
|
1424
1515
|
// untouched (its job is source×sink → vuln synthesis; the vector is
|
|
@@ -1475,7 +1566,12 @@ export async function* analyzeFileStream(filePath, sourceCode, options) {
|
|
|
1475
1566
|
treatOmissionAsRefutation: verifyResult.treatOmissionAsRefutation,
|
|
1476
1567
|
},
|
|
1477
1568
|
// cognium-ai#460 — full generateFindings argument list.
|
|
1478
|
-
{
|
|
1569
|
+
{
|
|
1570
|
+
language,
|
|
1571
|
+
sanitizers: patternResult.sanitizers,
|
|
1572
|
+
detectorSources: patternResult.patternSources,
|
|
1573
|
+
flows: patternResult.flows,
|
|
1574
|
+
});
|
|
1479
1575
|
yield { step: 'report', status: 'completed', data: reportResult };
|
|
1480
1576
|
}
|
|
1481
1577
|
// Legacy export for compatibility
|