@clear-capabilities/agentic-security-scanner 0.79.0 → 0.84.1
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/dist/178.index.js +1 -1
- package/dist/333.index.js +283 -0
- package/dist/384.index.js +1 -1
- package/dist/637.index.js +1 -1
- package/dist/838.index.js +1 -1
- package/dist/839.index.js +170 -0
- package/dist/985.index.js +140 -1
- package/dist/agentic-security.mjs +10 -10
- package/dist/agentic-security.mjs.sha256 +1 -1
- package/package.json +7 -5
- package/src/.agentic-security/findings.json +117732 -0
- package/src/.agentic-security/last-scan.json +117732 -0
- package/src/.agentic-security/last-scan.json.sig +1 -0
- package/src/.agentic-security/scan-history.json +12946 -0
- package/src/.agentic-security/streak.json +21 -0
- package/src/dataflow/.agentic-security/findings.json +6086 -0
- package/src/dataflow/.agentic-security/last-scan.json +6086 -0
- package/src/dataflow/.agentic-security/last-scan.json.sig +1 -0
- package/src/dataflow/.agentic-security/scan-history.json +250 -0
- package/src/dataflow/.agentic-security/streak.json +21 -0
- package/src/dataflow/cross-service-taint.js +201 -0
- package/src/dataflow/formal-verify.js +204 -0
- package/src/dataflow/ifds-precise.js +222 -0
- package/src/dataflow/k2-summary-cache.js +153 -0
- package/src/dataflow/lib-taint-summaries.js +198 -0
- package/src/dataflow/privacy-taint.js +205 -0
- package/src/dataflow/smt-feasibility.js +189 -0
- package/src/engine.js +825 -127
- package/src/ir/.agentic-security/findings.json +4011 -0
- package/src/ir/.agentic-security/last-scan.json +4011 -0
- package/src/ir/.agentic-security/last-scan.json.sig +1 -0
- package/src/ir/.agentic-security/scan-history.json +193 -0
- package/src/ir/.agentic-security/streak.json +20 -0
- package/src/ir/cpp-preprocessor.js +142 -0
- package/src/ir/csharp-ir.js +604 -0
- package/src/ir/universal-ir.js +403 -0
- package/src/mcp/.agentic-security/findings.json +8632 -0
- package/src/mcp/.agentic-security/last-scan.json +8632 -0
- package/src/mcp/.agentic-security/last-scan.json.sig +1 -0
- package/src/mcp/.agentic-security/scan-history.json +331 -0
- package/src/mcp/.agentic-security/streak.json +20 -0
- package/src/mcp/tools.js +140 -1
- package/src/posture/.agentic-security/findings.json +77181 -0
- package/src/posture/.agentic-security/last-scan.json +77181 -0
- package/src/posture/.agentic-security/last-scan.json.sig +1 -0
- package/src/posture/.agentic-security/scan-history.json +8904 -0
- package/src/posture/.agentic-security/streak.json +21 -0
- package/src/posture/api-contract.js +193 -0
- package/src/posture/attack-taxonomy.js +227 -0
- package/src/posture/auditor-walkthrough.js +252 -0
- package/src/posture/claude-authorship.js +197 -0
- package/src/posture/compliance-frameworks/.agentic-security/findings.json +80 -0
- package/src/posture/compliance-frameworks/.agentic-security/last-scan.json +80 -0
- package/src/posture/compliance-frameworks/.agentic-security/last-scan.json.sig +1 -0
- package/src/posture/compliance-frameworks/.agentic-security/scan-history.json +90 -0
- package/src/posture/compliance-frameworks/.agentic-security/streak.json +22 -0
- package/src/posture/compliance-frameworks/ccpa.json +32 -0
- package/src/posture/compliance-frameworks/eu-ai-act.json +51 -0
- package/src/posture/compliance-frameworks/gdpr.json +45 -0
- package/src/posture/compliance-frameworks/hipaa-security-rule.json +56 -0
- package/src/posture/compliance-frameworks/nist-ai-600-1.json +51 -0
- package/src/posture/compliance-frameworks/nist-csf-2.json +73 -0
- package/src/posture/compliance-frameworks/owasp-asvs-5.json +79 -0
- package/src/posture/compliance-frameworks/owasp-llm-top-10.json +69 -0
- package/src/posture/compliance-policy.js +218 -0
- package/src/posture/composite-risk.js +122 -0
- package/src/posture/cross-repo-memory.js +180 -0
- package/src/posture/csharp-analysis.js +330 -0
- package/src/posture/dep-add-guard.js +197 -0
- package/src/posture/exploit-bundle.js +210 -0
- package/src/posture/federated-learning.js +172 -0
- package/src/posture/findings-memory.js +152 -0
- package/src/posture/fix-style-mirror.js +118 -0
- package/src/posture/git-history.js +141 -0
- package/src/posture/intent-context.js +175 -0
- package/src/posture/license-attributions.js +94 -0
- package/src/posture/license-graph.js +238 -0
- package/src/posture/model-rescan.js +76 -0
- package/src/posture/pattern-propagation.js +39 -0
- package/src/posture/pqc-migration-plan.js +158 -0
- package/src/posture/pr-augment.js +234 -0
- package/src/posture/reachability-filter.js +33 -2
- package/src/posture/realtime-cve-monitor.js +214 -0
- package/src/posture/risk-dollars.js +158 -0
- package/src/posture/runtime-correlation.js +174 -0
- package/src/posture/sbom-diff.js +171 -0
- package/src/posture/sca-policy.js +235 -0
- package/src/posture/sca-upgrade.js +259 -0
- package/src/posture/threat-model-auto.js +268 -0
- package/src/posture/threat-model-grounding.js +169 -0
- package/src/posture/time-to-fix.js +129 -0
- package/src/posture/triage-learning.js +170 -0
- package/src/posture/triage-memory.js +151 -0
- package/src/posture/triage.js +40 -1
- package/src/posture/watch-mode.js +171 -0
- package/src/posture/workflow-installer.js +231 -0
- package/src/sast/.agentic-security/findings.json +6154 -0
- package/src/sast/.agentic-security/last-scan.json +6154 -0
- package/src/sast/.agentic-security/last-scan.json.sig +1 -0
- package/src/sast/.agentic-security/scan-history.json +941 -0
- package/src/sast/.agentic-security/streak.json +22 -0
- package/src/sast/_secret-entropy.js +145 -0
- package/src/sast/cloud-iam.js +312 -0
- package/src/sast/cpp.js +138 -4
- package/src/sast/crypto-protocol.js +388 -0
- package/src/sast/csharp-tokenizer.js +392 -0
- package/src/sast/csharp.js +924 -138
- package/src/sast/dapp-frontend.js +200 -0
- package/src/sast/k8s-admission.js +271 -0
- package/src/sast/llm-app.js +272 -0
- package/src/sast/ml-supply-chain.js +259 -0
- package/src/sast/mobile.js +224 -0
- package/src/sast/post-quantum-crypto.js +348 -0
- package/src/sast/web3-advanced.js +375 -0
- package/src/sca/.agentic-security/findings.json +7460 -0
- package/src/sca/.agentic-security/last-scan.json +7460 -0
- package/src/sca/.agentic-security/last-scan.json.sig +1 -0
- package/src/sca/.agentic-security/scan-history.json +113 -0
- package/src/sca/.agentic-security/streak.json +21 -0
- package/src/sca/CLAUDE.md +161 -0
- package/src/sca/binary-metadata.js +37 -15
- package/src/sca/sigstore-verify.js +215 -0
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
// Workflow installer — detect the project type and emit pre-commit
|
|
2
|
+
// hook scripts + CI YAML files tuned to the repo.
|
|
3
|
+
//
|
|
4
|
+
// Two functions:
|
|
5
|
+
//
|
|
6
|
+
// detectProject(scanRoot)
|
|
7
|
+
// Returns { lang, pm, ciProvider, hookManager } based on file probes.
|
|
8
|
+
//
|
|
9
|
+
// buildHookConfig(scanRoot, opts)
|
|
10
|
+
// Returns { files: { path: content, ... } } to write — pre-commit
|
|
11
|
+
// hook configuration in whichever style the project already uses
|
|
12
|
+
// (husky / pre-commit / lefthook / native git hooks).
|
|
13
|
+
//
|
|
14
|
+
// buildCiConfig(scanRoot, opts)
|
|
15
|
+
// Returns { files: { path: content, ... } } for the chosen CI
|
|
16
|
+
// provider (github-actions / gitlab-ci / circleci / native).
|
|
17
|
+
//
|
|
18
|
+
// Pure render — caller writes the files and runs install commands.
|
|
19
|
+
// No subprocess calls happen inside this module.
|
|
20
|
+
|
|
21
|
+
import * as fs from 'node:fs';
|
|
22
|
+
import * as path from 'node:path';
|
|
23
|
+
|
|
24
|
+
function _exists(p) { return fs.existsSync(p); }
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Project-type detection.
|
|
28
|
+
*/
|
|
29
|
+
export function detectProject(scanRoot) {
|
|
30
|
+
const has = (rel) => _exists(path.join(scanRoot, rel));
|
|
31
|
+
const lang =
|
|
32
|
+
has('package.json') ? 'node' :
|
|
33
|
+
has('pyproject.toml') || has('requirements.txt') ? 'python' :
|
|
34
|
+
has('Cargo.toml') ? 'rust' :
|
|
35
|
+
has('go.mod') ? 'go' :
|
|
36
|
+
has('pom.xml') || has('build.gradle') || has('build.gradle.kts') ? 'java' :
|
|
37
|
+
has('Gemfile') ? 'ruby' :
|
|
38
|
+
has('composer.json') ? 'php' :
|
|
39
|
+
'unknown';
|
|
40
|
+
const pm =
|
|
41
|
+
has('yarn.lock') ? 'yarn' :
|
|
42
|
+
has('pnpm-lock.yaml') ? 'pnpm' :
|
|
43
|
+
has('package-lock.json') ? 'npm' :
|
|
44
|
+
has('poetry.lock') ? 'poetry' :
|
|
45
|
+
has('Pipfile.lock') ? 'pipenv' :
|
|
46
|
+
null;
|
|
47
|
+
const ciProvider =
|
|
48
|
+
has('.github/workflows') ? 'github-actions' :
|
|
49
|
+
has('.gitlab-ci.yml') ? 'gitlab-ci' :
|
|
50
|
+
has('.circleci/config.yml') ? 'circleci' :
|
|
51
|
+
has('Jenkinsfile') ? 'jenkins' :
|
|
52
|
+
null;
|
|
53
|
+
const hookManager =
|
|
54
|
+
has('.husky') ? 'husky' :
|
|
55
|
+
has('.pre-commit-config.yaml') ? 'pre-commit' :
|
|
56
|
+
has('lefthook.yml') || has('.lefthook.yml') ? 'lefthook' :
|
|
57
|
+
has('.git/hooks') ? 'native' :
|
|
58
|
+
null;
|
|
59
|
+
return { lang, pm, ciProvider, hookManager };
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Build pre-commit hook config tuned to the project's chosen hook manager.
|
|
64
|
+
*
|
|
65
|
+
* opts:
|
|
66
|
+
* severity: 'critical' | 'high' | 'medium' (default 'critical')
|
|
67
|
+
* diffOnly: true (default) — scan only changed files
|
|
68
|
+
*/
|
|
69
|
+
export function buildHookConfig(scanRoot, opts = {}) {
|
|
70
|
+
const sev = opts.severity || 'critical';
|
|
71
|
+
const diffOnly = opts.diffOnly !== false;
|
|
72
|
+
const detected = detectProject(scanRoot);
|
|
73
|
+
const cmd = `npx --no-install agentic-security scan ${diffOnly ? '--diff' : ''} --fail-on ${sev}`.replace(/\s+/g, ' ').trim();
|
|
74
|
+
|
|
75
|
+
const files = {};
|
|
76
|
+
const manager = detected.hookManager || (detected.lang === 'node' ? 'husky' : 'pre-commit');
|
|
77
|
+
|
|
78
|
+
if (manager === 'husky') {
|
|
79
|
+
files['.husky/pre-commit'] = [
|
|
80
|
+
'#!/usr/bin/env sh',
|
|
81
|
+
'. "$(dirname -- "$0")/_/husky.sh"',
|
|
82
|
+
'',
|
|
83
|
+
'# agentic-security: refuse the commit if any new critical finding lands',
|
|
84
|
+
cmd,
|
|
85
|
+
'',
|
|
86
|
+
].join('\n');
|
|
87
|
+
} else if (manager === 'pre-commit') {
|
|
88
|
+
const cfgPath = '.pre-commit-config.yaml';
|
|
89
|
+
const existing = _exists(path.join(scanRoot, cfgPath)) ? fs.readFileSync(path.join(scanRoot, cfgPath), 'utf8') : 'repos:\n';
|
|
90
|
+
const hookYaml = [
|
|
91
|
+
' - repo: local',
|
|
92
|
+
' hooks:',
|
|
93
|
+
' - id: agentic-security',
|
|
94
|
+
' name: agentic-security scan (diff)',
|
|
95
|
+
' entry: ' + cmd,
|
|
96
|
+
' language: system',
|
|
97
|
+
' pass_filenames: false',
|
|
98
|
+
' stages: [pre-commit]',
|
|
99
|
+
'',
|
|
100
|
+
].join('\n');
|
|
101
|
+
if (!/agentic-security/.test(existing)) files[cfgPath] = existing.trim() + '\n\n' + hookYaml;
|
|
102
|
+
} else if (manager === 'lefthook') {
|
|
103
|
+
const cfgPath = 'lefthook.yml';
|
|
104
|
+
const existing = _exists(path.join(scanRoot, cfgPath)) ? fs.readFileSync(path.join(scanRoot, cfgPath), 'utf8') : 'pre-commit:\n commands:\n';
|
|
105
|
+
const hookYaml = [
|
|
106
|
+
' commands:',
|
|
107
|
+
' agentic-security:',
|
|
108
|
+
' run: ' + cmd,
|
|
109
|
+
'',
|
|
110
|
+
].join('\n');
|
|
111
|
+
if (!/agentic-security/.test(existing)) files[cfgPath] = existing.trim() + '\n' + hookYaml;
|
|
112
|
+
} else {
|
|
113
|
+
// Native git hooks fallback.
|
|
114
|
+
files['.git/hooks/pre-commit'] = [
|
|
115
|
+
'#!/usr/bin/env sh',
|
|
116
|
+
'# agentic-security: pre-commit security scan',
|
|
117
|
+
cmd,
|
|
118
|
+
'',
|
|
119
|
+
].join('\n');
|
|
120
|
+
}
|
|
121
|
+
return { manager, files };
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Build CI workflow config for the chosen provider.
|
|
126
|
+
*
|
|
127
|
+
* opts:
|
|
128
|
+
* provider: 'github-actions' | 'gitlab-ci' | 'circleci' | 'auto'
|
|
129
|
+
* schedule: cron string for weekly full scan (default 'Mon 09:00 UTC')
|
|
130
|
+
* prSeverityFloor: 'critical' (default)
|
|
131
|
+
*/
|
|
132
|
+
export function buildCiConfig(scanRoot, opts = {}) {
|
|
133
|
+
const detected = detectProject(scanRoot);
|
|
134
|
+
const provider = opts.provider === 'auto' || !opts.provider ? (detected.ciProvider || 'github-actions') : opts.provider;
|
|
135
|
+
const sev = opts.prSeverityFloor || 'critical';
|
|
136
|
+
|
|
137
|
+
const files = {};
|
|
138
|
+
if (provider === 'github-actions') {
|
|
139
|
+
files['.github/workflows/agentic-security.yml'] = _githubActions(sev);
|
|
140
|
+
} else if (provider === 'gitlab-ci') {
|
|
141
|
+
files['.gitlab-ci-agentic-security.yml'] = _gitlabCi(sev);
|
|
142
|
+
} else if (provider === 'circleci') {
|
|
143
|
+
files['.circleci/agentic-security.yml'] = _circleCi(sev);
|
|
144
|
+
} else {
|
|
145
|
+
files['ci/agentic-security.sh'] = _nativeShell(sev);
|
|
146
|
+
}
|
|
147
|
+
return { provider, files };
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function _githubActions(sev) {
|
|
151
|
+
return [
|
|
152
|
+
'name: agentic-security',
|
|
153
|
+
'',
|
|
154
|
+
'on:',
|
|
155
|
+
' pull_request:',
|
|
156
|
+
' branches: [main, master, develop]',
|
|
157
|
+
' push:',
|
|
158
|
+
' branches: [main, master]',
|
|
159
|
+
' schedule:',
|
|
160
|
+
' - cron: "0 9 * * 1" # Monday 09:00 UTC — full weekly scan',
|
|
161
|
+
' workflow_dispatch:',
|
|
162
|
+
'',
|
|
163
|
+
'permissions:',
|
|
164
|
+
' contents: read',
|
|
165
|
+
' security-events: write',
|
|
166
|
+
'',
|
|
167
|
+
'jobs:',
|
|
168
|
+
' scan:',
|
|
169
|
+
' runs-on: ubuntu-latest',
|
|
170
|
+
' steps:',
|
|
171
|
+
' - uses: actions/checkout@v5',
|
|
172
|
+
' with:',
|
|
173
|
+
' fetch-depth: 0 # full history for diff baselining',
|
|
174
|
+
" - uses: actions/setup-node@v5",
|
|
175
|
+
" with: { node-version: 'lts/*' }",
|
|
176
|
+
' - name: Run agentic-security',
|
|
177
|
+
' run: |',
|
|
178
|
+
` npx -y @clear-capabilities/agentic-security-scanner scan --fail-on ${sev} --sarif > security.sarif`,
|
|
179
|
+
' - uses: github/codeql-action/upload-sarif@v3',
|
|
180
|
+
' if: always()',
|
|
181
|
+
' with: { sarif_file: security.sarif }',
|
|
182
|
+
'',
|
|
183
|
+
].join('\n');
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
function _gitlabCi(sev) {
|
|
187
|
+
return [
|
|
188
|
+
'agentic-security:',
|
|
189
|
+
' image: node:lts',
|
|
190
|
+
' rules:',
|
|
191
|
+
' - if: $CI_PIPELINE_SOURCE == "merge_request_event"',
|
|
192
|
+
' - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH',
|
|
193
|
+
' script:',
|
|
194
|
+
` - npx -y @clear-capabilities/agentic-security-scanner scan --fail-on ${sev} --sarif > security.sarif`,
|
|
195
|
+
' artifacts:',
|
|
196
|
+
' paths: [security.sarif]',
|
|
197
|
+
' reports: { sast: security.sarif }',
|
|
198
|
+
'',
|
|
199
|
+
].join('\n');
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
function _circleCi(sev) {
|
|
203
|
+
return [
|
|
204
|
+
'version: 2.1',
|
|
205
|
+
'jobs:',
|
|
206
|
+
' agentic-security:',
|
|
207
|
+
' docker:',
|
|
208
|
+
' - image: cimg/node:lts',
|
|
209
|
+
' steps:',
|
|
210
|
+
' - checkout',
|
|
211
|
+
' - run:',
|
|
212
|
+
' name: agentic-security scan',
|
|
213
|
+
` command: npx -y @clear-capabilities/agentic-security-scanner scan --fail-on ${sev}`,
|
|
214
|
+
'workflows:',
|
|
215
|
+
' security:',
|
|
216
|
+
' jobs: [agentic-security]',
|
|
217
|
+
'',
|
|
218
|
+
].join('\n');
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
function _nativeShell(sev) {
|
|
222
|
+
return [
|
|
223
|
+
'#!/usr/bin/env bash',
|
|
224
|
+
'set -euo pipefail',
|
|
225
|
+
'',
|
|
226
|
+
`npx -y @clear-capabilities/agentic-security-scanner scan --fail-on ${sev}`,
|
|
227
|
+
'',
|
|
228
|
+
].join('\n');
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
export const _internals = { _exists, _githubActions, _gitlabCi, _circleCi, _nativeShell };
|