cognium-dev 3.214.0 → 3.216.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 +91 -3
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -11220,8 +11220,8 @@ var DEFAULT_SINKS = [
|
|
|
11220
11220
|
{ method: "addAttribute", class: "Model", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [1] },
|
|
11221
11221
|
{ method: "addAttribute", class: "ModelMap", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [1] },
|
|
11222
11222
|
{ method: "addObject", class: "ModelAndView", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [1] },
|
|
11223
|
-
{ method: "println", type: "xss", cwe: "CWE-79", severity: "medium", arg_positions: [0] },
|
|
11224
|
-
{ method: "print", type: "xss", cwe: "CWE-79", severity: "medium", arg_positions: [0] },
|
|
11223
|
+
{ method: "println", type: "xss", cwe: "CWE-79", severity: "medium", arg_positions: [0], languages: ["java"] },
|
|
11224
|
+
{ method: "print", type: "xss", cwe: "CWE-79", severity: "medium", arg_positions: [0], languages: ["java"] },
|
|
11225
11225
|
{ method: "handleHyperlinks", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0] },
|
|
11226
11226
|
{ method: "handleDiv", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0] },
|
|
11227
11227
|
{ method: "handleImage", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0] },
|
|
@@ -31855,6 +31855,8 @@ var SQL_EXEC_METHODS = new Set([
|
|
|
31855
31855
|
var JAVA_SQL_ASSIGN_RE_TEMPLATE = "\\b(?:String|CharSequence|final\\s+String|var)\\s+SQLVAR\\b\\s*=\\s*(.+?);";
|
|
31856
31856
|
var REPLACE_ALL_TO_PLACEHOLDER_RE = /\.replaceAll\s*\([\s\S]*?,\s*"[\s,?]*\?[\s,?]*"\s*\)/;
|
|
31857
31857
|
var HTML_CONTENT_TYPE_RE = /text\/html|TEXT_HTML/;
|
|
31858
|
+
var FETCH_GLOBAL_RECEIVER_RE = /(?:^|[^.\w])(?:window|globalThis|self|global)\s*\.\s*fetch\s*\(/;
|
|
31859
|
+
var FETCH_MEMBER_RECEIVER_RE = /[\w$)\]]\s*\.\s*fetch\s*\(/;
|
|
31858
31860
|
function javaTraversalRejectGuardedLines(code) {
|
|
31859
31861
|
const covered = new Set;
|
|
31860
31862
|
const lines = code.split(`
|
|
@@ -31901,6 +31903,74 @@ function javaTraversalRejectGuardedLines(code) {
|
|
|
31901
31903
|
}
|
|
31902
31904
|
return covered;
|
|
31903
31905
|
}
|
|
31906
|
+
function isAnchoredHostAllowlistRegex(src) {
|
|
31907
|
+
if (!src.startsWith("^"))
|
|
31908
|
+
return false;
|
|
31909
|
+
if (!/https?/i.test(src))
|
|
31910
|
+
return false;
|
|
31911
|
+
return /[A-Za-z][A-Za-z0-9-]+\\?\./.test(src);
|
|
31912
|
+
}
|
|
31913
|
+
function isSchemeHostPrefix(prefix) {
|
|
31914
|
+
if (!/^https?:\/\//i.test(prefix))
|
|
31915
|
+
return false;
|
|
31916
|
+
const afterScheme = prefix.replace(/^https?:\/\//i, "");
|
|
31917
|
+
return /[A-Za-z][A-Za-z0-9-]*\./.test(afterScheme);
|
|
31918
|
+
}
|
|
31919
|
+
function jsSsrfHostGuardedLines(code) {
|
|
31920
|
+
const covered = new Set;
|
|
31921
|
+
const lines = code.split(`
|
|
31922
|
+
`);
|
|
31923
|
+
const rejectRegexTest = /\bif\s*\(\s*!\s*\/((?:[^/\\]|\\.)*)\/[a-z]*\s*\.\s*test\s*\(\s*([A-Za-z_]\w*)\s*\)/;
|
|
31924
|
+
const rejectStartsWith = /\bif\s*\(\s*!\s*([A-Za-z_]\w*)\s*\.\s*startsWith\s*\(\s*["'`]([^"'`]+)["'`]/;
|
|
31925
|
+
const terminatorRe = /\b(throw|return)\b/;
|
|
31926
|
+
const assignRe = /^\s*(?:const|let|var\s+)?\s*([A-Za-z_]\w*)\s*=(?!=)\s*(.*)$/;
|
|
31927
|
+
for (let i2 = 0;i2 < lines.length; i2++) {
|
|
31928
|
+
let guardedVar = null;
|
|
31929
|
+
const rm = rejectRegexTest.exec(lines[i2]);
|
|
31930
|
+
if (rm && isAnchoredHostAllowlistRegex(rm[1]))
|
|
31931
|
+
guardedVar = rm[2];
|
|
31932
|
+
if (!guardedVar) {
|
|
31933
|
+
const sm = rejectStartsWith.exec(lines[i2]);
|
|
31934
|
+
if (sm && isSchemeHostPrefix(sm[2]))
|
|
31935
|
+
guardedVar = sm[1];
|
|
31936
|
+
}
|
|
31937
|
+
if (!guardedVar)
|
|
31938
|
+
continue;
|
|
31939
|
+
let hasTerminator = terminatorRe.test(lines[i2]);
|
|
31940
|
+
if (!hasTerminator) {
|
|
31941
|
+
for (let j = i2 + 1;j < Math.min(lines.length, i2 + 6); j++) {
|
|
31942
|
+
if (terminatorRe.test(lines[j])) {
|
|
31943
|
+
hasTerminator = true;
|
|
31944
|
+
break;
|
|
31945
|
+
}
|
|
31946
|
+
if (lines[j].includes("}"))
|
|
31947
|
+
break;
|
|
31948
|
+
}
|
|
31949
|
+
}
|
|
31950
|
+
if (!hasTerminator)
|
|
31951
|
+
continue;
|
|
31952
|
+
const guarded = new Set([guardedVar]);
|
|
31953
|
+
const mentionsGuarded = (text) => {
|
|
31954
|
+
for (const name2 of guarded)
|
|
31955
|
+
if (new RegExp(`\\b${name2}\\b`).test(text))
|
|
31956
|
+
return true;
|
|
31957
|
+
return false;
|
|
31958
|
+
};
|
|
31959
|
+
for (let l = i2 + 1;l < lines.length; l++) {
|
|
31960
|
+
const lineText = lines[l];
|
|
31961
|
+
const assign = assignRe.exec(lineText);
|
|
31962
|
+
if (assign) {
|
|
31963
|
+
if (mentionsGuarded(assign[2]))
|
|
31964
|
+
guarded.add(assign[1]);
|
|
31965
|
+
else if (assign[1] !== guardedVar)
|
|
31966
|
+
guarded.delete(assign[1]);
|
|
31967
|
+
}
|
|
31968
|
+
if (mentionsGuarded(lineText))
|
|
31969
|
+
covered.add(l + 1);
|
|
31970
|
+
}
|
|
31971
|
+
}
|
|
31972
|
+
return covered;
|
|
31973
|
+
}
|
|
31904
31974
|
var JAVA_INLINE_MATCHES_RE = /\.\s*matches\s*\(\s*"((?:[^"\\]|\\.)*)"\s*\)/g;
|
|
31905
31975
|
function resolveJavaReceiverType(receiver, sinkLine, sourceLines) {
|
|
31906
31976
|
if (!receiver || !/^[A-Za-z_]\w*$/.test(receiver))
|
|
@@ -32688,6 +32758,24 @@ class SinkFilterPass {
|
|
|
32688
32758
|
}
|
|
32689
32759
|
if (["javascript", "typescript"].includes(language)) {
|
|
32690
32760
|
const sourceLines = ctx.code.split(`
|
|
32761
|
+
`);
|
|
32762
|
+
filtered = filtered.filter((sink) => {
|
|
32763
|
+
if (sink.type !== "ssrf" || sink.method !== "fetch")
|
|
32764
|
+
return true;
|
|
32765
|
+
const sinkLineText = sourceLines[sink.line - 1] ?? "";
|
|
32766
|
+
if (FETCH_GLOBAL_RECEIVER_RE.test(sinkLineText))
|
|
32767
|
+
return true;
|
|
32768
|
+
return !FETCH_MEMBER_RECEIVER_RE.test(sinkLineText);
|
|
32769
|
+
});
|
|
32770
|
+
}
|
|
32771
|
+
if (["javascript", "typescript"].includes(language)) {
|
|
32772
|
+
const guardedLines = jsSsrfHostGuardedLines(ctx.code);
|
|
32773
|
+
if (guardedLines.size > 0) {
|
|
32774
|
+
filtered = filtered.filter((sink) => !(sink.type === "ssrf" && guardedLines.has(sink.line)));
|
|
32775
|
+
}
|
|
32776
|
+
}
|
|
32777
|
+
if (["javascript", "typescript"].includes(language)) {
|
|
32778
|
+
const sourceLines = ctx.code.split(`
|
|
32691
32779
|
`);
|
|
32692
32780
|
filtered = filtered.filter((sink) => {
|
|
32693
32781
|
if (sink.type !== "log_injection")
|
|
@@ -47138,7 +47226,7 @@ var colors = {
|
|
|
47138
47226
|
};
|
|
47139
47227
|
|
|
47140
47228
|
// src/version.ts
|
|
47141
|
-
var version = "3.
|
|
47229
|
+
var version = "3.216.0";
|
|
47142
47230
|
|
|
47143
47231
|
// src/formatters.ts
|
|
47144
47232
|
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.216.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.216.0"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@types/node": "^25.5.0",
|