@clear-capabilities/agentic-security-scanner 0.149.4 → 0.150.2

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.
Files changed (96) hide show
  1. package/CHANGELOG.md +138 -0
  2. package/bin/agentic-security.js +533 -2
  3. package/dist/1122.index.js +16 -16
  4. package/dist/1208.index.js +23 -0
  5. package/dist/1301.index.js +3 -3
  6. package/dist/1310.index.js +3161 -0
  7. package/dist/1379.index.js +3 -3
  8. package/dist/1444.index.js +3 -3
  9. package/dist/1660.index.js +1 -1
  10. package/dist/1700.index.js +5 -5
  11. package/dist/1905.index.js +107 -12
  12. package/dist/1920.index.js +10 -10
  13. package/dist/2238.index.js +4 -4
  14. package/dist/2271.index.js +3 -3
  15. package/dist/2432.index.js +8 -8
  16. package/dist/2659.index.js +1 -1
  17. package/dist/2826.index.js +2 -2
  18. package/dist/2830.index.js +3 -3
  19. package/dist/2923.index.js +1 -1
  20. package/dist/3001.index.js +4 -4
  21. package/dist/3117.index.js +4 -4
  22. package/dist/3180.index.js +9 -9
  23. package/dist/3276.index.js +1 -1
  24. package/dist/3415.index.js +1 -1
  25. package/dist/3499.index.js +1 -1
  26. package/dist/3518.index.js +4 -4
  27. package/dist/3736.index.js +7 -7
  28. package/dist/3839.index.js +4 -4
  29. package/dist/4113.index.js +441 -418
  30. package/dist/4265.index.js +4 -4
  31. package/dist/4384.index.js +8 -3
  32. package/dist/4399.index.js +292 -0
  33. package/dist/4547.index.js +2 -2
  34. package/dist/4863.index.js +6 -6
  35. package/dist/4970.index.js +2 -2
  36. package/dist/5051.index.js +15 -15
  37. package/dist/5144.index.js +4 -4
  38. package/dist/5333.index.js +8 -8
  39. package/dist/5343.index.js +2 -2
  40. package/dist/5350.index.js +6 -6
  41. package/dist/5561.index.js +1 -1
  42. package/dist/5637.index.js +10 -5
  43. package/dist/5724.index.js +21642 -0
  44. package/dist/5756.index.js +588 -0
  45. package/dist/5830.index.js +3 -3
  46. package/dist/6257.index.js +170 -0
  47. package/dist/6626.index.js +5 -5
  48. package/dist/6662.index.js +1 -1
  49. package/dist/6675.index.js +4 -4
  50. package/dist/6730.index.js +10 -10
  51. package/dist/6829.index.js +4 -4
  52. package/dist/6944.index.js +2 -2
  53. package/dist/6994.index.js +143 -0
  54. package/dist/7039.index.js +541 -0
  55. package/dist/7178.index.js +11 -6
  56. package/dist/7227.index.js +3 -3
  57. package/dist/7552.index.js +2 -2
  58. package/dist/7709.index.js +2 -2
  59. package/dist/7838.index.js +1037 -0
  60. package/dist/8218.index.js +4 -4
  61. package/dist/8476.index.js +4 -4
  62. package/dist/8513.index.js +8 -8
  63. package/dist/8520.index.js +1 -1
  64. package/dist/8752.index.js +4 -4
  65. package/dist/9207.index.js +2 -2
  66. package/dist/9220.index.js +5 -5
  67. package/dist/9390.index.js +6 -6
  68. package/dist/9503.index.js +2 -2
  69. package/dist/9560.index.js +3221 -0
  70. package/dist/957.index.js +127 -0
  71. package/dist/9801.index.js +1 -1
  72. package/dist/9824.index.js +5 -5
  73. package/dist/agentic-security.mjs +23 -23
  74. package/dist/agentic-security.mjs.sha256 +1 -1
  75. package/package.json +4 -3
  76. package/src/discovery/disprove.js +6 -1
  77. package/src/discovery/hunter.js +10 -1
  78. package/src/discovery/llm-invoke.js +77 -0
  79. package/src/egress/policy.js +11 -1
  80. package/src/egress/redact.js +1 -1
  81. package/src/engine.js +37 -1
  82. package/src/llm-validator/agent-loop.js +215 -0
  83. package/src/llm-validator/agent-tools.js +271 -0
  84. package/src/llm-validator/explain-proposal.js +106 -0
  85. package/src/llm-validator/fix-proposal.js +149 -0
  86. package/src/llm-validator/index.js +51 -3
  87. package/src/llm-validator/model-capabilities.js +269 -0
  88. package/src/llm-validator/model-probe.js +232 -0
  89. package/src/llm-validator/model-status.js +27 -0
  90. package/src/llm-validator/ollama-provider.js +382 -0
  91. package/src/llm-validator/oom-feedback.js +69 -0
  92. package/src/llm-validator/poc-proposal.js +122 -0
  93. package/src/llm-validator/providers.js +75 -0
  94. package/src/llm-validator/redact.js +177 -11
  95. package/src/report/index.js +33 -0
  96. package/src/sast/java-ast-folding.js +18 -2
package/CHANGELOG.md CHANGED
@@ -10,6 +10,144 @@
10
10
 
11
11
 
12
12
 
13
+ ## 0.150.2 - Two adversarial-review passes on 0.150.0's Ollama support: redaction, disclosure, and robustness fixes
14
+
15
+ 0.150.0's offline-Ollama release was put through two rounds of adversarial premortem review after
16
+ shipping. Both surfaced real gaps; this release closes them.
17
+
18
+ **Security — secret redaction (the most important fix here).** The general-purpose `redactSecrets`
19
+ function every Ollama-backed role (`fix`/`explain`/`poc`, the `ask` agent loop's `read_file`/
20
+ `search_code` tools) routes untrusted file content through before it reaches a model had several
21
+ real gaps, found and closed in order as review went deeper:
22
+
23
+ 1. Unquoted `.env`/shell-export syntax (`DB_PASSWORD=x`, no quotes) evaded the existing
24
+ quote-requiring pattern entirely — this was a previously-documented, never-fixed-at-the-general-
25
+ level gap (`secret-redaction.test.js`'s own long-standing comment named it).
26
+ 2. Compound identifiers joined by `_`/`-` (`DB_PASSWORD`, `STRIPE_API_KEY`) didn't match even in the
27
+ already-supported quoted form, because a plain `\b` treats `_` as a word character.
28
+ 3. A second review pass found the above fix was narrower than the real threat surface: **camelCase**
29
+ compounds (`authToken`, `apiSecret`), a **JSON-quoted key** (`"password": "value"` — the closing
30
+ quote wasn't consumed before the operator), **YAML** `key: value` syntax (added, deliberately
31
+ scoped to `.yml`/`.yaml` files only, to avoid colliding with the already-tested TypeScript
32
+ type-annotation and JS object-literal-key exclusions), and a secret **split across a string
33
+ concatenation** (`"Super" + "Secret123"` — only the first segment was redacted, leaking the tail)
34
+ all still leaked. All four are fixed, each with an explicit false-positive regression test
35
+ (`primaryKey`/`cacheKey` must not redact; `password: string;` in a `.ts` file must not redact;
36
+ ordinary string-building with no secret-shaped key name must not redact).
37
+
38
+ **Governance — the "AI Assistance" report's role-scope disclosure had a blind spot.** 0.150.0 added
39
+ a report block scoped to the `validate` role, with a warning when another role resolves to a remote
40
+ provider — but `hunt` (the heaviest LLM-driven discovery work) is deliberately not one of
41
+ `providers.js`'s per-role-overridable roles, so it could never appear in that warning, by
42
+ construction. `hunt` is now checked explicitly.
43
+
44
+ **Robustness.**
45
+ - The wall-clock/per-call timeout mismatch in the `ask` agent loop (a slow call could exceed the
46
+ loop's own overall budget, and raising the documented remedy for slow models did nothing to help)
47
+ is fixed and was verified against two real installed Ollama models on real hardware
48
+ (`gemma4:e4b`, `qwen3.5:9b`) — both complete a live tool-calling round trip within the new budget.
49
+ - The capability-probe cache now has a 30-day safety-net TTL and a `--force` flag
50
+ (`agentic-security models test <model> --force`), on top of its existing version+digest+name key.
51
+ - Added `AGENTIC_SECURITY_OLLAMA_DISABLED=1`, a kill switch checked in the one function every Ollama
52
+ call path resolves through — closes a gap where a per-role override could survive an operator
53
+ unsetting only the global preset during an incident.
54
+ - `agentic-security fix`'s Ollama-proposed-patch path now retries exactly once with the
55
+ deterministic gate's own rejection reason fed back into the prompt, instead of asking an
56
+ identical (temperature-0) question and getting an identical bad patch back. Automated test
57
+ coverage added (`test/cli/fix-retry.test.js`); previously this had only ever been verified by a
58
+ single manual run.
59
+ - A real, observed out-of-memory failure is now recorded per-model and surfaced as a warning
60
+ wherever that model is used again — including proactively in the `ask` loop itself, not only in
61
+ `models doctor` (a user who never runs `doctor` used to get no warning at all before repeating the
62
+ same failure).
63
+ - Built the PRD's own required opt-in live-model contract tier (`AGENTIC_SECURITY_OLLAMA_E2E=1 npm
64
+ run test:ollama-e2e`), which did not exist at 0.150.0 despite being an explicit requirement — run
65
+ against two real installed models, all 7 required contract checks pass. This tests the WIRE
66
+ CONTRACT (valid structured output, a real tool-call round trip, prompt-injection resistance,
67
+ graceful context-overflow handling), not output QUALITY — a model-quality benchmark suite remains
68
+ future work, and `docs/guides/ollama.md` says so explicitly rather than letting contract-passing
69
+ read as quality-proven.
70
+
71
+ **Documentation.** `docs/guides/ollama.md` gained an honest statement of the Ollama supply-chain
72
+ trust boundary (no Sigstore-equivalent verification exists for the `ollama` binary or pulled model
73
+ weights, unlike this project's own npm dependencies) and a doc-drift test
74
+ (`test/ollama-doc-drift.test.js`) that fails if the guide's stated numeric defaults (timeouts,
75
+ context sizes, cache TTL, the tool-loop iteration ceiling) ever diverge from the real source
76
+ constants — verified by deliberately breaking one and confirming the test catches it.
77
+
78
+ **Clarification, not a correction, to 0.150.0's own wording** (this project's changelog convention
79
+ is to never rewrite a past entry): "the same offline guarantee the existing `local` preset already
80
+ made — nothing leaves the machine" describes LLM inference traffic only. The same scan still makes
81
+ separate, deterministic OSV/KEV/EPSS network calls unless `AGENTIC_SECURITY_OFFLINE=1` is also set —
82
+ `docs/guides/ollama.md` already said this; this entry says it here too, next to the original claim.
83
+ Separately, PRD §26 asked for a combined validate/verify/explain/fix/hunt "AI Assistance" summary;
84
+ what shipped in 0.150.0 measures the `validate` role only (the one role that runs automatically
85
+ during a plain `scan`) — `docs/guides/ollama.md` and this entry disclose the scope-down; the other
86
+ five roles are each single-finding or discovery-run commands with no natural combined-scan moment to
87
+ summarize.
88
+
89
+ ## 0.150.1 - Fix 0.150.0's release-gate failure: @babel/core dependency currency
90
+
91
+ 0.150.0's tag push failed `release.yml`'s gate on its one network-dependent, deliberately-excluded-
92
+ from-local-pre-push check: `scanner`'s `@babel/core` had drifted to 8.0.1 against a since-published
93
+ 8.0.5 on the registry — nothing to do with the Ollama work itself, just registry drift between when
94
+ local verification ran and when the tag reached the clean CI runner. `npm install @babel/core@8.0.5`
95
+ (already within the existing `^8.0.1` semver range) resolves it; `npm run test:smoke` and
96
+ `npm run test:sast` (731 tests) both pass unchanged against the bump. No functional change beyond
97
+ the dependency bump — see 0.150.0's entry for the actual release content.
98
+
99
+ ## 0.150.0 - Offline Ollama support: local models as a first-class provider, not a workaround
100
+
101
+ Every LLM-backed role in this project (`validate`, `verify`, `explain`, `fix`, `poc`, `logic`, `hunt`)
102
+ can now run entirely against a local Ollama install, with the same offline guarantee the existing
103
+ `local` preset already made — nothing leaves the machine unless an operator explicitly opts into a
104
+ remote host — and with zero change to `local`/BYO/`anthropic`/`openai`/`gemini` behavior.
105
+
106
+ 1. **New `ollama` provider** (`src/llm-validator/ollama-provider.js`), a distinct preset from `local`:
107
+ speaks Ollama's native `/api/chat` (messages array, JSON-schema-constrained structured output,
108
+ native tool calling, `think`, `keep_alive`), not the generic `{prompt, model}` shape `local` keeps
109
+ forever for its own existing consumers. Loopback enforced by default, with a named escape hatch
110
+ (`AGENTIC_SECURITY_OLLAMA_ALLOW_REMOTE=1`) for an explicitly-configured remote Ollama server —
111
+ never an accidental one. `AGENTIC_SECURITY_LLM_PRESET=ollama` plus per-role `_MODEL_<ROLE>`
112
+ overrides work exactly like every existing provider.
113
+ 2. **Every role now has a real call site.** `fix`/`explain`/`poc` had reserved env vars and nothing
114
+ that ever invoked them; each is real now: `agentic-security fix` falls back to an Ollama-proposed
115
+ patch when no deterministic one exists (verified through the exact same `applyVerifiedFix`
116
+ rescan/lint/test gate a deterministic patch already goes through — no new bypass path),
117
+ `agentic-security triage --explain <id>` and `--poc <id>` add read-only, narrative-only AI
118
+ assistance to triage, visually separated from deterministic evidence and forbidden from
119
+ fabricating exploit confirmation, cost, or compliance claims.
120
+ 3. **Model capability detection**, three layers, cheapest first: Ollama's own `/api/show` metadata
121
+ (authoritative where present), a non-authoritative family hint (Qwen 3.5, Qwen 3 Coder, Gemma 4,
122
+ FunctionGemma, and more — read from what's installed, never a hardcoded allowlist), and an opt-in
123
+ runtime probe (a real structured-output request, a real one-tool-call request) cached to disk by
124
+ Ollama version + model digest + model name so it never repeats needlessly. `agentic-security
125
+ models test <model>` runs it on demand; `models doctor`/`models inspect --probe` surface it.
126
+ 4. **RAM-aware model admission** — 8GB and 16GB (Qwen/Gemma) memory profiles, each trying its target
127
+ context, then a reduced context, then a smaller model, before ever falling back to
128
+ deterministic-only. Never falls back to a cloud provider under any circumstance.
129
+ 5. **A bounded local agent loop** (`agentic-security ask "<question>" [target]`): free-form Q&A with
130
+ read-only tool access (`read_file`, `list_files`, `search_code`, `read_finding`) confined to the
131
+ scan root, symlink-safe, secret-redacted, every tool result framed as untrusted data before it
132
+ re-enters the model's context. No write or execute tool exists in this cut. Hard-terminates after
133
+ 12 tool-call iterations or a 5-minute wall clock, whichever comes first; a model requesting an
134
+ unregistered tool ends the loop immediately as a policy violation, not a retry.
135
+ 6. **`agentic-security setup --llm ollama [--model <name>]`** discovers the local server, lists
136
+ installed models, and picks a sane default for the detected RAM tier (or uses the one you name) —
137
+ noninteractive throughout, matching every other command in this CLI, rather than introducing this
138
+ codebase's first interactive prompt.
139
+ 7. **Per-scan AI Assistance reporting.** Fixed a real, pre-existing gap along the way: the validator's
140
+ own provider matrix and per-finding model-status summary were computed on every scan and then
141
+ silently discarded before reaching any report. `agentic-security scan` now prints provider, model,
142
+ egress mode, and validate-call success/refusal/failure counts when a model tier actually ran —
143
+ worded as "LLM inference was loopback-only," never as "this scan was fully offline," which is a
144
+ separate claim about the deterministic OSV/KEV/EPSS network path this line does not describe.
145
+
146
+ Full docs at `docs/guides/ollama.md`. See `agentic-security-ollama-offline-prd.md`'s own Definition of
147
+ Done section for the complete requirements matrix this release was built against; local benchmark
148
+ suite / model-quality-history-by-digest (the PRD's own explicitly lowest-priority stretch scope) are
149
+ the one tracked remainder.
150
+
13
151
  ## 0.149.4 - Fix 0.149.3's vendor/ gap: populate it in `prepare`, not only `build`
14
152
 
15
153
  0.149.3's `vendor/java-parser/` was only ever populated by `npm run build` (`scripts/vendor-java-parser.mjs`