cognium-dev 3.146.0 → 3.148.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
|
@@ -12318,6 +12318,38 @@ function isSafeGoExecCommandCall(call, pattern, language) {
|
|
|
12318
12318
|
]);
|
|
12319
12319
|
if (SHELL_PROGRAMS.has(program))
|
|
12320
12320
|
return false;
|
|
12321
|
+
const PACKAGE_MANAGER_EXEC_SUBCOMMANDS = {
|
|
12322
|
+
go: new Set(["install", "run", "get"]),
|
|
12323
|
+
npm: new Set(["install", "i", "exec"]),
|
|
12324
|
+
npx: new Set(["*"]),
|
|
12325
|
+
pip: new Set(["install"]),
|
|
12326
|
+
pip3: new Set(["install"]),
|
|
12327
|
+
gem: new Set(["install"]),
|
|
12328
|
+
cargo: new Set(["install", "run"]),
|
|
12329
|
+
yarn: new Set(["add", "install", "exec", "dlx"]),
|
|
12330
|
+
pnpm: new Set(["add", "install", "exec", "dlx"])
|
|
12331
|
+
};
|
|
12332
|
+
const pmSubcommands = PACKAGE_MANAGER_EXEC_SUBCOMMANDS[program];
|
|
12333
|
+
if (pmSubcommands !== undefined) {
|
|
12334
|
+
const subcommandArgPos = pattern.method === "CommandContext" ? 2 : 1;
|
|
12335
|
+
const subcommandArg = call.arguments.find((a) => a.position === subcommandArgPos);
|
|
12336
|
+
if (!subcommandArg)
|
|
12337
|
+
return false;
|
|
12338
|
+
let subcommand;
|
|
12339
|
+
if (subcommandArg.literal !== null && subcommandArg.literal !== undefined) {
|
|
12340
|
+
subcommand = String(subcommandArg.literal);
|
|
12341
|
+
} else {
|
|
12342
|
+
const expr = (subcommandArg.expression ?? "").trim();
|
|
12343
|
+
if (expr.startsWith('"') || expr.startsWith("`") || expr.startsWith("'")) {
|
|
12344
|
+
subcommand = expr.slice(1, -1);
|
|
12345
|
+
}
|
|
12346
|
+
}
|
|
12347
|
+
if (subcommand === undefined)
|
|
12348
|
+
return false;
|
|
12349
|
+
if (pmSubcommands.has("*") || pmSubcommands.has(subcommand)) {
|
|
12350
|
+
return false;
|
|
12351
|
+
}
|
|
12352
|
+
}
|
|
12321
12353
|
return true;
|
|
12322
12354
|
}
|
|
12323
12355
|
function isSafeJSChildProcessCall(call, pattern, language) {
|
|
@@ -26011,6 +26043,18 @@ function findJavaResponseWriterXssFindings(code, file) {
|
|
|
26011
26043
|
if (respNames.size === 0)
|
|
26012
26044
|
return out2;
|
|
26013
26045
|
const safeWrapRe = /\b(?:Encode\.(?:forHtml|forHtmlAttribute|forHtmlContent|forJavaScript)|StringEscapeUtils\.escape(?:Html3|Html4|EcmaScript|Xml)|HtmlUtils\.htmlEscape(?:Decimal|Hex)?|Escaper\.escapeHtml|HtmlEscapers\.(?:escapeHtml|htmlEscaper)|Encoder\.encodeForHTML(?:Attribute)?|Jsoup\.clean)\s*\(/;
|
|
26046
|
+
const sanitizedVars = new Set;
|
|
26047
|
+
const sanAssignRe = /(?:^|[\s;{},(])(?:final\s+)?(?:[A-Za-z_][\w.<>\[\]]*\s+)?([A-Za-z_]\w*)\s*=\s*[^=]/;
|
|
26048
|
+
for (const line of lines) {
|
|
26049
|
+
const t = line.trim();
|
|
26050
|
+
if (!t || t.startsWith("//") || t.startsWith("*"))
|
|
26051
|
+
continue;
|
|
26052
|
+
if (!safeWrapRe.test(t))
|
|
26053
|
+
continue;
|
|
26054
|
+
const am = t.match(sanAssignRe);
|
|
26055
|
+
if (am)
|
|
26056
|
+
sanitizedVars.add(am[1]);
|
|
26057
|
+
}
|
|
26014
26058
|
for (let i2 = 0;i2 < lines.length; i2++) {
|
|
26015
26059
|
const raw = lines[i2];
|
|
26016
26060
|
const trimmed = raw.trim();
|
|
@@ -26031,6 +26075,14 @@ function findJavaResponseWriterXssFindings(code, file) {
|
|
|
26031
26075
|
continue;
|
|
26032
26076
|
if (!/[A-Za-z_]\w*/.test(argsTrim))
|
|
26033
26077
|
continue;
|
|
26078
|
+
if (sanitizedVars.size > 0) {
|
|
26079
|
+
const stripped = argsTrim.replace(/"(?:\\.|[^"\\])*"/g, "");
|
|
26080
|
+
const idents = stripped.match(/\b[A-Za-z_]\w*\b/g) ?? [];
|
|
26081
|
+
const nonKeyword = idents.filter((x) => x !== "null" && x !== "true" && x !== "false");
|
|
26082
|
+
if (nonKeyword.length > 0 && nonKeyword.every((x) => sanitizedVars.has(x))) {
|
|
26083
|
+
continue;
|
|
26084
|
+
}
|
|
26085
|
+
}
|
|
26034
26086
|
out2.push({
|
|
26035
26087
|
id: `xss-${file}-${i2 + 1}`,
|
|
26036
26088
|
pass: "language-sources",
|
|
@@ -42230,7 +42282,7 @@ var colors = {
|
|
|
42230
42282
|
};
|
|
42231
42283
|
|
|
42232
42284
|
// src/version.ts
|
|
42233
|
-
var version = "3.
|
|
42285
|
+
var version = "3.148.0";
|
|
42234
42286
|
|
|
42235
42287
|
// src/formatters.ts
|
|
42236
42288
|
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.148.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.148.0"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@types/node": "^25.5.0",
|