cognium-dev 3.209.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 +53 -1
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -31801,6 +31801,52 @@ var SQL_EXEC_METHODS = new Set([
|
|
|
31801
31801
|
var JAVA_SQL_ASSIGN_RE_TEMPLATE = "\\b(?:String|CharSequence|final\\s+String|var)\\s+SQLVAR\\b\\s*=\\s*(.+?);";
|
|
31802
31802
|
var REPLACE_ALL_TO_PLACEHOLDER_RE = /\.replaceAll\s*\([\s\S]*?,\s*"[\s,?]*\?[\s,?]*"\s*\)/;
|
|
31803
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
|
+
}
|
|
31804
31850
|
var JAVA_INLINE_MATCHES_RE = /\.\s*matches\s*\(\s*"((?:[^"\\]|\\.)*)"\s*\)/g;
|
|
31805
31851
|
function resolveJavaReceiverType(receiver, sinkLine, sourceLines) {
|
|
31806
31852
|
if (!receiver || !/^[A-Za-z_]\w*$/.test(receiver))
|
|
@@ -32580,6 +32626,12 @@ class SinkFilterPass {
|
|
|
32580
32626
|
if (language === "java" && !HTML_CONTENT_TYPE_RE.test(ctx.code)) {
|
|
32581
32627
|
filtered = filtered.filter((sink) => !(sink.type === "xss" && sink.method === "body"));
|
|
32582
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
|
+
}
|
|
32583
32635
|
if (["javascript", "typescript"].includes(language)) {
|
|
32584
32636
|
const sourceLines = ctx.code.split(`
|
|
32585
32637
|
`);
|
|
@@ -47032,7 +47084,7 @@ var colors = {
|
|
|
47032
47084
|
};
|
|
47033
47085
|
|
|
47034
47086
|
// src/version.ts
|
|
47035
|
-
var version = "3.
|
|
47087
|
+
var version = "3.210.0";
|
|
47036
47088
|
|
|
47037
47089
|
// src/formatters.ts
|
|
47038
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",
|