circle-ir 3.180.0 → 3.181.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.
@@ -11282,6 +11282,35 @@ var DEFAULT_SOURCES = [
11282
11282
  { method: "get", class: "Jedis", type: "db_input", severity: "medium", return_tainted: true, languages: ["java"] },
11283
11283
  { method: "hget", class: "Jedis", type: "db_input", severity: "medium", return_tainted: true, languages: ["java"] },
11284
11284
  { method: "mget", class: "Jedis", type: "db_input", severity: "medium", return_tainted: true, languages: ["java"] },
11285
+ // --- Serverless transport channels (cognium-dev #213 first slice) ---
11286
+ //
11287
+ // AWS Lambda / API Gateway invocation-event properties. The Lambda
11288
+ // handler signature `(event, context) => …` (JS/TS) or
11289
+ // `def handler(event, context)` (Python) receives an `event` object
11290
+ // whose properties carry the untrusted HTTP-request-shaped payload:
11291
+ //
11292
+ // event.body — request body (string)
11293
+ // event.queryStringParameters — `?a=b` params
11294
+ // event.multiValueQueryStringParameters — `?a=1&a=2` params
11295
+ // event.pathParameters — path template captures
11296
+ // event.headers — request headers
11297
+ // event.multiValueHeaders — repeated headers
11298
+ // event.requestContext — API Gateway request context
11299
+ //
11300
+ // Vercel Serverless Functions and Cloudflare Workers both use `req`
11301
+ // / `request` receivers that are already covered by the Express-
11302
+ // style patterns above (line ~398). This block specifically covers
11303
+ // the `event`-shaped API Gateway convention that those don't reach.
11304
+ { property: "body", object: "event", type: "http_body", severity: "high", property_tainted: true, languages: ["javascript", "typescript"] },
11305
+ { property: "queryStringParameters", object: "event", type: "http_query", severity: "high", property_tainted: true, languages: ["javascript", "typescript"] },
11306
+ { property: "multiValueQueryStringParameters", object: "event", type: "http_query", severity: "high", property_tainted: true, languages: ["javascript", "typescript"] },
11307
+ { property: "pathParameters", object: "event", type: "http_path", severity: "high", property_tainted: true, languages: ["javascript", "typescript"] },
11308
+ { property: "headers", object: "event", type: "http_header", severity: "high", property_tainted: true, languages: ["javascript", "typescript"] },
11309
+ { property: "multiValueHeaders", object: "event", type: "http_header", severity: "high", property_tainted: true, languages: ["javascript", "typescript"] },
11310
+ { property: "body", object: "event", type: "http_body", severity: "high", property_tainted: true, languages: ["python"] },
11311
+ { property: "queryStringParameters", object: "event", type: "http_query", severity: "high", property_tainted: true, languages: ["python"] },
11312
+ { property: "pathParameters", object: "event", type: "http_path", severity: "high", property_tainted: true, languages: ["python"] },
11313
+ { property: "headers", object: "event", type: "http_header", severity: "high", property_tainted: true, languages: ["python"] },
11285
11314
  // --- JWT claims (unverified decode — PyJWT / jose / jsonwebtoken / auth0 java-jwt / golang-jwt) ---
11286
11315
  // A JWT's payload is *always* attacker-authored. Even after verification
11287
11316
  // the *contents* of the claims (username, role, custom fields) are not
@@ -25504,7 +25533,19 @@ var JS_TAINTED_PATTERNS = [
25504
25533
  { pattern: /\bdocument\.title\b/, type: "dom_input" },
25505
25534
  { pattern: /\bhistory\.state\b/, type: "dom_input" },
25506
25535
  { pattern: /\blocalStorage\.getItem\b/, type: "dom_input" },
25507
- { pattern: /\bsessionStorage\.getItem\b/, type: "dom_input" }
25536
+ { pattern: /\bsessionStorage\.getItem\b/, type: "dom_input" },
25537
+ // AWS Lambda / API Gateway event-shape sources (cognium-dev #213
25538
+ // transport-channel first slice). The `event` parameter of a
25539
+ // Lambda handler carries the untrusted HTTP payload; forward-taint
25540
+ // tracking through `const q = event.body; sink(q)` needs the
25541
+ // regex here in addition to the property patterns in
25542
+ // config-loader.ts:DEFAULT_SOURCES.
25543
+ { pattern: /\bevent\.body\b/, type: "http_body" },
25544
+ { pattern: /\bevent\.queryStringParameters\b/, type: "http_param" },
25545
+ { pattern: /\bevent\.multiValueQueryStringParameters\b/, type: "http_param" },
25546
+ { pattern: /\bevent\.pathParameters\b/, type: "http_path" },
25547
+ { pattern: /\bevent\.headers\b/, type: "http_header" },
25548
+ { pattern: /\bevent\.multiValueHeaders\b/, type: "http_header" }
25508
25549
  ];
25509
25550
  var PYTHON_TAINTED_PATTERNS2 = [
25510
25551
  { pattern: /\brequest\.args\b/, type: "http_param" },
@@ -30022,7 +30063,7 @@ function findPythonTaintedFormatStringFindings(code, file) {
30022
30063
  }
30023
30064
  if (taintedVars.size === 0) return findings;
30024
30065
  const percentRe = /\b(\w+)\s*%\s*[\(\[\{"'\w]/;
30025
- const dotFormatRe = /\b(\w+)\s*\.\s*format\s*\(/;
30066
+ const dotFormatRe = /\b(\w+)\s*\.\s*(?:format|format_map)\s*\(/;
30026
30067
  const seen = /* @__PURE__ */ new Set();
30027
30068
  for (let i2 = 0; i2 < lines.length; i2++) {
30028
30069
  const line = lines[i2];
@@ -38896,28 +38937,36 @@ var PythonReceiverTaintFormatPass = class {
38896
38937
  if (ctx.language !== "python") {
38897
38938
  return { findingsEmitted: 0 };
38898
38939
  }
38899
- const { calls, meta } = ctx.graph.ir;
38900
- const constProp = ctx.getResult(
38901
- "constant-propagation"
38902
- );
38903
- const tainted = constProp.tainted;
38940
+ const { calls, meta, taint } = ctx.graph.ir;
38941
+ const taintedVarNames = /* @__PURE__ */ new Set();
38942
+ for (const s of taint.sources) {
38943
+ if (typeof s.variable === "string" && s.variable.length > 0) {
38944
+ taintedVarNames.add(s.variable);
38945
+ }
38946
+ }
38947
+ if (taintedVarNames.size === 0) {
38948
+ return { findingsEmitted: 0 };
38949
+ }
38950
+ const seen = /* @__PURE__ */ new Set();
38904
38951
  let count = 0;
38905
38952
  for (const call of calls) {
38906
- if (call.method_name !== "format") continue;
38953
+ if (call.method_name !== "format" && call.method_name !== "format_map") continue;
38907
38954
  const receiver = call.receiver;
38908
38955
  if (!receiver) continue;
38909
38956
  if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(receiver)) continue;
38910
- const scopedName = call.in_method ? `${call.in_method}:${receiver}` : receiver;
38911
- if (!tainted.has(receiver) && !tainted.has(scopedName)) continue;
38957
+ if (!taintedVarNames.has(receiver)) continue;
38958
+ const seenKey = `${call.location.line}:${receiver}`;
38959
+ if (seen.has(seenKey)) continue;
38960
+ seen.add(seenKey);
38912
38961
  ctx.addFinding({
38913
- id: `format_string-${meta.file}-${call.location.line}-${receiver}`,
38962
+ id: `format_string-${meta.file}-${call.location.line}-${receiver}-${call.method_name}`,
38914
38963
  pass: this.name,
38915
38964
  category: "security",
38916
38965
  rule_id: "format_string",
38917
38966
  cwe: "CWE-134",
38918
38967
  severity: "medium",
38919
38968
  level: "warning",
38920
- message: `Format-string vulnerability: the format template \`${receiver}\` is tainted (traces back to a taint source). Attacker can leak object attributes via \`{obj.__class__.__mro__[\u2026]}\` chains or crash the process via unbounded specifiers. Use a literal format string and pass user input as an argument instead.`,
38969
+ message: `Format-string vulnerability: the format template \`${receiver}\` is tainted (traces back to a taint source) and used as the receiver of \`${call.method_name}(...)\`. Attacker can leak object attributes via \`{obj.__class__.__mro__[\u2026]}\` chains or crash the process via unbounded specifiers. Use a literal format string and pass user input as an argument instead.`,
38921
38970
  file: meta.file,
38922
38971
  line: call.location.line
38923
38972
  });
@@ -10677,6 +10677,35 @@ var DEFAULT_SOURCES = [
10677
10677
  { method: "get", class: "Jedis", type: "db_input", severity: "medium", return_tainted: true, languages: ["java"] },
10678
10678
  { method: "hget", class: "Jedis", type: "db_input", severity: "medium", return_tainted: true, languages: ["java"] },
10679
10679
  { method: "mget", class: "Jedis", type: "db_input", severity: "medium", return_tainted: true, languages: ["java"] },
10680
+ // --- Serverless transport channels (cognium-dev #213 first slice) ---
10681
+ //
10682
+ // AWS Lambda / API Gateway invocation-event properties. The Lambda
10683
+ // handler signature `(event, context) => …` (JS/TS) or
10684
+ // `def handler(event, context)` (Python) receives an `event` object
10685
+ // whose properties carry the untrusted HTTP-request-shaped payload:
10686
+ //
10687
+ // event.body — request body (string)
10688
+ // event.queryStringParameters — `?a=b` params
10689
+ // event.multiValueQueryStringParameters — `?a=1&a=2` params
10690
+ // event.pathParameters — path template captures
10691
+ // event.headers — request headers
10692
+ // event.multiValueHeaders — repeated headers
10693
+ // event.requestContext — API Gateway request context
10694
+ //
10695
+ // Vercel Serverless Functions and Cloudflare Workers both use `req`
10696
+ // / `request` receivers that are already covered by the Express-
10697
+ // style patterns above (line ~398). This block specifically covers
10698
+ // the `event`-shaped API Gateway convention that those don't reach.
10699
+ { property: "body", object: "event", type: "http_body", severity: "high", property_tainted: true, languages: ["javascript", "typescript"] },
10700
+ { property: "queryStringParameters", object: "event", type: "http_query", severity: "high", property_tainted: true, languages: ["javascript", "typescript"] },
10701
+ { property: "multiValueQueryStringParameters", object: "event", type: "http_query", severity: "high", property_tainted: true, languages: ["javascript", "typescript"] },
10702
+ { property: "pathParameters", object: "event", type: "http_path", severity: "high", property_tainted: true, languages: ["javascript", "typescript"] },
10703
+ { property: "headers", object: "event", type: "http_header", severity: "high", property_tainted: true, languages: ["javascript", "typescript"] },
10704
+ { property: "multiValueHeaders", object: "event", type: "http_header", severity: "high", property_tainted: true, languages: ["javascript", "typescript"] },
10705
+ { property: "body", object: "event", type: "http_body", severity: "high", property_tainted: true, languages: ["python"] },
10706
+ { property: "queryStringParameters", object: "event", type: "http_query", severity: "high", property_tainted: true, languages: ["python"] },
10707
+ { property: "pathParameters", object: "event", type: "http_path", severity: "high", property_tainted: true, languages: ["python"] },
10708
+ { property: "headers", object: "event", type: "http_header", severity: "high", property_tainted: true, languages: ["python"] },
10680
10709
  // --- JWT claims (unverified decode — PyJWT / jose / jsonwebtoken / auth0 java-jwt / golang-jwt) ---
10681
10710
  // A JWT's payload is *always* attacker-authored. Even after verification
10682
10711
  // the *contents* of the claims (username, role, custom fields) are not
@@ -10611,6 +10611,35 @@ var DEFAULT_SOURCES = [
10611
10611
  { method: "get", class: "Jedis", type: "db_input", severity: "medium", return_tainted: true, languages: ["java"] },
10612
10612
  { method: "hget", class: "Jedis", type: "db_input", severity: "medium", return_tainted: true, languages: ["java"] },
10613
10613
  { method: "mget", class: "Jedis", type: "db_input", severity: "medium", return_tainted: true, languages: ["java"] },
10614
+ // --- Serverless transport channels (cognium-dev #213 first slice) ---
10615
+ //
10616
+ // AWS Lambda / API Gateway invocation-event properties. The Lambda
10617
+ // handler signature `(event, context) => …` (JS/TS) or
10618
+ // `def handler(event, context)` (Python) receives an `event` object
10619
+ // whose properties carry the untrusted HTTP-request-shaped payload:
10620
+ //
10621
+ // event.body — request body (string)
10622
+ // event.queryStringParameters — `?a=b` params
10623
+ // event.multiValueQueryStringParameters — `?a=1&a=2` params
10624
+ // event.pathParameters — path template captures
10625
+ // event.headers — request headers
10626
+ // event.multiValueHeaders — repeated headers
10627
+ // event.requestContext — API Gateway request context
10628
+ //
10629
+ // Vercel Serverless Functions and Cloudflare Workers both use `req`
10630
+ // / `request` receivers that are already covered by the Express-
10631
+ // style patterns above (line ~398). This block specifically covers
10632
+ // the `event`-shaped API Gateway convention that those don't reach.
10633
+ { property: "body", object: "event", type: "http_body", severity: "high", property_tainted: true, languages: ["javascript", "typescript"] },
10634
+ { property: "queryStringParameters", object: "event", type: "http_query", severity: "high", property_tainted: true, languages: ["javascript", "typescript"] },
10635
+ { property: "multiValueQueryStringParameters", object: "event", type: "http_query", severity: "high", property_tainted: true, languages: ["javascript", "typescript"] },
10636
+ { property: "pathParameters", object: "event", type: "http_path", severity: "high", property_tainted: true, languages: ["javascript", "typescript"] },
10637
+ { property: "headers", object: "event", type: "http_header", severity: "high", property_tainted: true, languages: ["javascript", "typescript"] },
10638
+ { property: "multiValueHeaders", object: "event", type: "http_header", severity: "high", property_tainted: true, languages: ["javascript", "typescript"] },
10639
+ { property: "body", object: "event", type: "http_body", severity: "high", property_tainted: true, languages: ["python"] },
10640
+ { property: "queryStringParameters", object: "event", type: "http_query", severity: "high", property_tainted: true, languages: ["python"] },
10641
+ { property: "pathParameters", object: "event", type: "http_path", severity: "high", property_tainted: true, languages: ["python"] },
10642
+ { property: "headers", object: "event", type: "http_header", severity: "high", property_tainted: true, languages: ["python"] },
10614
10643
  // --- JWT claims (unverified decode — PyJWT / jose / jsonwebtoken / auth0 java-jwt / golang-jwt) ---
10615
10644
  // A JWT's payload is *always* attacker-authored. Even after verification
10616
10645
  // the *contents* of the claims (username, role, custom fields) are not
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "circle-ir",
3
- "version": "3.180.0",
3
+ "version": "3.181.0",
4
4
  "description": "High-performance Static Application Security Testing (SAST) library for detecting security vulnerabilities through taint analysis",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",