circle-ir 3.185.0 → 3.187.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.
@@ -13239,10 +13239,49 @@ var DEFAULT_SINKS = [
13239
13239
  var DEFAULT_SANITIZERS = [
13240
13240
  // SQL Injection - proper parameter binding sanitizes input
13241
13241
  // Note: prepareStatement alone is NOT a sanitizer - it's a sink when used with concatenation
13242
+ //
13243
+ // Full PreparedStatement setter coverage (cognium-dev #213 seventh slice).
13244
+ // Every JDBC PreparedStatement.setXxx binds a parameter placeholder via
13245
+ // the driver wire protocol — the SQL text is fixed, only the value slot
13246
+ // varies. Prior coverage was setString/setInt/setLong only; extending
13247
+ // to the full JDBC 4.x setter surface so real Java apps using date/
13248
+ // decimal/object/binary bindings credit as sanitized.
13242
13249
  { method: "setString", class: "PreparedStatement", removes: ["sql_injection"] },
13250
+ { method: "setNString", class: "PreparedStatement", removes: ["sql_injection"] },
13243
13251
  { method: "setInt", class: "PreparedStatement", removes: ["sql_injection"] },
13244
13252
  { method: "setLong", class: "PreparedStatement", removes: ["sql_injection"] },
13253
+ { method: "setShort", class: "PreparedStatement", removes: ["sql_injection"] },
13254
+ { method: "setByte", class: "PreparedStatement", removes: ["sql_injection"] },
13255
+ { method: "setBoolean", class: "PreparedStatement", removes: ["sql_injection"] },
13256
+ { method: "setDouble", class: "PreparedStatement", removes: ["sql_injection"] },
13257
+ { method: "setFloat", class: "PreparedStatement", removes: ["sql_injection"] },
13258
+ { method: "setBigDecimal", class: "PreparedStatement", removes: ["sql_injection"] },
13259
+ { method: "setBytes", class: "PreparedStatement", removes: ["sql_injection"] },
13260
+ { method: "setDate", class: "PreparedStatement", removes: ["sql_injection"] },
13261
+ { method: "setTime", class: "PreparedStatement", removes: ["sql_injection"] },
13262
+ { method: "setTimestamp", class: "PreparedStatement", removes: ["sql_injection"] },
13263
+ { method: "setObject", class: "PreparedStatement", removes: ["sql_injection"] },
13264
+ { method: "setNull", class: "PreparedStatement", removes: ["sql_injection"] },
13265
+ { method: "setArray", class: "PreparedStatement", removes: ["sql_injection"] },
13266
+ { method: "setBlob", class: "PreparedStatement", removes: ["sql_injection"] },
13267
+ { method: "setClob", class: "PreparedStatement", removes: ["sql_injection"] },
13268
+ { method: "setNClob", class: "PreparedStatement", removes: ["sql_injection"] },
13269
+ { method: "setRef", class: "PreparedStatement", removes: ["sql_injection"] },
13270
+ { method: "setRowId", class: "PreparedStatement", removes: ["sql_injection"] },
13271
+ { method: "setSQLXML", class: "PreparedStatement", removes: ["sql_injection"] },
13272
+ { method: "setURL", class: "PreparedStatement", removes: ["sql_injection"] },
13273
+ { method: "setBinaryStream", class: "PreparedStatement", removes: ["sql_injection"] },
13274
+ { method: "setCharacterStream", class: "PreparedStatement", removes: ["sql_injection"] },
13275
+ { method: "setAsciiStream", class: "PreparedStatement", removes: ["sql_injection"] },
13276
+ { method: "setNCharacterStream", class: "PreparedStatement", removes: ["sql_injection"] },
13277
+ // JPA / Hibernate Query.setParameter — covered above; add TypedQuery
13278
+ // (same interface but distinct type name).
13245
13279
  { method: "setParameter", class: "Query", removes: ["sql_injection"] },
13280
+ { method: "setParameter", class: "TypedQuery", removes: ["sql_injection"] },
13281
+ // Spring JdbcTemplate `NamedParameterJdbcTemplate.update / queryForObject`
13282
+ // parameterized shapes use SqlParameterSource.addValue — the addValue
13283
+ // call binds the parameter safely.
13284
+ { method: "addValue", class: "MapSqlParameterSource", removes: ["sql_injection"] },
13246
13285
  { annotation: "Param", removes: ["sql_injection"] },
13247
13286
  // XSS
13248
13287
  { method: "escapeHtml", removes: ["xss"] },
@@ -13268,6 +13307,48 @@ var DEFAULT_SANITIZERS = [
13268
13307
  // Rust askama auto-escapes
13269
13308
  { method: "encodeForJavaScript", removes: ["xss"] },
13270
13309
  { method: "encodeForCSS", removes: ["xss"] },
13310
+ // Additional Java XSS sanitizers (cognium-dev #213 seventh slice).
13311
+ //
13312
+ // Guava `HtmlEscapers.htmlEscaper().escape(x)` — the `.escape` call
13313
+ // on the returned Escaper is caught by the generic `escape` rule
13314
+ // above, but explicit registration makes intent clear.
13315
+ // Spring `HtmlUtils.htmlEscape(x)` — htmlEscape already covered
13316
+ // above (bare method name).
13317
+ // Apache Commons Text `StringEscapeUtils.escapeJson / escapeXml11 /
13318
+ // escapeEcmaScript / escapeCsv / escapeXsi`.
13319
+ // OWASP HTML Sanitizer `PolicyFactory.sanitize(html)`.
13320
+ { method: "escape", class: "Escaper", removes: ["xss"] },
13321
+ { method: "escape", class: "HtmlEscapers", removes: ["xss"] },
13322
+ { method: "escapeJson", class: "StringEscapeUtils", removes: ["xss"] },
13323
+ { method: "escapeEcmaScript", class: "StringEscapeUtils", removes: ["xss"] },
13324
+ { method: "escapeXml11", class: "StringEscapeUtils", removes: ["xss"] },
13325
+ { method: "escapeXml10", class: "StringEscapeUtils", removes: ["xss"] },
13326
+ { method: "escapeCsv", class: "StringEscapeUtils", removes: ["xss"] },
13327
+ { method: "escapeXsi", class: "StringEscapeUtils", removes: ["xss"] },
13328
+ { method: "escapeJava", class: "StringEscapeUtils", removes: ["xss"] },
13329
+ // Bare escapeJson / escapeEcmaScript / escapeCsv aliases — common
13330
+ // when statically imported.
13331
+ { method: "escapeJson", removes: ["xss"] },
13332
+ { method: "escapeEcmaScript", removes: ["xss"] },
13333
+ { method: "escapeCsv", removes: ["xss"] },
13334
+ // OWASP HTML sanitizer (`com.googlecode.owasp-java-html-sanitizer`).
13335
+ { method: "sanitize", class: "PolicyFactory", removes: ["xss"] },
13336
+ // Java Base64 / Hex / MessageDigest — encoded output is binary-safe
13337
+ // (cognium-dev #213 seventh slice). None of these carry attacker
13338
+ // shell/SQL/HTML metacharacters through the encoding — Base64 emits
13339
+ // [A-Za-z0-9+/=], Hex emits [0-9a-f], MessageDigest.digest returns
13340
+ // opaque bytes usually toHex/toBase64-encoded downstream.
13341
+ { method: "encodeToString", class: "Encoder", removes: ["sql_injection", "command_injection", "xss", "path_traversal", "code_injection"] },
13342
+ { method: "encode", class: "Encoder", removes: ["sql_injection", "command_injection", "xss", "path_traversal", "code_injection"] },
13343
+ { method: "encodeHexString", class: "Hex", removes: ["sql_injection", "command_injection", "xss", "path_traversal", "code_injection"] },
13344
+ { method: "digest", class: "MessageDigest", removes: ["sql_injection", "command_injection", "xss", "path_traversal", "code_injection"] },
13345
+ // Bare aliases for encoder chains — `Base64.getEncoder().encodeToString(x)`
13346
+ // has a call-expression receiver (`Base64.getEncoder()`) that the Java IR
13347
+ // rarely resolves to `Encoder`. Same story for `Hex.encodeHexString(x)`
13348
+ // when Hex is imported. These bare-method names are dominated by their
13349
+ // encoding use in practice; false-positive risk is low.
13350
+ { method: "encodeToString", removes: ["sql_injection", "command_injection", "xss", "path_traversal", "code_injection"] },
13351
+ { method: "encodeHexString", removes: ["sql_injection", "command_injection", "xss", "path_traversal", "code_injection"] },
13271
13352
  // cognium-dev #249 3.162.0: `open_redirect` restored to the URL-encoder
13272
13353
  // sanitizer cluster. Sprint 82 (#189) reclassified `sendRedirect` from
13273
13354
  // `ssrf` → `open_redirect` (config-loader.ts:1296-1299) without updating
@@ -13397,6 +13478,91 @@ var DEFAULT_SANITIZERS = [
13397
13478
  // Command injection - shell escaping
13398
13479
  { method: "quote", class: "shell", removes: ["command_injection"] },
13399
13480
  { method: "escape", class: "shell-escape", removes: ["command_injection"] },
13481
+ // JS/Node — additional XSS/HTML encoders (cognium-dev #213 sixth slice).
13482
+ //
13483
+ // he.encode(x) / he.escape(x) — `he` npm package
13484
+ // sanitizeHtml(x) — `sanitize-html` npm
13485
+ // xss(x) / filterXSS(x) — `xss` npm (Yahoo)
13486
+ // escapeHtml(x) / escapeHTML(x) — common bare helpers
13487
+ // entities.encode(x) / entities.escape(x) — `entities` npm
13488
+ // xssFilters.inHTMLData(x) / inHTMLComment(x) / uriInHTMLData(x)
13489
+ // — `xss-filters` npm (Yahoo)
13490
+ //
13491
+ // `external_taint_escape` is included alongside `xss` — the CWE-668
13492
+ // fallback fires on any call receiving tainted data that the engine
13493
+ // does not otherwise recognize. Since these functions are explicitly
13494
+ // registered as sanitizers (they PURIFY input), they should also
13495
+ // suppress the fallback so a `res.send(sanitizeHtml(x))` flow does
13496
+ // not report an external-taint-escape at the sanitizer call itself.
13497
+ { method: "encode", class: "he", removes: ["xss", "external_taint_escape"] },
13498
+ { method: "escape", class: "he", removes: ["xss", "external_taint_escape"] },
13499
+ { method: "sanitizeHtml", removes: ["xss", "external_taint_escape"] },
13500
+ { method: "xss", removes: ["xss", "external_taint_escape"] },
13501
+ { method: "filterXSS", removes: ["xss", "external_taint_escape"] },
13502
+ { method: "escapeHtml", removes: ["xss", "external_taint_escape"] },
13503
+ { method: "escapeHTML", removes: ["xss", "external_taint_escape"] },
13504
+ { method: "encode", class: "entities", removes: ["xss", "external_taint_escape"] },
13505
+ { method: "escape", class: "entities", removes: ["xss", "external_taint_escape"] },
13506
+ // xss-filters: context-specific helpers, all XSS-safe by construction.
13507
+ { method: "inHTMLData", class: "xssFilters", removes: ["xss", "external_taint_escape"] },
13508
+ { method: "inHTMLComment", class: "xssFilters", removes: ["xss", "external_taint_escape"] },
13509
+ { method: "uriInHTMLData", class: "xssFilters", removes: ["xss", "external_taint_escape"] },
13510
+ // JS/Node — SQL escaping (in addition to the mysql class above).
13511
+ //
13512
+ // SqlString.escape / .escapeId — `sqlstring` npm (raw
13513
+ // escape used by mysql /
13514
+ // node-mysql2 drivers)
13515
+ // pgFormat(sql, ...args) / format(bare) — `pg-format` npm
13516
+ // SQL.raw / SQL(bare) — `sql-template-strings`
13517
+ //
13518
+ // Bare `format` is intentionally NOT registered — it collides with
13519
+ // string.format-style helpers unrelated to SQL. Callers should use the
13520
+ // qualified form.
13521
+ { method: "escape", class: "SqlString", removes: ["sql_injection", "external_taint_escape"] },
13522
+ { method: "escapeId", class: "SqlString", removes: ["sql_injection", "external_taint_escape"] },
13523
+ { method: "format", class: "SqlString", removes: ["sql_injection", "external_taint_escape"] },
13524
+ { method: "format", class: "pgFormat", removes: ["sql_injection", "external_taint_escape"] },
13525
+ { method: "ident", class: "pgFormat", removes: ["sql_injection", "external_taint_escape"] },
13526
+ { method: "literal", class: "pgFormat", removes: ["sql_injection", "external_taint_escape"] },
13527
+ // JS/Node — crypto.randomUUID() and Node's crypto.randomBytes(...)toString()
13528
+ // produce cryptographically-secure typed strings that cannot carry
13529
+ // attacker-injected payload. Registered as type coercion.
13530
+ { method: "randomUUID", class: "crypto", removes: ["sql_injection", "nosql_injection", "command_injection", "path_traversal", "code_injection", "xss"] },
13531
+ // Bare `randomUUID()` alias — `import { randomUUID } from 'crypto'`.
13532
+ { method: "randomUUID", removes: ["sql_injection", "nosql_injection", "command_injection", "path_traversal", "code_injection", "xss"] },
13533
+ // JS/Node — URL construction. `new URL(x, base)` (constructor-call
13534
+ // matched by method_name === 'URL') and `URLSearchParams.toString()`
13535
+ // safely encode components for URL context.
13536
+ { method: "toString", class: "URLSearchParams", removes: ["ssrf", "open_redirect", "xss"] },
13537
+ // Go — additional sanitizers (cognium-dev #213 sixth slice).
13538
+ //
13539
+ // regexp.QuoteMeta(x) — mirror of Python re.escape; strips regex
13540
+ // metacharacters so downstream compile/match
13541
+ // cannot execute attacker-crafted patterns.
13542
+ // bluemonday.Sanitize — dominant Go HTML sanitizer library
13543
+ // (`microcosm-cc/bluemonday`). Called on a
13544
+ // Policy value returned by UGCPolicy() /
13545
+ // StrictPolicy() / etc. Match by method name
13546
+ // alone — Policy is the receiver type.
13547
+ // net.ParseIP(x) — validates the input is a well-formed IP;
13548
+ // returns nil for bad input (developer must
13549
+ // check, but the sanitizer only applies when
13550
+ // the parsed IP flows onward).
13551
+ // sql.Named(name, val) — parameterized query binding.
13552
+ { method: "QuoteMeta", class: "regexp", removes: ["redos", "code_injection", "external_taint_escape"] },
13553
+ { method: "Sanitize", class: "bluemonday", removes: ["xss", "external_taint_escape"] },
13554
+ { method: "Sanitize", class: "Policy", removes: ["xss", "external_taint_escape"] },
13555
+ // Bare `Sanitize` — the receiver is a Policy variable (`p := bluemonday.UGCPolicy(); p.Sanitize(x)`).
13556
+ // `Policy` class-matching only fires when the IR resolves the receiver type;
13557
+ // since Go DFG rarely propagates the type of a locally-assigned variable
13558
+ // from a package factory call, we also register the bare method name.
13559
+ // Narrow FP risk: `Sanitize` bare is uncommon outside bluemonday context.
13560
+ { method: "Sanitize", removes: ["xss", "external_taint_escape"] },
13561
+ { method: "SanitizeBytes", class: "bluemonday", removes: ["xss", "external_taint_escape"] },
13562
+ { method: "SanitizeBytes", class: "Policy", removes: ["xss", "external_taint_escape"] },
13563
+ { method: "SanitizeBytes", removes: ["xss", "external_taint_escape"] },
13564
+ { method: "ParseIP", class: "net", removes: ["ssrf", "command_injection", "path_traversal", "external_taint_escape"] },
13565
+ { method: "Named", class: "sql", removes: ["sql_injection", "external_taint_escape"] },
13400
13566
  // =========================================================================
13401
13567
  // Python Sanitizers
13402
13568
  // =========================================================================
@@ -12634,10 +12634,49 @@ var DEFAULT_SINKS = [
12634
12634
  var DEFAULT_SANITIZERS = [
12635
12635
  // SQL Injection - proper parameter binding sanitizes input
12636
12636
  // Note: prepareStatement alone is NOT a sanitizer - it's a sink when used with concatenation
12637
+ //
12638
+ // Full PreparedStatement setter coverage (cognium-dev #213 seventh slice).
12639
+ // Every JDBC PreparedStatement.setXxx binds a parameter placeholder via
12640
+ // the driver wire protocol — the SQL text is fixed, only the value slot
12641
+ // varies. Prior coverage was setString/setInt/setLong only; extending
12642
+ // to the full JDBC 4.x setter surface so real Java apps using date/
12643
+ // decimal/object/binary bindings credit as sanitized.
12637
12644
  { method: "setString", class: "PreparedStatement", removes: ["sql_injection"] },
12645
+ { method: "setNString", class: "PreparedStatement", removes: ["sql_injection"] },
12638
12646
  { method: "setInt", class: "PreparedStatement", removes: ["sql_injection"] },
12639
12647
  { method: "setLong", class: "PreparedStatement", removes: ["sql_injection"] },
12648
+ { method: "setShort", class: "PreparedStatement", removes: ["sql_injection"] },
12649
+ { method: "setByte", class: "PreparedStatement", removes: ["sql_injection"] },
12650
+ { method: "setBoolean", class: "PreparedStatement", removes: ["sql_injection"] },
12651
+ { method: "setDouble", class: "PreparedStatement", removes: ["sql_injection"] },
12652
+ { method: "setFloat", class: "PreparedStatement", removes: ["sql_injection"] },
12653
+ { method: "setBigDecimal", class: "PreparedStatement", removes: ["sql_injection"] },
12654
+ { method: "setBytes", class: "PreparedStatement", removes: ["sql_injection"] },
12655
+ { method: "setDate", class: "PreparedStatement", removes: ["sql_injection"] },
12656
+ { method: "setTime", class: "PreparedStatement", removes: ["sql_injection"] },
12657
+ { method: "setTimestamp", class: "PreparedStatement", removes: ["sql_injection"] },
12658
+ { method: "setObject", class: "PreparedStatement", removes: ["sql_injection"] },
12659
+ { method: "setNull", class: "PreparedStatement", removes: ["sql_injection"] },
12660
+ { method: "setArray", class: "PreparedStatement", removes: ["sql_injection"] },
12661
+ { method: "setBlob", class: "PreparedStatement", removes: ["sql_injection"] },
12662
+ { method: "setClob", class: "PreparedStatement", removes: ["sql_injection"] },
12663
+ { method: "setNClob", class: "PreparedStatement", removes: ["sql_injection"] },
12664
+ { method: "setRef", class: "PreparedStatement", removes: ["sql_injection"] },
12665
+ { method: "setRowId", class: "PreparedStatement", removes: ["sql_injection"] },
12666
+ { method: "setSQLXML", class: "PreparedStatement", removes: ["sql_injection"] },
12667
+ { method: "setURL", class: "PreparedStatement", removes: ["sql_injection"] },
12668
+ { method: "setBinaryStream", class: "PreparedStatement", removes: ["sql_injection"] },
12669
+ { method: "setCharacterStream", class: "PreparedStatement", removes: ["sql_injection"] },
12670
+ { method: "setAsciiStream", class: "PreparedStatement", removes: ["sql_injection"] },
12671
+ { method: "setNCharacterStream", class: "PreparedStatement", removes: ["sql_injection"] },
12672
+ // JPA / Hibernate Query.setParameter — covered above; add TypedQuery
12673
+ // (same interface but distinct type name).
12640
12674
  { method: "setParameter", class: "Query", removes: ["sql_injection"] },
12675
+ { method: "setParameter", class: "TypedQuery", removes: ["sql_injection"] },
12676
+ // Spring JdbcTemplate `NamedParameterJdbcTemplate.update / queryForObject`
12677
+ // parameterized shapes use SqlParameterSource.addValue — the addValue
12678
+ // call binds the parameter safely.
12679
+ { method: "addValue", class: "MapSqlParameterSource", removes: ["sql_injection"] },
12641
12680
  { annotation: "Param", removes: ["sql_injection"] },
12642
12681
  // XSS
12643
12682
  { method: "escapeHtml", removes: ["xss"] },
@@ -12663,6 +12702,48 @@ var DEFAULT_SANITIZERS = [
12663
12702
  // Rust askama auto-escapes
12664
12703
  { method: "encodeForJavaScript", removes: ["xss"] },
12665
12704
  { method: "encodeForCSS", removes: ["xss"] },
12705
+ // Additional Java XSS sanitizers (cognium-dev #213 seventh slice).
12706
+ //
12707
+ // Guava `HtmlEscapers.htmlEscaper().escape(x)` — the `.escape` call
12708
+ // on the returned Escaper is caught by the generic `escape` rule
12709
+ // above, but explicit registration makes intent clear.
12710
+ // Spring `HtmlUtils.htmlEscape(x)` — htmlEscape already covered
12711
+ // above (bare method name).
12712
+ // Apache Commons Text `StringEscapeUtils.escapeJson / escapeXml11 /
12713
+ // escapeEcmaScript / escapeCsv / escapeXsi`.
12714
+ // OWASP HTML Sanitizer `PolicyFactory.sanitize(html)`.
12715
+ { method: "escape", class: "Escaper", removes: ["xss"] },
12716
+ { method: "escape", class: "HtmlEscapers", removes: ["xss"] },
12717
+ { method: "escapeJson", class: "StringEscapeUtils", removes: ["xss"] },
12718
+ { method: "escapeEcmaScript", class: "StringEscapeUtils", removes: ["xss"] },
12719
+ { method: "escapeXml11", class: "StringEscapeUtils", removes: ["xss"] },
12720
+ { method: "escapeXml10", class: "StringEscapeUtils", removes: ["xss"] },
12721
+ { method: "escapeCsv", class: "StringEscapeUtils", removes: ["xss"] },
12722
+ { method: "escapeXsi", class: "StringEscapeUtils", removes: ["xss"] },
12723
+ { method: "escapeJava", class: "StringEscapeUtils", removes: ["xss"] },
12724
+ // Bare escapeJson / escapeEcmaScript / escapeCsv aliases — common
12725
+ // when statically imported.
12726
+ { method: "escapeJson", removes: ["xss"] },
12727
+ { method: "escapeEcmaScript", removes: ["xss"] },
12728
+ { method: "escapeCsv", removes: ["xss"] },
12729
+ // OWASP HTML sanitizer (`com.googlecode.owasp-java-html-sanitizer`).
12730
+ { method: "sanitize", class: "PolicyFactory", removes: ["xss"] },
12731
+ // Java Base64 / Hex / MessageDigest — encoded output is binary-safe
12732
+ // (cognium-dev #213 seventh slice). None of these carry attacker
12733
+ // shell/SQL/HTML metacharacters through the encoding — Base64 emits
12734
+ // [A-Za-z0-9+/=], Hex emits [0-9a-f], MessageDigest.digest returns
12735
+ // opaque bytes usually toHex/toBase64-encoded downstream.
12736
+ { method: "encodeToString", class: "Encoder", removes: ["sql_injection", "command_injection", "xss", "path_traversal", "code_injection"] },
12737
+ { method: "encode", class: "Encoder", removes: ["sql_injection", "command_injection", "xss", "path_traversal", "code_injection"] },
12738
+ { method: "encodeHexString", class: "Hex", removes: ["sql_injection", "command_injection", "xss", "path_traversal", "code_injection"] },
12739
+ { method: "digest", class: "MessageDigest", removes: ["sql_injection", "command_injection", "xss", "path_traversal", "code_injection"] },
12740
+ // Bare aliases for encoder chains — `Base64.getEncoder().encodeToString(x)`
12741
+ // has a call-expression receiver (`Base64.getEncoder()`) that the Java IR
12742
+ // rarely resolves to `Encoder`. Same story for `Hex.encodeHexString(x)`
12743
+ // when Hex is imported. These bare-method names are dominated by their
12744
+ // encoding use in practice; false-positive risk is low.
12745
+ { method: "encodeToString", removes: ["sql_injection", "command_injection", "xss", "path_traversal", "code_injection"] },
12746
+ { method: "encodeHexString", removes: ["sql_injection", "command_injection", "xss", "path_traversal", "code_injection"] },
12666
12747
  // cognium-dev #249 3.162.0: `open_redirect` restored to the URL-encoder
12667
12748
  // sanitizer cluster. Sprint 82 (#189) reclassified `sendRedirect` from
12668
12749
  // `ssrf` → `open_redirect` (config-loader.ts:1296-1299) without updating
@@ -12792,6 +12873,91 @@ var DEFAULT_SANITIZERS = [
12792
12873
  // Command injection - shell escaping
12793
12874
  { method: "quote", class: "shell", removes: ["command_injection"] },
12794
12875
  { method: "escape", class: "shell-escape", removes: ["command_injection"] },
12876
+ // JS/Node — additional XSS/HTML encoders (cognium-dev #213 sixth slice).
12877
+ //
12878
+ // he.encode(x) / he.escape(x) — `he` npm package
12879
+ // sanitizeHtml(x) — `sanitize-html` npm
12880
+ // xss(x) / filterXSS(x) — `xss` npm (Yahoo)
12881
+ // escapeHtml(x) / escapeHTML(x) — common bare helpers
12882
+ // entities.encode(x) / entities.escape(x) — `entities` npm
12883
+ // xssFilters.inHTMLData(x) / inHTMLComment(x) / uriInHTMLData(x)
12884
+ // — `xss-filters` npm (Yahoo)
12885
+ //
12886
+ // `external_taint_escape` is included alongside `xss` — the CWE-668
12887
+ // fallback fires on any call receiving tainted data that the engine
12888
+ // does not otherwise recognize. Since these functions are explicitly
12889
+ // registered as sanitizers (they PURIFY input), they should also
12890
+ // suppress the fallback so a `res.send(sanitizeHtml(x))` flow does
12891
+ // not report an external-taint-escape at the sanitizer call itself.
12892
+ { method: "encode", class: "he", removes: ["xss", "external_taint_escape"] },
12893
+ { method: "escape", class: "he", removes: ["xss", "external_taint_escape"] },
12894
+ { method: "sanitizeHtml", removes: ["xss", "external_taint_escape"] },
12895
+ { method: "xss", removes: ["xss", "external_taint_escape"] },
12896
+ { method: "filterXSS", removes: ["xss", "external_taint_escape"] },
12897
+ { method: "escapeHtml", removes: ["xss", "external_taint_escape"] },
12898
+ { method: "escapeHTML", removes: ["xss", "external_taint_escape"] },
12899
+ { method: "encode", class: "entities", removes: ["xss", "external_taint_escape"] },
12900
+ { method: "escape", class: "entities", removes: ["xss", "external_taint_escape"] },
12901
+ // xss-filters: context-specific helpers, all XSS-safe by construction.
12902
+ { method: "inHTMLData", class: "xssFilters", removes: ["xss", "external_taint_escape"] },
12903
+ { method: "inHTMLComment", class: "xssFilters", removes: ["xss", "external_taint_escape"] },
12904
+ { method: "uriInHTMLData", class: "xssFilters", removes: ["xss", "external_taint_escape"] },
12905
+ // JS/Node — SQL escaping (in addition to the mysql class above).
12906
+ //
12907
+ // SqlString.escape / .escapeId — `sqlstring` npm (raw
12908
+ // escape used by mysql /
12909
+ // node-mysql2 drivers)
12910
+ // pgFormat(sql, ...args) / format(bare) — `pg-format` npm
12911
+ // SQL.raw / SQL(bare) — `sql-template-strings`
12912
+ //
12913
+ // Bare `format` is intentionally NOT registered — it collides with
12914
+ // string.format-style helpers unrelated to SQL. Callers should use the
12915
+ // qualified form.
12916
+ { method: "escape", class: "SqlString", removes: ["sql_injection", "external_taint_escape"] },
12917
+ { method: "escapeId", class: "SqlString", removes: ["sql_injection", "external_taint_escape"] },
12918
+ { method: "format", class: "SqlString", removes: ["sql_injection", "external_taint_escape"] },
12919
+ { method: "format", class: "pgFormat", removes: ["sql_injection", "external_taint_escape"] },
12920
+ { method: "ident", class: "pgFormat", removes: ["sql_injection", "external_taint_escape"] },
12921
+ { method: "literal", class: "pgFormat", removes: ["sql_injection", "external_taint_escape"] },
12922
+ // JS/Node — crypto.randomUUID() and Node's crypto.randomBytes(...)toString()
12923
+ // produce cryptographically-secure typed strings that cannot carry
12924
+ // attacker-injected payload. Registered as type coercion.
12925
+ { method: "randomUUID", class: "crypto", removes: ["sql_injection", "nosql_injection", "command_injection", "path_traversal", "code_injection", "xss"] },
12926
+ // Bare `randomUUID()` alias — `import { randomUUID } from 'crypto'`.
12927
+ { method: "randomUUID", removes: ["sql_injection", "nosql_injection", "command_injection", "path_traversal", "code_injection", "xss"] },
12928
+ // JS/Node — URL construction. `new URL(x, base)` (constructor-call
12929
+ // matched by method_name === 'URL') and `URLSearchParams.toString()`
12930
+ // safely encode components for URL context.
12931
+ { method: "toString", class: "URLSearchParams", removes: ["ssrf", "open_redirect", "xss"] },
12932
+ // Go — additional sanitizers (cognium-dev #213 sixth slice).
12933
+ //
12934
+ // regexp.QuoteMeta(x) — mirror of Python re.escape; strips regex
12935
+ // metacharacters so downstream compile/match
12936
+ // cannot execute attacker-crafted patterns.
12937
+ // bluemonday.Sanitize — dominant Go HTML sanitizer library
12938
+ // (`microcosm-cc/bluemonday`). Called on a
12939
+ // Policy value returned by UGCPolicy() /
12940
+ // StrictPolicy() / etc. Match by method name
12941
+ // alone — Policy is the receiver type.
12942
+ // net.ParseIP(x) — validates the input is a well-formed IP;
12943
+ // returns nil for bad input (developer must
12944
+ // check, but the sanitizer only applies when
12945
+ // the parsed IP flows onward).
12946
+ // sql.Named(name, val) — parameterized query binding.
12947
+ { method: "QuoteMeta", class: "regexp", removes: ["redos", "code_injection", "external_taint_escape"] },
12948
+ { method: "Sanitize", class: "bluemonday", removes: ["xss", "external_taint_escape"] },
12949
+ { method: "Sanitize", class: "Policy", removes: ["xss", "external_taint_escape"] },
12950
+ // Bare `Sanitize` — the receiver is a Policy variable (`p := bluemonday.UGCPolicy(); p.Sanitize(x)`).
12951
+ // `Policy` class-matching only fires when the IR resolves the receiver type;
12952
+ // since Go DFG rarely propagates the type of a locally-assigned variable
12953
+ // from a package factory call, we also register the bare method name.
12954
+ // Narrow FP risk: `Sanitize` bare is uncommon outside bluemonday context.
12955
+ { method: "Sanitize", removes: ["xss", "external_taint_escape"] },
12956
+ { method: "SanitizeBytes", class: "bluemonday", removes: ["xss", "external_taint_escape"] },
12957
+ { method: "SanitizeBytes", class: "Policy", removes: ["xss", "external_taint_escape"] },
12958
+ { method: "SanitizeBytes", removes: ["xss", "external_taint_escape"] },
12959
+ { method: "ParseIP", class: "net", removes: ["ssrf", "command_injection", "path_traversal", "external_taint_escape"] },
12960
+ { method: "Named", class: "sql", removes: ["sql_injection", "external_taint_escape"] },
12795
12961
  // =========================================================================
12796
12962
  // Python Sanitizers
12797
12963
  // =========================================================================
@@ -12568,10 +12568,49 @@ var DEFAULT_SINKS = [
12568
12568
  var DEFAULT_SANITIZERS = [
12569
12569
  // SQL Injection - proper parameter binding sanitizes input
12570
12570
  // Note: prepareStatement alone is NOT a sanitizer - it's a sink when used with concatenation
12571
+ //
12572
+ // Full PreparedStatement setter coverage (cognium-dev #213 seventh slice).
12573
+ // Every JDBC PreparedStatement.setXxx binds a parameter placeholder via
12574
+ // the driver wire protocol — the SQL text is fixed, only the value slot
12575
+ // varies. Prior coverage was setString/setInt/setLong only; extending
12576
+ // to the full JDBC 4.x setter surface so real Java apps using date/
12577
+ // decimal/object/binary bindings credit as sanitized.
12571
12578
  { method: "setString", class: "PreparedStatement", removes: ["sql_injection"] },
12579
+ { method: "setNString", class: "PreparedStatement", removes: ["sql_injection"] },
12572
12580
  { method: "setInt", class: "PreparedStatement", removes: ["sql_injection"] },
12573
12581
  { method: "setLong", class: "PreparedStatement", removes: ["sql_injection"] },
12582
+ { method: "setShort", class: "PreparedStatement", removes: ["sql_injection"] },
12583
+ { method: "setByte", class: "PreparedStatement", removes: ["sql_injection"] },
12584
+ { method: "setBoolean", class: "PreparedStatement", removes: ["sql_injection"] },
12585
+ { method: "setDouble", class: "PreparedStatement", removes: ["sql_injection"] },
12586
+ { method: "setFloat", class: "PreparedStatement", removes: ["sql_injection"] },
12587
+ { method: "setBigDecimal", class: "PreparedStatement", removes: ["sql_injection"] },
12588
+ { method: "setBytes", class: "PreparedStatement", removes: ["sql_injection"] },
12589
+ { method: "setDate", class: "PreparedStatement", removes: ["sql_injection"] },
12590
+ { method: "setTime", class: "PreparedStatement", removes: ["sql_injection"] },
12591
+ { method: "setTimestamp", class: "PreparedStatement", removes: ["sql_injection"] },
12592
+ { method: "setObject", class: "PreparedStatement", removes: ["sql_injection"] },
12593
+ { method: "setNull", class: "PreparedStatement", removes: ["sql_injection"] },
12594
+ { method: "setArray", class: "PreparedStatement", removes: ["sql_injection"] },
12595
+ { method: "setBlob", class: "PreparedStatement", removes: ["sql_injection"] },
12596
+ { method: "setClob", class: "PreparedStatement", removes: ["sql_injection"] },
12597
+ { method: "setNClob", class: "PreparedStatement", removes: ["sql_injection"] },
12598
+ { method: "setRef", class: "PreparedStatement", removes: ["sql_injection"] },
12599
+ { method: "setRowId", class: "PreparedStatement", removes: ["sql_injection"] },
12600
+ { method: "setSQLXML", class: "PreparedStatement", removes: ["sql_injection"] },
12601
+ { method: "setURL", class: "PreparedStatement", removes: ["sql_injection"] },
12602
+ { method: "setBinaryStream", class: "PreparedStatement", removes: ["sql_injection"] },
12603
+ { method: "setCharacterStream", class: "PreparedStatement", removes: ["sql_injection"] },
12604
+ { method: "setAsciiStream", class: "PreparedStatement", removes: ["sql_injection"] },
12605
+ { method: "setNCharacterStream", class: "PreparedStatement", removes: ["sql_injection"] },
12606
+ // JPA / Hibernate Query.setParameter — covered above; add TypedQuery
12607
+ // (same interface but distinct type name).
12574
12608
  { method: "setParameter", class: "Query", removes: ["sql_injection"] },
12609
+ { method: "setParameter", class: "TypedQuery", removes: ["sql_injection"] },
12610
+ // Spring JdbcTemplate `NamedParameterJdbcTemplate.update / queryForObject`
12611
+ // parameterized shapes use SqlParameterSource.addValue — the addValue
12612
+ // call binds the parameter safely.
12613
+ { method: "addValue", class: "MapSqlParameterSource", removes: ["sql_injection"] },
12575
12614
  { annotation: "Param", removes: ["sql_injection"] },
12576
12615
  // XSS
12577
12616
  { method: "escapeHtml", removes: ["xss"] },
@@ -12597,6 +12636,48 @@ var DEFAULT_SANITIZERS = [
12597
12636
  // Rust askama auto-escapes
12598
12637
  { method: "encodeForJavaScript", removes: ["xss"] },
12599
12638
  { method: "encodeForCSS", removes: ["xss"] },
12639
+ // Additional Java XSS sanitizers (cognium-dev #213 seventh slice).
12640
+ //
12641
+ // Guava `HtmlEscapers.htmlEscaper().escape(x)` — the `.escape` call
12642
+ // on the returned Escaper is caught by the generic `escape` rule
12643
+ // above, but explicit registration makes intent clear.
12644
+ // Spring `HtmlUtils.htmlEscape(x)` — htmlEscape already covered
12645
+ // above (bare method name).
12646
+ // Apache Commons Text `StringEscapeUtils.escapeJson / escapeXml11 /
12647
+ // escapeEcmaScript / escapeCsv / escapeXsi`.
12648
+ // OWASP HTML Sanitizer `PolicyFactory.sanitize(html)`.
12649
+ { method: "escape", class: "Escaper", removes: ["xss"] },
12650
+ { method: "escape", class: "HtmlEscapers", removes: ["xss"] },
12651
+ { method: "escapeJson", class: "StringEscapeUtils", removes: ["xss"] },
12652
+ { method: "escapeEcmaScript", class: "StringEscapeUtils", removes: ["xss"] },
12653
+ { method: "escapeXml11", class: "StringEscapeUtils", removes: ["xss"] },
12654
+ { method: "escapeXml10", class: "StringEscapeUtils", removes: ["xss"] },
12655
+ { method: "escapeCsv", class: "StringEscapeUtils", removes: ["xss"] },
12656
+ { method: "escapeXsi", class: "StringEscapeUtils", removes: ["xss"] },
12657
+ { method: "escapeJava", class: "StringEscapeUtils", removes: ["xss"] },
12658
+ // Bare escapeJson / escapeEcmaScript / escapeCsv aliases — common
12659
+ // when statically imported.
12660
+ { method: "escapeJson", removes: ["xss"] },
12661
+ { method: "escapeEcmaScript", removes: ["xss"] },
12662
+ { method: "escapeCsv", removes: ["xss"] },
12663
+ // OWASP HTML sanitizer (`com.googlecode.owasp-java-html-sanitizer`).
12664
+ { method: "sanitize", class: "PolicyFactory", removes: ["xss"] },
12665
+ // Java Base64 / Hex / MessageDigest — encoded output is binary-safe
12666
+ // (cognium-dev #213 seventh slice). None of these carry attacker
12667
+ // shell/SQL/HTML metacharacters through the encoding — Base64 emits
12668
+ // [A-Za-z0-9+/=], Hex emits [0-9a-f], MessageDigest.digest returns
12669
+ // opaque bytes usually toHex/toBase64-encoded downstream.
12670
+ { method: "encodeToString", class: "Encoder", removes: ["sql_injection", "command_injection", "xss", "path_traversal", "code_injection"] },
12671
+ { method: "encode", class: "Encoder", removes: ["sql_injection", "command_injection", "xss", "path_traversal", "code_injection"] },
12672
+ { method: "encodeHexString", class: "Hex", removes: ["sql_injection", "command_injection", "xss", "path_traversal", "code_injection"] },
12673
+ { method: "digest", class: "MessageDigest", removes: ["sql_injection", "command_injection", "xss", "path_traversal", "code_injection"] },
12674
+ // Bare aliases for encoder chains — `Base64.getEncoder().encodeToString(x)`
12675
+ // has a call-expression receiver (`Base64.getEncoder()`) that the Java IR
12676
+ // rarely resolves to `Encoder`. Same story for `Hex.encodeHexString(x)`
12677
+ // when Hex is imported. These bare-method names are dominated by their
12678
+ // encoding use in practice; false-positive risk is low.
12679
+ { method: "encodeToString", removes: ["sql_injection", "command_injection", "xss", "path_traversal", "code_injection"] },
12680
+ { method: "encodeHexString", removes: ["sql_injection", "command_injection", "xss", "path_traversal", "code_injection"] },
12600
12681
  // cognium-dev #249 3.162.0: `open_redirect` restored to the URL-encoder
12601
12682
  // sanitizer cluster. Sprint 82 (#189) reclassified `sendRedirect` from
12602
12683
  // `ssrf` → `open_redirect` (config-loader.ts:1296-1299) without updating
@@ -12726,6 +12807,91 @@ var DEFAULT_SANITIZERS = [
12726
12807
  // Command injection - shell escaping
12727
12808
  { method: "quote", class: "shell", removes: ["command_injection"] },
12728
12809
  { method: "escape", class: "shell-escape", removes: ["command_injection"] },
12810
+ // JS/Node — additional XSS/HTML encoders (cognium-dev #213 sixth slice).
12811
+ //
12812
+ // he.encode(x) / he.escape(x) — `he` npm package
12813
+ // sanitizeHtml(x) — `sanitize-html` npm
12814
+ // xss(x) / filterXSS(x) — `xss` npm (Yahoo)
12815
+ // escapeHtml(x) / escapeHTML(x) — common bare helpers
12816
+ // entities.encode(x) / entities.escape(x) — `entities` npm
12817
+ // xssFilters.inHTMLData(x) / inHTMLComment(x) / uriInHTMLData(x)
12818
+ // — `xss-filters` npm (Yahoo)
12819
+ //
12820
+ // `external_taint_escape` is included alongside `xss` — the CWE-668
12821
+ // fallback fires on any call receiving tainted data that the engine
12822
+ // does not otherwise recognize. Since these functions are explicitly
12823
+ // registered as sanitizers (they PURIFY input), they should also
12824
+ // suppress the fallback so a `res.send(sanitizeHtml(x))` flow does
12825
+ // not report an external-taint-escape at the sanitizer call itself.
12826
+ { method: "encode", class: "he", removes: ["xss", "external_taint_escape"] },
12827
+ { method: "escape", class: "he", removes: ["xss", "external_taint_escape"] },
12828
+ { method: "sanitizeHtml", removes: ["xss", "external_taint_escape"] },
12829
+ { method: "xss", removes: ["xss", "external_taint_escape"] },
12830
+ { method: "filterXSS", removes: ["xss", "external_taint_escape"] },
12831
+ { method: "escapeHtml", removes: ["xss", "external_taint_escape"] },
12832
+ { method: "escapeHTML", removes: ["xss", "external_taint_escape"] },
12833
+ { method: "encode", class: "entities", removes: ["xss", "external_taint_escape"] },
12834
+ { method: "escape", class: "entities", removes: ["xss", "external_taint_escape"] },
12835
+ // xss-filters: context-specific helpers, all XSS-safe by construction.
12836
+ { method: "inHTMLData", class: "xssFilters", removes: ["xss", "external_taint_escape"] },
12837
+ { method: "inHTMLComment", class: "xssFilters", removes: ["xss", "external_taint_escape"] },
12838
+ { method: "uriInHTMLData", class: "xssFilters", removes: ["xss", "external_taint_escape"] },
12839
+ // JS/Node — SQL escaping (in addition to the mysql class above).
12840
+ //
12841
+ // SqlString.escape / .escapeId — `sqlstring` npm (raw
12842
+ // escape used by mysql /
12843
+ // node-mysql2 drivers)
12844
+ // pgFormat(sql, ...args) / format(bare) — `pg-format` npm
12845
+ // SQL.raw / SQL(bare) — `sql-template-strings`
12846
+ //
12847
+ // Bare `format` is intentionally NOT registered — it collides with
12848
+ // string.format-style helpers unrelated to SQL. Callers should use the
12849
+ // qualified form.
12850
+ { method: "escape", class: "SqlString", removes: ["sql_injection", "external_taint_escape"] },
12851
+ { method: "escapeId", class: "SqlString", removes: ["sql_injection", "external_taint_escape"] },
12852
+ { method: "format", class: "SqlString", removes: ["sql_injection", "external_taint_escape"] },
12853
+ { method: "format", class: "pgFormat", removes: ["sql_injection", "external_taint_escape"] },
12854
+ { method: "ident", class: "pgFormat", removes: ["sql_injection", "external_taint_escape"] },
12855
+ { method: "literal", class: "pgFormat", removes: ["sql_injection", "external_taint_escape"] },
12856
+ // JS/Node — crypto.randomUUID() and Node's crypto.randomBytes(...)toString()
12857
+ // produce cryptographically-secure typed strings that cannot carry
12858
+ // attacker-injected payload. Registered as type coercion.
12859
+ { method: "randomUUID", class: "crypto", removes: ["sql_injection", "nosql_injection", "command_injection", "path_traversal", "code_injection", "xss"] },
12860
+ // Bare `randomUUID()` alias — `import { randomUUID } from 'crypto'`.
12861
+ { method: "randomUUID", removes: ["sql_injection", "nosql_injection", "command_injection", "path_traversal", "code_injection", "xss"] },
12862
+ // JS/Node — URL construction. `new URL(x, base)` (constructor-call
12863
+ // matched by method_name === 'URL') and `URLSearchParams.toString()`
12864
+ // safely encode components for URL context.
12865
+ { method: "toString", class: "URLSearchParams", removes: ["ssrf", "open_redirect", "xss"] },
12866
+ // Go — additional sanitizers (cognium-dev #213 sixth slice).
12867
+ //
12868
+ // regexp.QuoteMeta(x) — mirror of Python re.escape; strips regex
12869
+ // metacharacters so downstream compile/match
12870
+ // cannot execute attacker-crafted patterns.
12871
+ // bluemonday.Sanitize — dominant Go HTML sanitizer library
12872
+ // (`microcosm-cc/bluemonday`). Called on a
12873
+ // Policy value returned by UGCPolicy() /
12874
+ // StrictPolicy() / etc. Match by method name
12875
+ // alone — Policy is the receiver type.
12876
+ // net.ParseIP(x) — validates the input is a well-formed IP;
12877
+ // returns nil for bad input (developer must
12878
+ // check, but the sanitizer only applies when
12879
+ // the parsed IP flows onward).
12880
+ // sql.Named(name, val) — parameterized query binding.
12881
+ { method: "QuoteMeta", class: "regexp", removes: ["redos", "code_injection", "external_taint_escape"] },
12882
+ { method: "Sanitize", class: "bluemonday", removes: ["xss", "external_taint_escape"] },
12883
+ { method: "Sanitize", class: "Policy", removes: ["xss", "external_taint_escape"] },
12884
+ // Bare `Sanitize` — the receiver is a Policy variable (`p := bluemonday.UGCPolicy(); p.Sanitize(x)`).
12885
+ // `Policy` class-matching only fires when the IR resolves the receiver type;
12886
+ // since Go DFG rarely propagates the type of a locally-assigned variable
12887
+ // from a package factory call, we also register the bare method name.
12888
+ // Narrow FP risk: `Sanitize` bare is uncommon outside bluemonday context.
12889
+ { method: "Sanitize", removes: ["xss", "external_taint_escape"] },
12890
+ { method: "SanitizeBytes", class: "bluemonday", removes: ["xss", "external_taint_escape"] },
12891
+ { method: "SanitizeBytes", class: "Policy", removes: ["xss", "external_taint_escape"] },
12892
+ { method: "SanitizeBytes", removes: ["xss", "external_taint_escape"] },
12893
+ { method: "ParseIP", class: "net", removes: ["ssrf", "command_injection", "path_traversal", "external_taint_escape"] },
12894
+ { method: "Named", class: "sql", removes: ["sql_injection", "external_taint_escape"] },
12729
12895
  // =========================================================================
12730
12896
  // Python Sanitizers
12731
12897
  // =========================================================================
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "circle-ir",
3
- "version": "3.185.0",
3
+ "version": "3.187.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",