cognium-dev 3.85.0 → 3.85.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/cli.js +47 -44
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -29207,7 +29207,7 @@ function findStringArrayLineRanges(code) {
|
|
|
29207
29207
|
let depth = 1;
|
|
29208
29208
|
let li = i2;
|
|
29209
29209
|
let col = m.index + m[0].length;
|
|
29210
|
-
let lineBudget =
|
|
29210
|
+
let lineBudget = 100;
|
|
29211
29211
|
const spanLines = [li + 1];
|
|
29212
29212
|
let spanText = "";
|
|
29213
29213
|
while (depth > 0 && li < lines.length && lineBudget > 0) {
|
|
@@ -29264,6 +29264,7 @@ function extractEnclosingFieldName(lineText) {
|
|
|
29264
29264
|
}
|
|
29265
29265
|
var TEST_CALL_RE = /\b(?:expect|assert|describe|it|test)\s*\(/;
|
|
29266
29266
|
var COMMENT_EXAMPLE_RE = /(?:\/\/|#)\s*(?:example|sample|test|fixture)/i;
|
|
29267
|
+
var FAST_CANDIDATE_PROBE_RE = /["'`][A-Za-z0-9+/=_-]{32,}["'`]/;
|
|
29267
29268
|
|
|
29268
29269
|
class ScanSecretsPass {
|
|
29269
29270
|
name = "scan-secrets";
|
|
@@ -29284,8 +29285,9 @@ class ScanSecretsPass {
|
|
|
29284
29285
|
seen.add(`${f.line}:${f.rule_id}`);
|
|
29285
29286
|
}
|
|
29286
29287
|
}
|
|
29287
|
-
const
|
|
29288
|
-
const
|
|
29288
|
+
const hasEntropyCandidate = FAST_CANDIDATE_PROBE_RE.test(ctx.code);
|
|
29289
|
+
const annotationLines = hasEntropyCandidate ? findAnnotationLineRanges(ctx.code) : new Set;
|
|
29290
|
+
const arrayLines = hasEntropyCandidate ? findStringArrayLineRanges(ctx.code) : new Set;
|
|
29289
29291
|
let providerFindings = 0;
|
|
29290
29292
|
let entropyFindings = 0;
|
|
29291
29293
|
for (let i2 = 0;i2 < lines.length; i2++) {
|
|
@@ -29345,51 +29347,52 @@ class ScanSecretsPass {
|
|
|
29345
29347
|
});
|
|
29346
29348
|
providerFindings += 1;
|
|
29347
29349
|
}
|
|
29348
|
-
|
|
29349
|
-
|
|
29350
|
-
|
|
29351
|
-
|
|
29352
|
-
|
|
29353
|
-
if (COMMENT_EXAMPLE_RE.test(lineText))
|
|
29354
|
-
continue;
|
|
29355
|
-
if (annotationLines.has(lineNum))
|
|
29356
|
-
continue;
|
|
29357
|
-
if (arrayLines.has(lineNum))
|
|
29358
|
-
continue;
|
|
29359
|
-
STRING_LITERAL_RE.lastIndex = 0;
|
|
29360
|
-
let match;
|
|
29361
|
-
while ((match = STRING_LITERAL_RE.exec(lineText)) !== null) {
|
|
29362
|
-
const value = match[2];
|
|
29363
|
-
if (!this.isCandidate(value))
|
|
29350
|
+
if (hasEntropyCandidate)
|
|
29351
|
+
for (let i2 = 0;i2 < lines.length; i2++) {
|
|
29352
|
+
const lineText = lines[i2];
|
|
29353
|
+
const lineNum = i2 + 1;
|
|
29354
|
+
if (TEST_CALL_RE.test(lineText))
|
|
29364
29355
|
continue;
|
|
29365
|
-
if (
|
|
29356
|
+
if (COMMENT_EXAMPLE_RE.test(lineText))
|
|
29366
29357
|
continue;
|
|
29367
|
-
if (
|
|
29358
|
+
if (annotationLines.has(lineNum))
|
|
29368
29359
|
continue;
|
|
29369
|
-
|
|
29370
|
-
if (seen.has(key))
|
|
29360
|
+
if (arrayLines.has(lineNum))
|
|
29371
29361
|
continue;
|
|
29372
|
-
|
|
29373
|
-
|
|
29374
|
-
|
|
29375
|
-
|
|
29376
|
-
|
|
29377
|
-
|
|
29378
|
-
|
|
29379
|
-
|
|
29380
|
-
|
|
29381
|
-
|
|
29382
|
-
|
|
29383
|
-
|
|
29384
|
-
|
|
29385
|
-
|
|
29386
|
-
|
|
29387
|
-
|
|
29388
|
-
|
|
29389
|
-
|
|
29390
|
-
|
|
29362
|
+
STRING_LITERAL_RE.lastIndex = 0;
|
|
29363
|
+
let match;
|
|
29364
|
+
while ((match = STRING_LITERAL_RE.exec(lineText)) !== null) {
|
|
29365
|
+
const value = match[2];
|
|
29366
|
+
if (!this.isCandidate(value))
|
|
29367
|
+
continue;
|
|
29368
|
+
if (value.length < 32)
|
|
29369
|
+
continue;
|
|
29370
|
+
if (!this.passesEntropyGate(value, lineText))
|
|
29371
|
+
continue;
|
|
29372
|
+
const key = `${lineNum}:hardcoded-credential-entropy`;
|
|
29373
|
+
if (seen.has(key))
|
|
29374
|
+
continue;
|
|
29375
|
+
if (seen.has(`${lineNum}:hardcoded-credential`))
|
|
29376
|
+
continue;
|
|
29377
|
+
seen.add(key);
|
|
29378
|
+
ctx.addFinding({
|
|
29379
|
+
id: `hardcoded-credential-entropy-${file}-${lineNum}`,
|
|
29380
|
+
pass: this.name,
|
|
29381
|
+
category: this.category,
|
|
29382
|
+
rule_id: "hardcoded-credential-entropy",
|
|
29383
|
+
cwe: "CWE-798",
|
|
29384
|
+
severity: "high",
|
|
29385
|
+
level: "warning",
|
|
29386
|
+
message: `Possible hardcoded secret: high-entropy string literal (${value.length} chars)`,
|
|
29387
|
+
file,
|
|
29388
|
+
line: lineNum,
|
|
29389
|
+
snippet: lineText.trim().substring(0, 120),
|
|
29390
|
+
fix: "If this is a credential, move it to environment / secrets manager. If it is sample data, add an `example` / `test` marker or disable this pass via `disabledPasses: ['scan-secrets']`.",
|
|
29391
|
+
evidence: { kind: "entropy", length: value.length }
|
|
29392
|
+
});
|
|
29393
|
+
entropyFindings += 1;
|
|
29394
|
+
}
|
|
29391
29395
|
}
|
|
29392
|
-
}
|
|
29393
29396
|
return { providerFindings, entropyFindings };
|
|
29394
29397
|
}
|
|
29395
29398
|
isCandidate(s) {
|
|
@@ -33990,7 +33993,7 @@ var colors = {
|
|
|
33990
33993
|
};
|
|
33991
33994
|
|
|
33992
33995
|
// src/version.ts
|
|
33993
|
-
var version = "3.85.
|
|
33996
|
+
var version = "3.85.1";
|
|
33994
33997
|
|
|
33995
33998
|
// src/formatters.ts
|
|
33996
33999
|
var SINK_SEVERITY = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cognium-dev",
|
|
3
|
-
"version": "3.85.
|
|
3
|
+
"version": "3.85.1",
|
|
4
4
|
"description": "Static Application Security Testing CLI for detecting security vulnerabilities via taint tracking",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"registry": "https://registry.npmjs.org/"
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"circle-ir": "^3.85.
|
|
68
|
+
"circle-ir": "^3.85.1"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@types/node": "^25.5.0",
|