cognium-dev 3.208.0 → 3.210.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/dist/cli.js +70 -1
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -31799,6 +31799,54 @@ var SQL_EXEC_METHODS = new Set([
|
|
|
31799
31799
|
"addBatch"
|
|
31800
31800
|
]);
|
|
31801
31801
|
var JAVA_SQL_ASSIGN_RE_TEMPLATE = "\\b(?:String|CharSequence|final\\s+String|var)\\s+SQLVAR\\b\\s*=\\s*(.+?);";
|
|
31802
|
+
var REPLACE_ALL_TO_PLACEHOLDER_RE = /\.replaceAll\s*\([\s\S]*?,\s*"[\s,?]*\?[\s,?]*"\s*\)/;
|
|
31803
|
+
var HTML_CONTENT_TYPE_RE = /text\/html|TEXT_HTML/;
|
|
31804
|
+
function javaTraversalRejectGuardedLines(code) {
|
|
31805
|
+
const covered = new Set;
|
|
31806
|
+
const lines = code.split(`
|
|
31807
|
+
`);
|
|
31808
|
+
const guardOpen = /\bif\s*\(\s*([A-Za-z_]\w*)\s*\.\s*contains\s*\(\s*"[^"]*\.\.[^"]*"\s*\)/;
|
|
31809
|
+
const terminatorRe = /\b(throw|return)\b/;
|
|
31810
|
+
const assignRe = /^\s*(?:[A-Za-z_][\w.<>[\]]*\s+)?([A-Za-z_]\w*)\s*=(?!=)\s*(.*)$/;
|
|
31811
|
+
for (let i2 = 0;i2 < lines.length; i2++) {
|
|
31812
|
+
const m = guardOpen.exec(lines[i2]);
|
|
31813
|
+
if (!m)
|
|
31814
|
+
continue;
|
|
31815
|
+
let hasTerminator = terminatorRe.test(lines[i2]);
|
|
31816
|
+
if (!hasTerminator) {
|
|
31817
|
+
for (let j = i2 + 1;j < Math.min(lines.length, i2 + 6); j++) {
|
|
31818
|
+
if (terminatorRe.test(lines[j])) {
|
|
31819
|
+
hasTerminator = true;
|
|
31820
|
+
break;
|
|
31821
|
+
}
|
|
31822
|
+
if (lines[j].includes("}"))
|
|
31823
|
+
break;
|
|
31824
|
+
}
|
|
31825
|
+
}
|
|
31826
|
+
if (!hasTerminator)
|
|
31827
|
+
continue;
|
|
31828
|
+
const guarded = new Set([m[1]]);
|
|
31829
|
+
const mentionsGuarded = (text) => {
|
|
31830
|
+
for (const name2 of guarded)
|
|
31831
|
+
if (new RegExp(`\\b${name2}\\b`).test(text))
|
|
31832
|
+
return true;
|
|
31833
|
+
return false;
|
|
31834
|
+
};
|
|
31835
|
+
for (let l = i2 + 1;l < lines.length; l++) {
|
|
31836
|
+
const lineText = lines[l];
|
|
31837
|
+
const assign = assignRe.exec(lineText);
|
|
31838
|
+
if (assign) {
|
|
31839
|
+
if (mentionsGuarded(assign[2]))
|
|
31840
|
+
guarded.add(assign[1]);
|
|
31841
|
+
else if (assign[1] !== m[1])
|
|
31842
|
+
guarded.delete(assign[1]);
|
|
31843
|
+
}
|
|
31844
|
+
if (mentionsGuarded(lineText))
|
|
31845
|
+
covered.add(l + 1);
|
|
31846
|
+
}
|
|
31847
|
+
}
|
|
31848
|
+
return covered;
|
|
31849
|
+
}
|
|
31802
31850
|
var JAVA_INLINE_MATCHES_RE = /\.\s*matches\s*\(\s*"((?:[^"\\]|\\.)*)"\s*\)/g;
|
|
31803
31851
|
function resolveJavaReceiverType(receiver, sinkLine, sourceLines) {
|
|
31804
31852
|
if (!receiver || !/^[A-Za-z_]\w*$/.test(receiver))
|
|
@@ -32563,6 +32611,27 @@ class SinkFilterPass {
|
|
|
32563
32611
|
return true;
|
|
32564
32612
|
});
|
|
32565
32613
|
}
|
|
32614
|
+
if (language === "java") {
|
|
32615
|
+
const sourceLines = ctx.code.split(`
|
|
32616
|
+
`);
|
|
32617
|
+
filtered = filtered.filter((sink) => {
|
|
32618
|
+
if (sink.type !== "sql_injection")
|
|
32619
|
+
return true;
|
|
32620
|
+
if (!SQL_EXEC_METHODS.has(sink.method ?? ""))
|
|
32621
|
+
return true;
|
|
32622
|
+
const sinkLineText = sourceLines[sink.line - 1] ?? "";
|
|
32623
|
+
return !REPLACE_ALL_TO_PLACEHOLDER_RE.test(sinkLineText);
|
|
32624
|
+
});
|
|
32625
|
+
}
|
|
32626
|
+
if (language === "java" && !HTML_CONTENT_TYPE_RE.test(ctx.code)) {
|
|
32627
|
+
filtered = filtered.filter((sink) => !(sink.type === "xss" && sink.method === "body"));
|
|
32628
|
+
}
|
|
32629
|
+
if (language === "java") {
|
|
32630
|
+
const guardedLines = javaTraversalRejectGuardedLines(ctx.code);
|
|
32631
|
+
if (guardedLines.size > 0) {
|
|
32632
|
+
filtered = filtered.filter((sink) => !(sink.type === "path_traversal" && guardedLines.has(sink.line)));
|
|
32633
|
+
}
|
|
32634
|
+
}
|
|
32566
32635
|
if (["javascript", "typescript"].includes(language)) {
|
|
32567
32636
|
const sourceLines = ctx.code.split(`
|
|
32568
32637
|
`);
|
|
@@ -47015,7 +47084,7 @@ var colors = {
|
|
|
47015
47084
|
};
|
|
47016
47085
|
|
|
47017
47086
|
// src/version.ts
|
|
47018
|
-
var version = "3.
|
|
47087
|
+
var version = "3.210.0";
|
|
47019
47088
|
|
|
47020
47089
|
// src/formatters.ts
|
|
47021
47090
|
var LIBRARY_API_SURFACE_TAG2 = "library-api-surface:caller-responsibility";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cognium-dev",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.210.0",
|
|
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",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
68
|
"@cognium/project-profile-detect": "^1.1.0",
|
|
69
|
-
"circle-ir": "^3.
|
|
69
|
+
"circle-ir": "^3.210.0"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@types/node": "^25.5.0",
|