cognium-dev 3.111.0 → 3.113.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 +98 -7
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -11051,7 +11051,17 @@ var DEFAULT_SINKS = [
|
|
|
11051
11051
|
{ method: "execute", class: "Pool", type: "sql_injection", cwe: "CWE-89", severity: "critical", arg_positions: [0], languages: ["javascript", "typescript"], allow_unresolved_receiver: true },
|
|
11052
11052
|
{ method: "execute", class: "Connection", type: "sql_injection", cwe: "CWE-89", severity: "critical", arg_positions: [0], languages: ["javascript", "typescript"], allow_unresolved_receiver: true },
|
|
11053
11053
|
{ method: "raw", type: "sql_injection", cwe: "CWE-89", severity: "high", arg_positions: [0], languages: ["javascript", "typescript"] },
|
|
11054
|
+
{ method: "all", class: "Connection", type: "sql_injection", cwe: "CWE-89", severity: "critical", arg_positions: [0], languages: ["javascript", "typescript"], allow_unresolved_receiver: true },
|
|
11055
|
+
{ method: "run", class: "Connection", type: "sql_injection", cwe: "CWE-89", severity: "critical", arg_positions: [0], languages: ["javascript", "typescript"], allow_unresolved_receiver: true },
|
|
11056
|
+
{ method: "each", class: "Connection", type: "sql_injection", cwe: "CWE-89", severity: "critical", arg_positions: [0], languages: ["javascript", "typescript"], allow_unresolved_receiver: true },
|
|
11057
|
+
{ method: "get", class: "Connection", type: "sql_injection", cwe: "CWE-89", severity: "critical", arg_positions: [0], languages: ["javascript", "typescript"], allow_unresolved_receiver: true },
|
|
11058
|
+
{ method: "exec", class: "Connection", type: "sql_injection", cwe: "CWE-89", severity: "critical", arg_positions: [0], languages: ["javascript", "typescript"], allow_unresolved_receiver: true },
|
|
11054
11059
|
{ method: "setAttribute", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [1] },
|
|
11060
|
+
{ method: "bypassSecurityTrustHtml", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0], languages: ["javascript", "typescript"] },
|
|
11061
|
+
{ method: "bypassSecurityTrustScript", type: "xss", cwe: "CWE-79", severity: "critical", arg_positions: [0], languages: ["javascript", "typescript"] },
|
|
11062
|
+
{ method: "bypassSecurityTrustStyle", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0], languages: ["javascript", "typescript"] },
|
|
11063
|
+
{ method: "bypassSecurityTrustUrl", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0], languages: ["javascript", "typescript"] },
|
|
11064
|
+
{ method: "bypassSecurityTrustResourceUrl", type: "xss", cwe: "CWE-79", severity: "critical", arg_positions: [0], languages: ["javascript", "typescript"] },
|
|
11055
11065
|
{ method: "send", class: "Response", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0] },
|
|
11056
11066
|
{ method: "write", class: "Response", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0] },
|
|
11057
11067
|
{ method: "end", class: "Response", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0] },
|
|
@@ -11062,6 +11072,8 @@ var DEFAULT_SINKS = [
|
|
|
11062
11072
|
{ method: "runInContext", class: "vm", type: "code_injection", cwe: "CWE-94", severity: "critical", arg_positions: [0] },
|
|
11063
11073
|
{ method: "runInNewContext", class: "vm", type: "code_injection", cwe: "CWE-94", severity: "critical", arg_positions: [0] },
|
|
11064
11074
|
{ method: "runInThisContext", class: "vm", type: "code_injection", cwe: "CWE-94", severity: "critical", arg_positions: [0] },
|
|
11075
|
+
{ method: "Script", class: "constructor", type: "code_injection", cwe: "CWE-94", severity: "critical", arg_positions: [0], languages: ["javascript", "typescript"] },
|
|
11076
|
+
{ method: "setImmediate", type: "code_injection", cwe: "CWE-94", severity: "critical", arg_positions: [0], languages: ["javascript", "typescript"] },
|
|
11065
11077
|
{ method: "parse", class: "protobuf", type: "code_injection", cwe: "CWE-94", severity: "critical", arg_positions: [0], languages: ["javascript", "typescript"] },
|
|
11066
11078
|
{ method: "parse", class: "protobufjs", type: "code_injection", cwe: "CWE-94", severity: "critical", arg_positions: [0], languages: ["javascript", "typescript"] },
|
|
11067
11079
|
{ method: "parse", class: "Root", type: "code_injection", cwe: "CWE-94", severity: "critical", arg_positions: [0], languages: ["javascript", "typescript"] },
|
|
@@ -11107,6 +11119,8 @@ var DEFAULT_SINKS = [
|
|
|
11107
11119
|
{ method: "request", class: "needle", type: "ssrf", cwe: "CWE-918", severity: "high", arg_positions: [0] },
|
|
11108
11120
|
{ method: "get", class: "got", type: "ssrf", cwe: "CWE-918", severity: "high", arg_positions: [0] },
|
|
11109
11121
|
{ method: "post", class: "got", type: "ssrf", cwe: "CWE-918", severity: "high", arg_positions: [0] },
|
|
11122
|
+
{ method: "got", type: "ssrf", cwe: "CWE-918", severity: "high", arg_positions: [0], languages: ["javascript", "typescript"] },
|
|
11123
|
+
{ method: "request", type: "ssrf", cwe: "CWE-918", severity: "high", arg_positions: [0], languages: ["javascript", "typescript"] },
|
|
11110
11124
|
{ method: "get", class: "superagent", type: "ssrf", cwe: "CWE-918", severity: "high", arg_positions: [0] },
|
|
11111
11125
|
{ method: "post", class: "superagent", type: "ssrf", cwe: "CWE-918", severity: "high", arg_positions: [0] },
|
|
11112
11126
|
{ method: "default", class: "node-fetch", type: "ssrf", cwe: "CWE-918", severity: "high", arg_positions: [0] },
|
|
@@ -11151,6 +11165,7 @@ var DEFAULT_SINKS = [
|
|
|
11151
11165
|
{ method: "exec", type: "code_injection", cwe: "CWE-94", severity: "critical", arg_positions: [0], languages: ["python"] },
|
|
11152
11166
|
{ method: "compile", type: "code_injection", cwe: "CWE-94", severity: "high", arg_positions: [0], languages: ["python"] },
|
|
11153
11167
|
{ method: "__import__", type: "code_injection", cwe: "CWE-94", severity: "high", arg_positions: [0], languages: ["python"] },
|
|
11168
|
+
{ method: "import_module", class: "importlib", type: "code_injection", cwe: "CWE-94", severity: "high", arg_positions: [0], languages: ["python"] },
|
|
11154
11169
|
{ method: "loads", class: "pickle", type: "deserialization", cwe: "CWE-502", severity: "critical", arg_positions: [0], languages: ["python"] },
|
|
11155
11170
|
{ method: "load", class: "pickle", type: "deserialization", cwe: "CWE-502", severity: "critical", arg_positions: [0], languages: ["python"] },
|
|
11156
11171
|
{ method: "loads", class: "marshal", type: "deserialization", cwe: "CWE-502", severity: "critical", arg_positions: [0], languages: ["python"] },
|
|
@@ -11334,6 +11349,12 @@ var DEFAULT_SINKS = [
|
|
|
11334
11349
|
{ method: "log!", type: "log_injection", cwe: "CWE-117", severity: "low", arg_positions: [0, 1, 2] },
|
|
11335
11350
|
{ method: "println!", type: "log_injection", cwe: "CWE-117", severity: "low", arg_positions: [0, 1, 2] },
|
|
11336
11351
|
{ method: "eprintln!", type: "log_injection", cwe: "CWE-117", severity: "low", arg_positions: [0, 1, 2] },
|
|
11352
|
+
{ method: "log::info!", type: "log_injection", cwe: "CWE-117", severity: "low", arg_positions: [0, 1, 2], languages: ["rust"] },
|
|
11353
|
+
{ method: "log::warn!", type: "log_injection", cwe: "CWE-117", severity: "low", arg_positions: [0, 1, 2], languages: ["rust"] },
|
|
11354
|
+
{ method: "log::error!", type: "log_injection", cwe: "CWE-117", severity: "low", arg_positions: [0, 1, 2], languages: ["rust"] },
|
|
11355
|
+
{ method: "log::debug!", type: "log_injection", cwe: "CWE-117", severity: "low", arg_positions: [0, 1, 2], languages: ["rust"] },
|
|
11356
|
+
{ method: "log::trace!", type: "log_injection", cwe: "CWE-117", severity: "low", arg_positions: [0, 1, 2], languages: ["rust"] },
|
|
11357
|
+
{ method: "log::log!", type: "log_injection", cwe: "CWE-117", severity: "low", arg_positions: [0, 1, 2], languages: ["rust"] },
|
|
11337
11358
|
{ method: "query", class: "sqlx", type: "sql_injection", cwe: "CWE-89", severity: "critical", arg_positions: [0] },
|
|
11338
11359
|
{ method: "query_as", class: "sqlx", type: "sql_injection", cwe: "CWE-89", severity: "critical", arg_positions: [0] },
|
|
11339
11360
|
{ method: "query_as", type: "sql_injection", cwe: "CWE-89", severity: "critical", arg_positions: [0] },
|
|
@@ -12405,7 +12426,7 @@ function findSinks(calls, patterns, typeHierarchy, language, sourceLines) {
|
|
|
12405
12426
|
}
|
|
12406
12427
|
}
|
|
12407
12428
|
}
|
|
12408
|
-
if (pattern.type === "code_injection" && (call.method_name === "setInterval" || call.method_name === "setTimeout")) {
|
|
12429
|
+
if (pattern.type === "code_injection" && (call.method_name === "setInterval" || call.method_name === "setTimeout" || call.method_name === "setImmediate")) {
|
|
12409
12430
|
const firstArg = call.arguments.find((a) => a.position === 0);
|
|
12410
12431
|
if (firstArg && isFunctionCallbackArgument(firstArg)) {
|
|
12411
12432
|
continue;
|
|
@@ -12709,6 +12730,11 @@ function matchesSinkPattern(call, pattern, typeHierarchy, language) {
|
|
|
12709
12730
|
if (typeHierarchy && typeHierarchy.couldBeType(call.receiver, pattern.class)) {
|
|
12710
12731
|
return true;
|
|
12711
12732
|
}
|
|
12733
|
+
const resolvedTarget = call.resolution?.target;
|
|
12734
|
+
const expectedClassMethodTail = `${pattern.class}.${pattern.method}`;
|
|
12735
|
+
if (resolvedTarget && (resolvedTarget === expectedClassMethodTail || resolvedTarget.endsWith("." + expectedClassMethodTail))) {
|
|
12736
|
+
return true;
|
|
12737
|
+
}
|
|
12712
12738
|
if (pattern.allow_unresolved_receiver && !call.receiver_type && !call.receiver_type_fqn && call.receiver.includes(".")) {
|
|
12713
12739
|
return true;
|
|
12714
12740
|
}
|
|
@@ -31672,6 +31698,9 @@ var PY_SECURE_TRUE_RE = /\bsecure\s*=\s*True\b/;
|
|
|
31672
31698
|
var PY_HTTPONLY_TRUE_RE = /\bhttponly\s*=\s*True\b/i;
|
|
31673
31699
|
var JAVA_SET_SECURE_TRUE_RE = /\.setSecure\s*\(\s*true\s*\)/;
|
|
31674
31700
|
var JAVA_SET_HTTPONLY_TRUE_RE = /\.setHttpOnly\s*\(\s*true\s*\)/;
|
|
31701
|
+
var GO_SECURE_TRUE_RE = /\bSecure\s*:\s*true\b/;
|
|
31702
|
+
var GO_HTTPONLY_TRUE_RE = /\bHttpOnly\s*:\s*true\b/;
|
|
31703
|
+
var RUST_SET_COOKIE_MACRO_RE = /(format!|write!|writeln!)\s*\(([^()]*Set-Cookie[^()]*)\)/gis;
|
|
31675
31704
|
|
|
31676
31705
|
class InsecureCookiePass {
|
|
31677
31706
|
name = "insecure-cookie";
|
|
@@ -31706,6 +31735,20 @@ class InsecureCookiePass {
|
|
|
31706
31735
|
insecureCookies.push(det);
|
|
31707
31736
|
this.emit(ctx, file, det, "java");
|
|
31708
31737
|
}
|
|
31738
|
+
} else if (language === "go") {
|
|
31739
|
+
for (const call of graph.ir.calls) {
|
|
31740
|
+
const det = this.detectGo(call);
|
|
31741
|
+
if (!det)
|
|
31742
|
+
continue;
|
|
31743
|
+
insecureCookies.push(det);
|
|
31744
|
+
this.emit(ctx, file, det, "go");
|
|
31745
|
+
}
|
|
31746
|
+
} else if (language === "rust") {
|
|
31747
|
+
const dets = this.detectRustSetCookieFormat(code);
|
|
31748
|
+
for (const det of dets) {
|
|
31749
|
+
insecureCookies.push(det);
|
|
31750
|
+
this.emit(ctx, file, det, "rust");
|
|
31751
|
+
}
|
|
31709
31752
|
}
|
|
31710
31753
|
return { insecureCookies };
|
|
31711
31754
|
}
|
|
@@ -31773,13 +31816,61 @@ class InsecureCookiePass {
|
|
|
31773
31816
|
optionsPresent: false
|
|
31774
31817
|
};
|
|
31775
31818
|
}
|
|
31819
|
+
detectGo(call) {
|
|
31820
|
+
if (call.method_name !== "SetCookie")
|
|
31821
|
+
return null;
|
|
31822
|
+
if ((call.receiver ?? "") !== "http")
|
|
31823
|
+
return null;
|
|
31824
|
+
if (call.arguments.length < 2)
|
|
31825
|
+
return null;
|
|
31826
|
+
const cookieArg = call.arguments.find((a) => a.position === 1);
|
|
31827
|
+
const cookieExpr = (cookieArg?.expression ?? "").trim();
|
|
31828
|
+
if (!cookieExpr.includes("{") || !cookieExpr.includes("}"))
|
|
31829
|
+
return null;
|
|
31830
|
+
const missingSecure = !GO_SECURE_TRUE_RE.test(cookieExpr);
|
|
31831
|
+
const missingHttpOnly = !GO_HTTPONLY_TRUE_RE.test(cookieExpr);
|
|
31832
|
+
if (!missingSecure && !missingHttpOnly)
|
|
31833
|
+
return null;
|
|
31834
|
+
return {
|
|
31835
|
+
line: call.location.line,
|
|
31836
|
+
receiver: "http.SetCookie",
|
|
31837
|
+
missingSecure,
|
|
31838
|
+
missingHttpOnly,
|
|
31839
|
+
optionsPresent: true
|
|
31840
|
+
};
|
|
31841
|
+
}
|
|
31842
|
+
detectRustSetCookieFormat(code) {
|
|
31843
|
+
const out2 = [];
|
|
31844
|
+
const re = new RegExp(RUST_SET_COOKIE_MACRO_RE.source, RUST_SET_COOKIE_MACRO_RE.flags);
|
|
31845
|
+
let m;
|
|
31846
|
+
while ((m = re.exec(code)) !== null) {
|
|
31847
|
+
const macro = m[1] ?? "";
|
|
31848
|
+
const body2 = m[2] ?? "";
|
|
31849
|
+
const missingSecure = !/\bSecure\b/.test(body2);
|
|
31850
|
+
const missingHttpOnly = !/\bHttpOnly\b/.test(body2);
|
|
31851
|
+
if (!missingSecure && !missingHttpOnly)
|
|
31852
|
+
continue;
|
|
31853
|
+
const line = code.slice(0, m.index).split(`
|
|
31854
|
+
`).length;
|
|
31855
|
+
out2.push({
|
|
31856
|
+
line,
|
|
31857
|
+
receiver: macro,
|
|
31858
|
+
missingSecure,
|
|
31859
|
+
missingHttpOnly,
|
|
31860
|
+
optionsPresent: true
|
|
31861
|
+
});
|
|
31862
|
+
}
|
|
31863
|
+
return out2;
|
|
31864
|
+
}
|
|
31776
31865
|
emit(ctx, file, det, flavor) {
|
|
31777
31866
|
const missing = [];
|
|
31778
|
-
if (det.missingSecure)
|
|
31779
|
-
missing.push(flavor === "js" ? "`secure: true`" : flavor === "python" ? "`secure=True`" : "`setSecure(true)`");
|
|
31780
|
-
|
|
31781
|
-
|
|
31782
|
-
|
|
31867
|
+
if (det.missingSecure) {
|
|
31868
|
+
missing.push(flavor === "js" ? "`secure: true`" : flavor === "python" ? "`secure=True`" : flavor === "java" ? "`setSecure(true)`" : flavor === "go" ? "`Secure: true`" : "`Secure` attribute");
|
|
31869
|
+
}
|
|
31870
|
+
if (det.missingHttpOnly) {
|
|
31871
|
+
missing.push(flavor === "js" ? "`httpOnly: true`" : flavor === "python" ? "`httponly=True`" : flavor === "java" ? "`setHttpOnly(true)`" : flavor === "go" ? "`HttpOnly: true`" : "`HttpOnly` attribute");
|
|
31872
|
+
}
|
|
31873
|
+
const fix = flavor === "js" ? 'Pass `{ secure: true, httpOnly: true, sameSite: "lax" }` as the third argument to `res.cookie()`.' : flavor === "python" ? 'Pass `secure=True, httponly=True, samesite="Lax"` to `response.set_cookie(...)`.' : flavor === "java" ? "After constructing the cookie, call `cookie.setSecure(true)` and `cookie.setHttpOnly(true)` before adding it to the response." : flavor === "go" ? "Set `Secure: true` and `HttpOnly: true` on the `http.Cookie` struct literal passed to `http.SetCookie`." : "Append `; Secure; HttpOnly` to the `Set-Cookie` header string.";
|
|
31783
31874
|
ctx.addFinding({
|
|
31784
31875
|
id: `${this.name}-${file}-${det.line}`,
|
|
31785
31876
|
pass: this.name,
|
|
@@ -36682,7 +36773,7 @@ var colors = {
|
|
|
36682
36773
|
};
|
|
36683
36774
|
|
|
36684
36775
|
// src/version.ts
|
|
36685
|
-
var version = "3.
|
|
36776
|
+
var version = "3.113.0";
|
|
36686
36777
|
|
|
36687
36778
|
// src/formatters.ts
|
|
36688
36779
|
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.113.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.113.0"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@types/node": "^25.5.0",
|