cognium-dev 4.7.1 → 4.7.2
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 +78 -6
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -11386,7 +11386,7 @@ var DEFAULT_SINKS = [
|
|
|
11386
11386
|
{ method: "setCommandline", class: "DefaultExecutor", type: "command_injection", cwe: "CWE-78", severity: "critical", arg_positions: [0] },
|
|
11387
11387
|
{ method: "parse", class: "CommandLine", type: "command_injection", cwe: "CWE-78", severity: "critical", arg_positions: [0] },
|
|
11388
11388
|
{ method: "addArgument", class: "CommandLine", type: "command_injection", cwe: "CWE-78", severity: "critical", arg_positions: [0] },
|
|
11389
|
-
{ method: "File", class: "constructor", type: "path_traversal", cwe: "CWE-22", severity: "high", arg_positions: [0, 1] },
|
|
11389
|
+
{ method: "File", class: "constructor", type: "path_traversal", cwe: "CWE-22", severity: "high", arg_positions: [0, 1], exclude_languages: ["csharp"] },
|
|
11390
11390
|
{ method: "FileInputStream", class: "constructor", type: "path_traversal", cwe: "CWE-22", severity: "high", arg_positions: [0] },
|
|
11391
11391
|
{ method: "FileOutputStream", class: "constructor", type: "path_traversal", cwe: "CWE-22", severity: "high", arg_positions: [0] },
|
|
11392
11392
|
{ method: "FileReader", class: "constructor", type: "path_traversal", cwe: "CWE-22", severity: "high", arg_positions: [0] },
|
|
@@ -12347,6 +12347,18 @@ var DEFAULT_SINKS = [
|
|
|
12347
12347
|
{ method: "FileStream", type: "path_traversal", cwe: "CWE-22", severity: "high", arg_positions: [0], languages: ["csharp"] },
|
|
12348
12348
|
{ method: "StreamReader", type: "path_traversal", cwe: "CWE-22", severity: "high", arg_positions: [0], languages: ["csharp"] },
|
|
12349
12349
|
{ method: "StreamWriter", type: "path_traversal", cwe: "CWE-22", severity: "high", arg_positions: [0], languages: ["csharp"] },
|
|
12350
|
+
{ method: "Copy", class: "File", type: "path_traversal", cwe: "CWE-22", severity: "high", arg_positions: [0, 1], languages: ["csharp"] },
|
|
12351
|
+
{ method: "Move", class: "File", type: "path_traversal", cwe: "CWE-22", severity: "high", arg_positions: [0, 1], languages: ["csharp"] },
|
|
12352
|
+
{ method: "Delete", class: "File", type: "path_traversal", cwe: "CWE-22", severity: "high", arg_positions: [0], languages: ["csharp"] },
|
|
12353
|
+
{ method: "Open", class: "File", type: "path_traversal", cwe: "CWE-22", severity: "high", arg_positions: [0], languages: ["csharp"] },
|
|
12354
|
+
{ method: "OpenText", class: "File", type: "path_traversal", cwe: "CWE-22", severity: "high", arg_positions: [0], languages: ["csharp"] },
|
|
12355
|
+
{ method: "Create", class: "File", type: "path_traversal", cwe: "CWE-22", severity: "high", arg_positions: [0], languages: ["csharp"] },
|
|
12356
|
+
{ method: "WriteAllLines", type: "path_traversal", cwe: "CWE-22", severity: "high", arg_positions: [0], languages: ["csharp"] },
|
|
12357
|
+
{ method: "AppendAllLines", type: "path_traversal", cwe: "CWE-22", severity: "high", arg_positions: [0], languages: ["csharp"] },
|
|
12358
|
+
{ method: "CreateDirectory", class: "Directory", type: "path_traversal", cwe: "CWE-22", severity: "high", arg_positions: [0], languages: ["csharp"] },
|
|
12359
|
+
{ method: "Delete", class: "Directory", type: "path_traversal", cwe: "CWE-22", severity: "high", arg_positions: [0], languages: ["csharp"] },
|
|
12360
|
+
{ method: "GetFiles", class: "Directory", type: "path_traversal", cwe: "CWE-22", severity: "high", arg_positions: [0], languages: ["csharp"] },
|
|
12361
|
+
{ method: "EnumerateFiles", class: "Directory", type: "path_traversal", cwe: "CWE-22", severity: "high", arg_positions: [0], languages: ["csharp"] },
|
|
12350
12362
|
{ method: "GetAsync", type: "ssrf", cwe: "CWE-918", severity: "high", arg_positions: [0], languages: ["csharp"] },
|
|
12351
12363
|
{ method: "PostAsync", type: "ssrf", cwe: "CWE-918", severity: "high", arg_positions: [0], languages: ["csharp"] },
|
|
12352
12364
|
{ method: "PutAsync", type: "ssrf", cwe: "CWE-918", severity: "high", arg_positions: [0], languages: ["csharp"] },
|
|
@@ -12361,8 +12373,14 @@ var DEFAULT_SINKS = [
|
|
|
12361
12373
|
{ method: "Create", class: "WebRequest", type: "ssrf", cwe: "CWE-918", severity: "high", arg_positions: [0], languages: ["csharp"] },
|
|
12362
12374
|
{ method: "EvaluateAsync", type: "code_injection", cwe: "CWE-94", severity: "critical", arg_positions: [0], languages: ["csharp"] },
|
|
12363
12375
|
{ method: "RunAsync", class: "CSharpScript", type: "code_injection", cwe: "CWE-94", severity: "critical", arg_positions: [0], languages: ["csharp"] },
|
|
12376
|
+
{ method: "Load", class: "Assembly", type: "code_injection", cwe: "CWE-94", severity: "critical", arg_positions: [0], languages: ["csharp"] },
|
|
12377
|
+
{ method: "LoadFrom", class: "Assembly", type: "code_injection", cwe: "CWE-94", severity: "critical", arg_positions: [0], languages: ["csharp"] },
|
|
12378
|
+
{ method: "LoadFile", class: "Assembly", type: "code_injection", cwe: "CWE-94", severity: "critical", arg_positions: [0], languages: ["csharp"] },
|
|
12364
12379
|
{ method: "Deserialize", class: "BinaryFormatter", type: "deserialization", cwe: "CWE-502", severity: "critical", arg_positions: [0], languages: ["csharp"] },
|
|
12365
12380
|
{ method: "Deserialize", class: "NetDataContractSerializer", type: "deserialization", cwe: "CWE-502", severity: "critical", arg_positions: [0], languages: ["csharp"] },
|
|
12381
|
+
{ method: "Deserialize", class: "SoapFormatter", type: "deserialization", cwe: "CWE-502", severity: "critical", arg_positions: [0], languages: ["csharp"] },
|
|
12382
|
+
{ method: "Deserialize", class: "LosFormatter", type: "deserialization", cwe: "CWE-502", severity: "critical", arg_positions: [0], languages: ["csharp"] },
|
|
12383
|
+
{ method: "Deserialize", class: "ObjectStateFormatter", type: "deserialization", cwe: "CWE-502", severity: "critical", arg_positions: [0], languages: ["csharp"] },
|
|
12366
12384
|
{ method: "Raw", class: "Html", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0], languages: ["csharp"] },
|
|
12367
12385
|
{ method: "Write", class: "Response", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0], languages: ["csharp"] },
|
|
12368
12386
|
{ method: "HtmlString", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0], languages: ["csharp"] },
|
|
@@ -12373,12 +12391,20 @@ var DEFAULT_SINKS = [
|
|
|
12373
12391
|
{ method: "AddHeader", type: "crlf", cwe: "CWE-113", severity: "medium", arg_positions: [1], languages: ["csharp"] },
|
|
12374
12392
|
{ method: "AppendHeader", type: "crlf", cwe: "CWE-113", severity: "medium", arg_positions: [1], languages: ["csharp"] },
|
|
12375
12393
|
{ method: "Parse", class: "BsonDocument", type: "nosql_injection", cwe: "CWE-943", severity: "high", arg_positions: [0], languages: ["csharp"] },
|
|
12394
|
+
{ method: "LogInformation", type: "log_injection", cwe: "CWE-117", severity: "low", arg_positions: [0], languages: ["csharp"] },
|
|
12395
|
+
{ method: "LogWarning", type: "log_injection", cwe: "CWE-117", severity: "low", arg_positions: [0], languages: ["csharp"] },
|
|
12396
|
+
{ method: "LogError", type: "log_injection", cwe: "CWE-117", severity: "low", arg_positions: [0], languages: ["csharp"] },
|
|
12397
|
+
{ method: "LogDebug", type: "log_injection", cwe: "CWE-117", severity: "low", arg_positions: [0], languages: ["csharp"] },
|
|
12398
|
+
{ method: "LogCritical", type: "log_injection", cwe: "CWE-117", severity: "low", arg_positions: [0], languages: ["csharp"] },
|
|
12399
|
+
{ method: "LogTrace", type: "log_injection", cwe: "CWE-117", severity: "low", arg_positions: [0], languages: ["csharp"] },
|
|
12400
|
+
{ method: "Log", class: "ILogger", type: "log_injection", cwe: "CWE-117", severity: "low", arg_positions: [1], languages: ["csharp"] },
|
|
12376
12401
|
{ method: "SelectSingleNode", type: "xpath_injection", cwe: "CWE-643", severity: "high", arg_positions: [0], languages: ["csharp"] },
|
|
12377
12402
|
{ method: "SelectNodes", type: "xpath_injection", cwe: "CWE-643", severity: "high", arg_positions: [0], languages: ["csharp"] },
|
|
12378
12403
|
{ method: "Compile", class: "XPathExpression", type: "xpath_injection", cwe: "CWE-643", severity: "high", arg_positions: [0], languages: ["csharp"] },
|
|
12379
12404
|
{ method: "LoadXml", type: "xxe", cwe: "CWE-611", severity: "high", arg_positions: [0], languages: ["csharp"] },
|
|
12380
12405
|
{ method: "Load", class: "XmlDocument", type: "xxe", cwe: "CWE-611", severity: "high", arg_positions: [0], languages: ["csharp"] },
|
|
12381
12406
|
{ method: "Load", class: "XDocument", type: "xxe", cwe: "CWE-611", severity: "high", arg_positions: [0], languages: ["csharp"] },
|
|
12407
|
+
{ method: "XmlTextReader", type: "xxe", cwe: "CWE-611", severity: "high", arg_positions: [0], languages: ["csharp"] },
|
|
12382
12408
|
{ method: "execute", class: "Connection", type: "sql_injection", cwe: "CWE-89", severity: "critical", arg_positions: [0] },
|
|
12383
12409
|
{ method: "fetch", class: "Connection", type: "sql_injection", cwe: "CWE-89", severity: "critical", arg_positions: [0] },
|
|
12384
12410
|
{ method: "fetchrow", class: "Connection", type: "sql_injection", cwe: "CWE-89", severity: "critical", arg_positions: [0] },
|
|
@@ -13514,6 +13540,40 @@ function isSafeJSChildProcessCall(call, pattern, language) {
|
|
|
13514
13540
|
return false;
|
|
13515
13541
|
return true;
|
|
13516
13542
|
}
|
|
13543
|
+
function isSafeCSharpProcessStartCall(call, pattern, language) {
|
|
13544
|
+
if (language !== "csharp")
|
|
13545
|
+
return false;
|
|
13546
|
+
if (pattern.type !== "command_injection")
|
|
13547
|
+
return false;
|
|
13548
|
+
if (call.method_name !== "Start")
|
|
13549
|
+
return false;
|
|
13550
|
+
if (call.arguments.length < 2)
|
|
13551
|
+
return false;
|
|
13552
|
+
const fileArg = call.arguments.find((a) => a.position === 0);
|
|
13553
|
+
if (!fileArg)
|
|
13554
|
+
return false;
|
|
13555
|
+
let raw;
|
|
13556
|
+
if (fileArg.literal !== null && fileArg.literal !== undefined) {
|
|
13557
|
+
raw = String(fileArg.literal).trim();
|
|
13558
|
+
} else {
|
|
13559
|
+
raw = (fileArg.expression ?? "").trim();
|
|
13560
|
+
}
|
|
13561
|
+
if (!/^@?"[^"]*"$/.test(raw))
|
|
13562
|
+
return false;
|
|
13563
|
+
const program = (raw.replace(/^@?"|"$/g, "").split(/[\\/]/).pop() ?? "").toLowerCase().replace(/\.exe$/, "");
|
|
13564
|
+
const SHELL_PROGRAMS = new Set([
|
|
13565
|
+
"sh",
|
|
13566
|
+
"bash",
|
|
13567
|
+
"zsh",
|
|
13568
|
+
"dash",
|
|
13569
|
+
"ash",
|
|
13570
|
+
"ksh",
|
|
13571
|
+
"cmd",
|
|
13572
|
+
"powershell",
|
|
13573
|
+
"pwsh"
|
|
13574
|
+
]);
|
|
13575
|
+
return !SHELL_PROGRAMS.has(program);
|
|
13576
|
+
}
|
|
13517
13577
|
function isSafeRustCommandCall(call, pattern, language) {
|
|
13518
13578
|
if (language !== "rust")
|
|
13519
13579
|
return false;
|
|
@@ -13804,6 +13864,9 @@ function findSinks(calls, patterns, typeHierarchy, language, sourceLines, types)
|
|
|
13804
13864
|
if (isSafeJSChildProcessCall(call, pattern, language)) {
|
|
13805
13865
|
continue;
|
|
13806
13866
|
}
|
|
13867
|
+
if (isSafeCSharpProcessStartCall(call, pattern, language)) {
|
|
13868
|
+
continue;
|
|
13869
|
+
}
|
|
13807
13870
|
if (pattern.safe_if_class_literal_at !== undefined && argIsClassLiteral(call, pattern.safe_if_class_literal_at, types)) {
|
|
13808
13871
|
continue;
|
|
13809
13872
|
}
|
|
@@ -14944,7 +15007,7 @@ function canSourceReachSink(sourceType, sinkType) {
|
|
|
14944
15007
|
file_input: ["deserialization", "xxe", "path_traversal", "command_injection", "code_injection"],
|
|
14945
15008
|
network_input: ["sql_injection", "command_injection", "xss", "ssrf", "log_injection", "format_string", "nosql_injection", "prompt_injection"],
|
|
14946
15009
|
config_param: ["sql_injection", "command_injection", "path_traversal", "xss", "ssrf", "log_injection", "format_string"],
|
|
14947
|
-
interprocedural_param: ["sql_injection", "command_injection", "path_traversal", "xss", "xpath_injection", "ldap_injection", "ssrf", "code_injection", "mybatis_mapper_call", "crlf", "mass_assignment", "open_redirect", "trust_boundary", "log_injection", "format_string", "nosql_injection", "prompt_injection"],
|
|
15010
|
+
interprocedural_param: ["sql_injection", "command_injection", "path_traversal", "xss", "xpath_injection", "ldap_injection", "ssrf", "code_injection", "mybatis_mapper_call", "crlf", "mass_assignment", "open_redirect", "trust_boundary", "log_injection", "format_string", "nosql_injection", "prompt_injection", "xxe", "deserialization"],
|
|
14948
15011
|
plugin_param: ["sql_injection", "command_injection", "path_traversal", "xss", "code_injection", "log_injection", "format_string"]
|
|
14949
15012
|
};
|
|
14950
15013
|
const validSinks = sourceToSinkMapping[sourceType];
|
|
@@ -26443,7 +26506,8 @@ function buildJavaTaintedVars(sourceCode, seedVars) {
|
|
|
26443
26506
|
if (knownTainted.has(lhs))
|
|
26444
26507
|
continue;
|
|
26445
26508
|
const escaped = (v) => v.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
26446
|
-
const
|
|
26509
|
+
const rhsCode = rhs.replace(/\$@?"(?:[^"\\]|\\.)*"/g, (lit) => " " + [...lit.matchAll(/\{([^}]*)\}/g)].map((x) => x[1]).join(" ") + " ").replace(/@?"(?:[^"\\]|\\.)*"/g, " ").replace(/'(?:[^'\\]|\\.)'/g, " ");
|
|
26510
|
+
const ref = [...knownTainted].some((v) => new RegExp(`(?<![\\p{L}\\p{N}_])${escaped(v)}(?![\\p{L}\\p{N}_])`, "u").test(rhsCode));
|
|
26447
26511
|
if (ref) {
|
|
26448
26512
|
derived.set(lhs, i2 + 1);
|
|
26449
26513
|
knownTainted.add(lhs);
|
|
@@ -41433,6 +41497,10 @@ function isLikelyCredentialAssignment(line) {
|
|
|
41433
41497
|
return null;
|
|
41434
41498
|
if (isAllSameChar(value))
|
|
41435
41499
|
return null;
|
|
41500
|
+
if (value.toLowerCase() === name2.toLowerCase())
|
|
41501
|
+
return null;
|
|
41502
|
+
if (/^(?:https?:\/\/|urn:|xmlns)/i.test(value))
|
|
41503
|
+
return null;
|
|
41436
41504
|
if (value.length < 12)
|
|
41437
41505
|
return null;
|
|
41438
41506
|
if (shannonEntropy(value) < 3.5)
|
|
@@ -48085,7 +48153,7 @@ var colors = {
|
|
|
48085
48153
|
};
|
|
48086
48154
|
|
|
48087
48155
|
// src/version.ts
|
|
48088
|
-
var version = "4.7.
|
|
48156
|
+
var version = "4.7.2";
|
|
48089
48157
|
|
|
48090
48158
|
// src/formatters.ts
|
|
48091
48159
|
var LIBRARY_API_SURFACE_TAG2 = "library-api-surface:caller-responsibility";
|
|
@@ -49163,7 +49231,9 @@ async function initWasm(spin) {
|
|
|
49163
49231
|
typescript: join3(wasmDir, "tree-sitter-javascript.wasm"),
|
|
49164
49232
|
python: join3(wasmDir, "tree-sitter-python.wasm"),
|
|
49165
49233
|
rust: join3(wasmDir, "tree-sitter-rust.wasm"),
|
|
49166
|
-
html: join3(wasmDir, "tree-sitter-html.wasm")
|
|
49234
|
+
html: join3(wasmDir, "tree-sitter-html.wasm"),
|
|
49235
|
+
csharp: join3(wasmDir, "tree-sitter-csharp.wasm"),
|
|
49236
|
+
tsx: join3(wasmDir, "tree-sitter-tsx.wasm")
|
|
49167
49237
|
}
|
|
49168
49238
|
});
|
|
49169
49239
|
} else {
|
|
@@ -49196,7 +49266,9 @@ Please ensure the wasm/ directory is located next to the binary or in your curre
|
|
|
49196
49266
|
typescript: wasmBasePath + "tree-sitter-javascript.wasm",
|
|
49197
49267
|
python: wasmBasePath + "tree-sitter-python.wasm",
|
|
49198
49268
|
rust: wasmBasePath + "tree-sitter-rust.wasm",
|
|
49199
|
-
html: wasmBasePath + "tree-sitter-html.wasm"
|
|
49269
|
+
html: wasmBasePath + "tree-sitter-html.wasm",
|
|
49270
|
+
csharp: wasmBasePath + "tree-sitter-csharp.wasm",
|
|
49271
|
+
tsx: wasmBasePath + "tree-sitter-tsx.wasm"
|
|
49200
49272
|
}
|
|
49201
49273
|
});
|
|
49202
49274
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cognium-dev",
|
|
3
|
-
"version": "4.7.
|
|
3
|
+
"version": "4.7.2",
|
|
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": "^4.7.
|
|
69
|
+
"circle-ir": "^4.7.2"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@types/node": "^25.5.0",
|