cognium-dev 3.23.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/LICENSE +21 -0
- package/README.md +475 -0
- package/dist/cli.js +27250 -0
- package/package.json +76 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Cognium Labs
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,475 @@
|
|
|
1
|
+
# cognium-dev
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/cognium-dev)
|
|
4
|
+
[](https://github.com/cogniumhq/cognium-dev/blob/main/LICENSE)
|
|
5
|
+
[](https://github.com/cogniumhq/cognium-dev#benchmark-results)
|
|
6
|
+
[](https://github.com/marketplace/actions/cognium-dev-scan)
|
|
7
|
+

|
|
8
|
+

|
|
9
|
+
|
|
10
|
+
Static Application Security Testing CLI for detecting security vulnerabilities via taint tracking.
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
### npm (recommended)
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install -g cognium-dev
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### Standalone binary
|
|
21
|
+
|
|
22
|
+
Download from [GitHub Releases](https://github.com/cogniumhq/cognium-dev/releases).
|
|
23
|
+
|
|
24
|
+
**Note:** When using the standalone binary, place the `wasm/` directory in the same location as the binary.
|
|
25
|
+
|
|
26
|
+
## Quick Start
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# Scan a single file
|
|
30
|
+
cognium-dev scan src/app.java
|
|
31
|
+
|
|
32
|
+
# Scan a directory
|
|
33
|
+
cognium-dev scan ./src
|
|
34
|
+
|
|
35
|
+
# Scan with specific language
|
|
36
|
+
cognium-dev scan api.py --language python
|
|
37
|
+
|
|
38
|
+
# Output as JSON
|
|
39
|
+
cognium-dev scan ./src --format json
|
|
40
|
+
|
|
41
|
+
# Show only critical vulnerabilities
|
|
42
|
+
cognium-dev scan ./src --severity critical
|
|
43
|
+
|
|
44
|
+
# Security findings only (skip quality/reliability passes)
|
|
45
|
+
cognium-dev scan ./src --category security
|
|
46
|
+
|
|
47
|
+
# Exclude specific CWEs (e.g. weak crypto noise)
|
|
48
|
+
cognium-dev scan ./src --exclude-cwe CWE-327,CWE-330
|
|
49
|
+
|
|
50
|
+
# Exclude test files
|
|
51
|
+
cognium-dev scan ./src --exclude-tests
|
|
52
|
+
|
|
53
|
+
# Software quality metrics
|
|
54
|
+
cognium-dev metrics ./src
|
|
55
|
+
cognium-dev metrics ./src --category complexity,coupling --format json
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Commands
|
|
59
|
+
|
|
60
|
+
### `cognium-dev scan <path>`
|
|
61
|
+
|
|
62
|
+
Scan files or directories for security vulnerabilities.
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
cognium-dev scan <path> [options]
|
|
66
|
+
|
|
67
|
+
Options:
|
|
68
|
+
-l, --language <lang> Force language (java|javascript|typescript|python|go|rust|bash|html)
|
|
69
|
+
-f, --format <format> Output format (text|json|sarif) [default: text]
|
|
70
|
+
--threads <n> Parallel analysis threads [default: 4]
|
|
71
|
+
--severity <level> Filter by severity:
|
|
72
|
+
- Single level: minimum severity (e.g., "high" shows high+critical)
|
|
73
|
+
- Multiple levels: exact match (e.g., "critical,high" shows only those)
|
|
74
|
+
- Valid levels: low, medium, high, critical
|
|
75
|
+
--category <cats> Filter by ISO 25010 category (comma-separated):
|
|
76
|
+
security, reliability, performance, maintainability, architecture
|
|
77
|
+
--exclude-cwe <cwes> Exclude specific CWEs (comma-separated, e.g. CWE-330,CWE-327)
|
|
78
|
+
--exclude-tests Exclude test files and directories
|
|
79
|
+
-o, --output <file> Write results to file
|
|
80
|
+
-q, --quiet Suppress progress output
|
|
81
|
+
-v, --verbose Show detailed output
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**Examples:**
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
# Scan entire project
|
|
88
|
+
cognium-dev scan ./src
|
|
89
|
+
|
|
90
|
+
# Show only critical and high severity issues
|
|
91
|
+
cognium-dev scan ./src --severity critical,high
|
|
92
|
+
|
|
93
|
+
# Exclude test files and show only critical issues
|
|
94
|
+
cognium-dev scan ./src --exclude-tests --severity critical
|
|
95
|
+
|
|
96
|
+
# Security findings only (skip quality/reliability passes)
|
|
97
|
+
cognium-dev scan ./src --category security
|
|
98
|
+
|
|
99
|
+
# Reliability + performance findings only
|
|
100
|
+
cognium-dev scan ./src --category reliability,performance
|
|
101
|
+
|
|
102
|
+
# Exclude weak-crypto and weak-random findings
|
|
103
|
+
cognium-dev scan ./src --exclude-cwe CWE-327,CWE-330
|
|
104
|
+
|
|
105
|
+
# Generate SARIF report for CI/CD
|
|
106
|
+
cognium-dev scan ./src --format sarif --output results.sarif
|
|
107
|
+
|
|
108
|
+
# Scan with verbose output
|
|
109
|
+
cognium-dev scan ./src -v
|
|
110
|
+
|
|
111
|
+
# Quiet mode (no progress, only results)
|
|
112
|
+
cognium-dev scan ./src -q
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### `cognium-dev init`
|
|
116
|
+
|
|
117
|
+
Initialize a configuration file in your project.
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
cognium-dev init
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Creates a `cognium.config.json` with customizable rules.
|
|
124
|
+
|
|
125
|
+
### `cognium-dev metrics <path>`
|
|
126
|
+
|
|
127
|
+
Report software quality metrics for files or directories.
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
cognium-dev metrics <path> [options]
|
|
131
|
+
|
|
132
|
+
Options:
|
|
133
|
+
-l, --language <lang> Analyze only files for the given language
|
|
134
|
+
-f, --format <format> Output format (text|json) [default: text]
|
|
135
|
+
--category <cats> Filter metric categories (comma-separated):
|
|
136
|
+
complexity, size, coupling, inheritance,
|
|
137
|
+
cohesion, documentation, duplication
|
|
138
|
+
--exclude-tests Skip test files and directories
|
|
139
|
+
-o, --output <file> Write results to file
|
|
140
|
+
-q, --quiet Suppress per-file progress output
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
**Examples:**
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
# Show all metrics for a directory
|
|
147
|
+
cognium-dev metrics ./src
|
|
148
|
+
|
|
149
|
+
# Complexity and coupling metrics only
|
|
150
|
+
cognium-dev metrics ./src --category complexity,coupling
|
|
151
|
+
|
|
152
|
+
# JSON output for tooling integration
|
|
153
|
+
cognium-dev metrics ./src --format json --output metrics.json
|
|
154
|
+
|
|
155
|
+
# Java files only, skip tests
|
|
156
|
+
cognium-dev metrics ./src --language java --exclude-tests
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
**Sample output:**
|
|
160
|
+
|
|
161
|
+
```
|
|
162
|
+
src/UserController.java
|
|
163
|
+
Complexity
|
|
164
|
+
cyclomatic_complexity : 8.2
|
|
165
|
+
WMC : 41
|
|
166
|
+
halstead_volume : 3820.4
|
|
167
|
+
|
|
168
|
+
Size
|
|
169
|
+
LOC : 182
|
|
170
|
+
NLOC : 156
|
|
171
|
+
function_count : 9
|
|
172
|
+
|
|
173
|
+
Coupling
|
|
174
|
+
CBO : 6
|
|
175
|
+
RFC : 22
|
|
176
|
+
|
|
177
|
+
Composite Scores
|
|
178
|
+
maintainability_index : 68.4 / 100
|
|
179
|
+
code_quality_index : 71.2 / 100
|
|
180
|
+
bug_hotspot_score : 32.1 / 100
|
|
181
|
+
refactoring_roi : 45.0 / 100
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Available metrics: `cyclomatic_complexity`, `WMC`, `halstead_volume`, `halstead_difficulty`, `halstead_effort`, `halstead_bugs`, `LOC`, `NLOC`, `comment_density`, `function_count`, `CBO`, `RFC`, `DIT`, `NOC`, `LCOM`, `doc_coverage`, `maintainability_index`, `code_quality_index`, `bug_hotspot_score`, `refactoring_roi`.
|
|
185
|
+
|
|
186
|
+
### `cognium-dev version`
|
|
187
|
+
|
|
188
|
+
Display version information.
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
cognium-dev version
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
## Output Format
|
|
195
|
+
|
|
196
|
+
Cognium provides helpful, actionable output for each vulnerability found:
|
|
197
|
+
|
|
198
|
+
```
|
|
199
|
+
/path/to/VulnerableApp.java
|
|
200
|
+
[!!!] sql_injection (Critical) [CWE-89]
|
|
201
|
+
Line 45: sql_injection vulnerability: tainted data flows from line 42 to line 45
|
|
202
|
+
User input is used in SQL query without sanitization
|
|
203
|
+
→ Fix: Use PreparedStatement with parameterized queries instead of string concatenation
|
|
204
|
+
[!!] xss (High) [CWE-79]
|
|
205
|
+
Line 78: xss vulnerability: tainted data flows from line 76 to line 78
|
|
206
|
+
User input is rendered in HTML without proper encoding
|
|
207
|
+
→ Fix: Use HTML encoding/escaping functions before rendering user input in web pages
|
|
208
|
+
|
|
209
|
+
Found 2 vulnerability(ies) in 1 file(s)
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
**Clean code = silent output:** When no vulnerabilities are found, cognium stays quiet (Unix philosophy: no news is good news).
|
|
213
|
+
|
|
214
|
+
Use `-v` flag to see all scanned files including clean ones.
|
|
215
|
+
|
|
216
|
+
## Detected Vulnerabilities
|
|
217
|
+
|
|
218
|
+
| Type | CWE | Severity | Description |
|
|
219
|
+
|------|-----|----------|-------------|
|
|
220
|
+
| SQL Injection | CWE-89 | Critical | User input in SQL queries |
|
|
221
|
+
| Command Injection | CWE-78 | Critical | User input in system commands |
|
|
222
|
+
| Deserialization | CWE-502 | Critical | Untrusted deserialization |
|
|
223
|
+
| XXE | CWE-611 | Critical | XML external entity injection |
|
|
224
|
+
| Cross-Site Scripting (XSS) | CWE-79 | High | User input in HTML output |
|
|
225
|
+
| Path Traversal | CWE-22 | High | User input in file paths |
|
|
226
|
+
| SSRF | CWE-918 | High | Server-side request forgery |
|
|
227
|
+
| LDAP Injection | CWE-90 | High | User input in LDAP queries |
|
|
228
|
+
| XPath Injection | CWE-643 | High | User input in XPath queries |
|
|
229
|
+
| NoSQL Injection | CWE-943 | High | User input in NoSQL queries |
|
|
230
|
+
| Code Injection | CWE-94 | Critical | Dynamic code execution |
|
|
231
|
+
| Open Redirect | CWE-601 | Medium | User controls redirect destination |
|
|
232
|
+
| Log Injection | CWE-117 | Medium | User input in logs |
|
|
233
|
+
| Trust Boundary | CWE-501 | Medium | Data crosses trust boundary |
|
|
234
|
+
| External Taint Escape | CWE-20 | Medium | External input reaches sensitive sink |
|
|
235
|
+
| Weak Random | CWE-330 | Low | Weak random number generator |
|
|
236
|
+
| Weak Hash | CWE-327 | Low | Weak hashing algorithm |
|
|
237
|
+
| Weak Crypto | CWE-327 | Low | Weak cryptographic algorithm |
|
|
238
|
+
| Insecure Cookie | CWE-614 | Low | Cookie without security flags |
|
|
239
|
+
|
|
240
|
+
## Code Quality Analysis
|
|
241
|
+
|
|
242
|
+
In addition to security vulnerabilities, `cognium-dev scan` runs 17 code quality passes and reports findings in five ISO 25010 categories:
|
|
243
|
+
|
|
244
|
+
| Category | Rule IDs | Example Issues |
|
|
245
|
+
|----------|----------|----------------|
|
|
246
|
+
| **Reliability** | `null-deref`, `resource-leak`, `unchecked-return`, `dead-code`, `variable-shadowing`, `leaked-global`, `unused-variable`, `infinite-loop`, `double-close`, `use-after-close`, `unhandled-exception`, `broad-catch`, `swallowed-exception`, `missing-guard-dom`, `cleanup-verify` | Null pointer dereferences, unclosed streams, swallowed exceptions |
|
|
247
|
+
| **Performance** | `n-plus-one`, `redundant-loop-computation`, `unbounded-collection`, `serial-await`, `react-inline-jsx` | N+1 DB queries, unnecessary work inside loops |
|
|
248
|
+
| **Maintainability** | `missing-public-doc`, `todo-in-prod`, `stale-doc-ref` | Missing Javadoc/JSDoc, TODO comments in production code |
|
|
249
|
+
| **Architecture** | `circular-dependency`, `orphan-module`, `dependency-fan-out`, `deep-inheritance`, `missing-override`, `unused-interface-method` | Circular imports, overly deep class hierarchies |
|
|
250
|
+
|
|
251
|
+
Quality findings appear alongside security findings in text output with their category tag:
|
|
252
|
+
|
|
253
|
+
```
|
|
254
|
+
src/UserService.java
|
|
255
|
+
[!!] sql_injection (Critical) [CWE-89]
|
|
256
|
+
...
|
|
257
|
+
[!] null-deref [reliability] (High) [CWE-476]
|
|
258
|
+
Line 34: Return value of findById() is dereferenced without a null check
|
|
259
|
+
→ Fix: Check for null before dereferencing or use Optional<T>
|
|
260
|
+
[i] missing-public-doc [maintainability] (Low)
|
|
261
|
+
Line 12: Public method processRequest() has no Javadoc
|
|
262
|
+
|
|
263
|
+
Found 1 security finding(s) in 1 file(s)
|
|
264
|
+
Also found 2 code quality finding(s) in 1 file(s)
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
**Exit codes:** The CLI exits `1` only when **security** findings are present (so CI pipelines gate on vulnerabilities without being blocked by documentation or style findings). Quality-only scans exit `0`.
|
|
268
|
+
|
|
269
|
+
Filter to security findings only: `cognium-dev scan ./src --category security`
|
|
270
|
+
|
|
271
|
+
## Supported Languages
|
|
272
|
+
|
|
273
|
+
| Language | Extensions | Frameworks |
|
|
274
|
+
|----------|------------|------------|
|
|
275
|
+
| Java | `.java` | Spring, JAX-RS, Servlet |
|
|
276
|
+
| JavaScript | `.js`, `.mjs` | Express, Fastify, Node.js |
|
|
277
|
+
| TypeScript | `.ts`, `.tsx` | Express, Fastify, Node.js |
|
|
278
|
+
| Python | `.py` | Flask, Django, FastAPI |
|
|
279
|
+
| Go | `.go` | net/http, Gin, Echo, Fiber, Chi |
|
|
280
|
+
| Rust | `.rs` | Actix-web, Rocket, Axum |
|
|
281
|
+
| Bash | `.sh`, `.bash` | Shell scripts |
|
|
282
|
+
| HTML | `.html`, `.htm` | Web extraction preprocessor |
|
|
283
|
+
|
|
284
|
+
## Configuration
|
|
285
|
+
|
|
286
|
+
Create `cognium.config.json` in your project root:
|
|
287
|
+
|
|
288
|
+
```json
|
|
289
|
+
{
|
|
290
|
+
"include": ["src/**/*.java", "src/**/*.ts"],
|
|
291
|
+
"exclude": ["**/test/**", "**/node_modules/**"],
|
|
292
|
+
"severity": "medium",
|
|
293
|
+
"rules": {
|
|
294
|
+
"sql-injection": "error",
|
|
295
|
+
"xss": "error",
|
|
296
|
+
"command-injection": "error",
|
|
297
|
+
"path-traversal": "warn"
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
## Severity Filtering
|
|
303
|
+
|
|
304
|
+
Cognium supports flexible severity filtering to focus on what matters:
|
|
305
|
+
|
|
306
|
+
### Minimum Severity (Single Value)
|
|
307
|
+
|
|
308
|
+
Shows vulnerabilities at or above the specified level:
|
|
309
|
+
|
|
310
|
+
```bash
|
|
311
|
+
# Show only critical
|
|
312
|
+
cognium-dev scan ./src --severity critical
|
|
313
|
+
|
|
314
|
+
# Show high and critical
|
|
315
|
+
cognium-dev scan ./src --severity high
|
|
316
|
+
|
|
317
|
+
# Show medium, high, and critical
|
|
318
|
+
cognium-dev scan ./src --severity medium
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
### Exact Severity Match (Comma-Separated)
|
|
322
|
+
|
|
323
|
+
Shows only the specified severity levels:
|
|
324
|
+
|
|
325
|
+
```bash
|
|
326
|
+
# Show only critical and high
|
|
327
|
+
cognium-dev scan ./src --severity critical,high
|
|
328
|
+
|
|
329
|
+
# Show only medium
|
|
330
|
+
cognium-dev scan ./src --severity medium
|
|
331
|
+
|
|
332
|
+
# Show low and medium
|
|
333
|
+
cognium-dev scan ./src --severity low,medium
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
## CI/CD Integration
|
|
337
|
+
|
|
338
|
+
### GitHub Actions
|
|
339
|
+
|
|
340
|
+
```yaml
|
|
341
|
+
name: Security Scan
|
|
342
|
+
on: [push, pull_request]
|
|
343
|
+
|
|
344
|
+
jobs:
|
|
345
|
+
scan:
|
|
346
|
+
runs-on: ubuntu-latest
|
|
347
|
+
steps:
|
|
348
|
+
- uses: actions/checkout@v4
|
|
349
|
+
- name: Install cognium
|
|
350
|
+
run: npm install -g cognium
|
|
351
|
+
- name: Run security scan
|
|
352
|
+
run: cognium-dev scan ./src --format sarif --output results.sarif --severity high
|
|
353
|
+
- name: Upload SARIF
|
|
354
|
+
uses: github/codeql-action/upload-sarif@v3
|
|
355
|
+
with:
|
|
356
|
+
sarif_file: results.sarif
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
### GitLab CI
|
|
360
|
+
|
|
361
|
+
```yaml
|
|
362
|
+
security-scan:
|
|
363
|
+
image: node:20
|
|
364
|
+
script:
|
|
365
|
+
- npm install -g cognium
|
|
366
|
+
- cognium-dev scan ./src --format json --output gl-sast-report.json --severity high
|
|
367
|
+
artifacts:
|
|
368
|
+
reports:
|
|
369
|
+
sast: gl-sast-report.json
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
### Pre-commit Hook
|
|
373
|
+
|
|
374
|
+
Prevent commits with critical vulnerabilities:
|
|
375
|
+
|
|
376
|
+
```bash
|
|
377
|
+
#!/bin/sh
|
|
378
|
+
# .git/hooks/pre-commit
|
|
379
|
+
|
|
380
|
+
if ! cognium-dev scan . --severity critical --quiet; then
|
|
381
|
+
echo "❌ Commit blocked: Critical security vulnerabilities found"
|
|
382
|
+
exit 1
|
|
383
|
+
fi
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
## Exit Codes
|
|
387
|
+
|
|
388
|
+
| Code | Meaning |
|
|
389
|
+
|------|---------|
|
|
390
|
+
| 0 | No security findings (quality-only findings do not trigger exit 1) |
|
|
391
|
+
| 1 | One or more security vulnerabilities found |
|
|
392
|
+
| 2 | Error during analysis |
|
|
393
|
+
|
|
394
|
+
Use exit codes in CI/CD to fail builds when security vulnerabilities are detected:
|
|
395
|
+
|
|
396
|
+
```bash
|
|
397
|
+
# Fail build on any security finding
|
|
398
|
+
cognium-dev scan ./src || exit 1
|
|
399
|
+
|
|
400
|
+
# Fail build only on critical/high security findings
|
|
401
|
+
cognium-dev scan ./src --severity high || exit 1
|
|
402
|
+
|
|
403
|
+
# Fail build only on critical security findings
|
|
404
|
+
cognium-dev scan ./src --severity critical || exit 1
|
|
405
|
+
|
|
406
|
+
# Never fail on quality-only issues (always exit 0 for docs/style findings)
|
|
407
|
+
cognium-dev scan ./src --category reliability,performance,maintainability,architecture; echo "Quality scan done (exit $?)"
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
## Performance
|
|
411
|
+
|
|
412
|
+
Cognium is built for speed:
|
|
413
|
+
|
|
414
|
+
- **Parallel analysis**: Process multiple files concurrently (configurable with `--threads`)
|
|
415
|
+
- **Zero dependencies**: Only one runtime dependency (`circle-ir`)
|
|
416
|
+
- **Native performance**: Powered by tree-sitter WASM parsers
|
|
417
|
+
- **Lean binary**: ~58MB standalone binary includes all dependencies
|
|
418
|
+
|
|
419
|
+
## Architecture
|
|
420
|
+
|
|
421
|
+
- **CLI**: Lightweight wrapper with zero-dependency utilities
|
|
422
|
+
- **Core Engine**: [circle-ir](https://github.com/cogniumhq/cognium-dev/tree/main/packages/circle-ir) - High-performance SAST library
|
|
423
|
+
- **Dependencies**: Only 1 runtime dependency (circle-ir)
|
|
424
|
+
|
|
425
|
+
## LLM Enhancement (Optional)
|
|
426
|
+
|
|
427
|
+
The core static analysis engine runs deterministically without any LLM. Optionally, you can enable LLM-based discovery modes for enhanced detection:
|
|
428
|
+
|
|
429
|
+
- **Discovery Mode**: LLM reads source code to locate vulnerable methods from scratch
|
|
430
|
+
- **Verification Mode**: Confirms whether static findings are actually exploitable
|
|
431
|
+
- **Semantic Extraction**: Extracts design intent for automated gap analysis
|
|
432
|
+
|
|
433
|
+
For details on LLM integration and benchmark improvements (42.5% → 78.3% on CWE-Bench with Claude Opus), visit [cognium.net](https://cognium.net).
|
|
434
|
+
|
|
435
|
+
## Benchmark Results
|
|
436
|
+
|
|
437
|
+
**All scores below are from the static analysis engine** — fully deterministic, no LLM required:
|
|
438
|
+
|
|
439
|
+
| Benchmark | Score | Details |
|
|
440
|
+
|-----------|-------|---------|
|
|
441
|
+
| OWASP Benchmark | +100% | TPR 100%, FPR 0% (1415 test cases) |
|
|
442
|
+
| Juliet Test Suite | +100% | 156/156 test cases, 9 CWEs |
|
|
443
|
+
| SecuriBench Micro | 97.7% TPR | 105/108 vulns detected, 6.7% FPR |
|
|
444
|
+
| CWE-Bench-Java | 42.5% | 51/120 real-world CVEs |
|
|
445
|
+
|
|
446
|
+
### Reproducing Benchmarks
|
|
447
|
+
|
|
448
|
+
The benchmark scores are verifiable and reproducible:
|
|
449
|
+
|
|
450
|
+
```bash
|
|
451
|
+
# Install cognium
|
|
452
|
+
npm install -g cognium
|
|
453
|
+
|
|
454
|
+
# Clone benchmark repositories
|
|
455
|
+
git clone https://github.com/OWASP-Benchmark/BenchmarkJava
|
|
456
|
+
git clone https://github.com/juliet-test-suite/juliet-test-suite-for-java
|
|
457
|
+
git clone https://github.com/CWE-Bench/cwe-bench-java
|
|
458
|
+
|
|
459
|
+
# Run scans
|
|
460
|
+
cognium-dev scan BenchmarkJava/src --format json -o owasp-results.json
|
|
461
|
+
cognium-dev scan juliet-test-suite-for-java --format json -o juliet-results.json
|
|
462
|
+
cognium-dev scan cwe-bench-java --format json -o cwe-bench-results.json
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
For detailed benchmark methodology and comparison with other tools, see [cognium.dev](https://cognium.dev).
|
|
466
|
+
|
|
467
|
+
## Links
|
|
468
|
+
|
|
469
|
+
- [GitHub](https://github.com/cogniumhq/cognium-dev)
|
|
470
|
+
- [circle-ir (Core Engine)](https://github.com/cogniumhq/cognium-dev/tree/main/packages/circle-ir)
|
|
471
|
+
- [Website](https://cognium.dev)
|
|
472
|
+
|
|
473
|
+
## License
|
|
474
|
+
|
|
475
|
+
MIT
|