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.
@@ -1 +1 @@
1
- {"version":3,"file":"config-loader.d.ts","sourceRoot":"","sources":["../../src/analysis/config-loader.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,YAAY,EACZ,UAAU,EACV,mBAAmB,EACnB,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,UAAU,EACX,MAAM,oBAAoB,CAAC;AAE5B;;;GAGG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,GAAG,CAAC,CAEjD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,aAAa,EAAE,CAiB1E;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG;IACtD,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,UAAU,EAAE,gBAAgB,EAAE,CAAC;CAChC,CAcA;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,mBAAmB,EAAE,GAC7B,kBAAkB,EAAE,CAQtB;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,cAAc,EAAE,MAAM,EAAE,EACxB,YAAY,EAAE,MAAM,EAAE,EACtB,qBAAqB,GAAE,MAAM,EAAO,GACnC,WAAW,CAYb;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,aAAa,EAymB1C,CAAC;AA+KF,eAAO,MAAM,aAAa,EAAE,WAAW,EA2wDtC,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,gBAAgB,EAkXhD,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,sBAAsB,EAAE,kBAAkB,EAiDtD,CAAC;AAEF;;GAEG;AACH,wBAAgB,gBAAgB,I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;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,EAAE,UAAU,EA8F5C,CAAC"}
@@ -2478,10 +2478,49 @@ export const DEFAULT_SINKS = [
2478
2478
  export const DEFAULT_SANITIZERS = [
2479
2479
  // SQL Injection - proper parameter binding sanitizes input
2480
2480
  // Note: prepareStatement alone is NOT a sanitizer - it's a sink when used with concatenation
2481
+ //
2482
+ // Full PreparedStatement setter coverage (cognium-dev #213 seventh slice).
2483
+ // Every JDBC PreparedStatement.setXxx binds a parameter placeholder via
2484
+ // the driver wire protocol — the SQL text is fixed, only the value slot
2485
+ // varies. Prior coverage was setString/setInt/setLong only; extending
2486
+ // to the full JDBC 4.x setter surface so real Java apps using date/
2487
+ // decimal/object/binary bindings credit as sanitized.
2481
2488
  { method: 'setString', class: 'PreparedStatement', removes: ['sql_injection'] },
2489
+ { method: 'setNString', class: 'PreparedStatement', removes: ['sql_injection'] },
2482
2490
  { method: 'setInt', class: 'PreparedStatement', removes: ['sql_injection'] },
2483
2491
  { method: 'setLong', class: 'PreparedStatement', removes: ['sql_injection'] },
2492
+ { method: 'setShort', class: 'PreparedStatement', removes: ['sql_injection'] },
2493
+ { method: 'setByte', class: 'PreparedStatement', removes: ['sql_injection'] },
2494
+ { method: 'setBoolean', class: 'PreparedStatement', removes: ['sql_injection'] },
2495
+ { method: 'setDouble', class: 'PreparedStatement', removes: ['sql_injection'] },
2496
+ { method: 'setFloat', class: 'PreparedStatement', removes: ['sql_injection'] },
2497
+ { method: 'setBigDecimal', class: 'PreparedStatement', removes: ['sql_injection'] },
2498
+ { method: 'setBytes', class: 'PreparedStatement', removes: ['sql_injection'] },
2499
+ { method: 'setDate', class: 'PreparedStatement', removes: ['sql_injection'] },
2500
+ { method: 'setTime', class: 'PreparedStatement', removes: ['sql_injection'] },
2501
+ { method: 'setTimestamp', class: 'PreparedStatement', removes: ['sql_injection'] },
2502
+ { method: 'setObject', class: 'PreparedStatement', removes: ['sql_injection'] },
2503
+ { method: 'setNull', class: 'PreparedStatement', removes: ['sql_injection'] },
2504
+ { method: 'setArray', class: 'PreparedStatement', removes: ['sql_injection'] },
2505
+ { method: 'setBlob', class: 'PreparedStatement', removes: ['sql_injection'] },
2506
+ { method: 'setClob', class: 'PreparedStatement', removes: ['sql_injection'] },
2507
+ { method: 'setNClob', class: 'PreparedStatement', removes: ['sql_injection'] },
2508
+ { method: 'setRef', class: 'PreparedStatement', removes: ['sql_injection'] },
2509
+ { method: 'setRowId', class: 'PreparedStatement', removes: ['sql_injection'] },
2510
+ { method: 'setSQLXML', class: 'PreparedStatement', removes: ['sql_injection'] },
2511
+ { method: 'setURL', class: 'PreparedStatement', removes: ['sql_injection'] },
2512
+ { method: 'setBinaryStream', class: 'PreparedStatement', removes: ['sql_injection'] },
2513
+ { method: 'setCharacterStream', class: 'PreparedStatement', removes: ['sql_injection'] },
2514
+ { method: 'setAsciiStream', class: 'PreparedStatement', removes: ['sql_injection'] },
2515
+ { method: 'setNCharacterStream', class: 'PreparedStatement', removes: ['sql_injection'] },
2516
+ // JPA / Hibernate Query.setParameter — covered above; add TypedQuery
2517
+ // (same interface but distinct type name).
2484
2518
  { method: 'setParameter', class: 'Query', removes: ['sql_injection'] },
2519
+ { method: 'setParameter', class: 'TypedQuery', removes: ['sql_injection'] },
2520
+ // Spring JdbcTemplate `NamedParameterJdbcTemplate.update / queryForObject`
2521
+ // parameterized shapes use SqlParameterSource.addValue — the addValue
2522
+ // call binds the parameter safely.
2523
+ { method: 'addValue', class: 'MapSqlParameterSource', removes: ['sql_injection'] },
2485
2524
  { annotation: 'Param', removes: ['sql_injection'] },
2486
2525
  // XSS
2487
2526
  { method: 'escapeHtml', removes: ['xss'] },
@@ -2500,6 +2539,48 @@ export const DEFAULT_SANITIZERS = [
2500
2539
  { method: 'render', class: 'Template', removes: ['xss'] }, // Rust askama auto-escapes
2501
2540
  { method: 'encodeForJavaScript', removes: ['xss'] },
2502
2541
  { method: 'encodeForCSS', removes: ['xss'] },
2542
+ // Additional Java XSS sanitizers (cognium-dev #213 seventh slice).
2543
+ //
2544
+ // Guava `HtmlEscapers.htmlEscaper().escape(x)` — the `.escape` call
2545
+ // on the returned Escaper is caught by the generic `escape` rule
2546
+ // above, but explicit registration makes intent clear.
2547
+ // Spring `HtmlUtils.htmlEscape(x)` — htmlEscape already covered
2548
+ // above (bare method name).
2549
+ // Apache Commons Text `StringEscapeUtils.escapeJson / escapeXml11 /
2550
+ // escapeEcmaScript / escapeCsv / escapeXsi`.
2551
+ // OWASP HTML Sanitizer `PolicyFactory.sanitize(html)`.
2552
+ { method: 'escape', class: 'Escaper', removes: ['xss'] },
2553
+ { method: 'escape', class: 'HtmlEscapers', removes: ['xss'] },
2554
+ { method: 'escapeJson', class: 'StringEscapeUtils', removes: ['xss'] },
2555
+ { method: 'escapeEcmaScript', class: 'StringEscapeUtils', removes: ['xss'] },
2556
+ { method: 'escapeXml11', class: 'StringEscapeUtils', removes: ['xss'] },
2557
+ { method: 'escapeXml10', class: 'StringEscapeUtils', removes: ['xss'] },
2558
+ { method: 'escapeCsv', class: 'StringEscapeUtils', removes: ['xss'] },
2559
+ { method: 'escapeXsi', class: 'StringEscapeUtils', removes: ['xss'] },
2560
+ { method: 'escapeJava', class: 'StringEscapeUtils', removes: ['xss'] },
2561
+ // Bare escapeJson / escapeEcmaScript / escapeCsv aliases — common
2562
+ // when statically imported.
2563
+ { method: 'escapeJson', removes: ['xss'] },
2564
+ { method: 'escapeEcmaScript', removes: ['xss'] },
2565
+ { method: 'escapeCsv', removes: ['xss'] },
2566
+ // OWASP HTML sanitizer (`com.googlecode.owasp-java-html-sanitizer`).
2567
+ { method: 'sanitize', class: 'PolicyFactory', removes: ['xss'] },
2568
+ // Java Base64 / Hex / MessageDigest — encoded output is binary-safe
2569
+ // (cognium-dev #213 seventh slice). None of these carry attacker
2570
+ // shell/SQL/HTML metacharacters through the encoding — Base64 emits
2571
+ // [A-Za-z0-9+/=], Hex emits [0-9a-f], MessageDigest.digest returns
2572
+ // opaque bytes usually toHex/toBase64-encoded downstream.
2573
+ { method: 'encodeToString', class: 'Encoder', removes: ['sql_injection', 'command_injection', 'xss', 'path_traversal', 'code_injection'] },
2574
+ { method: 'encode', class: 'Encoder', removes: ['sql_injection', 'command_injection', 'xss', 'path_traversal', 'code_injection'] },
2575
+ { method: 'encodeHexString', class: 'Hex', removes: ['sql_injection', 'command_injection', 'xss', 'path_traversal', 'code_injection'] },
2576
+ { method: 'digest', class: 'MessageDigest', removes: ['sql_injection', 'command_injection', 'xss', 'path_traversal', 'code_injection'] },
2577
+ // Bare aliases for encoder chains — `Base64.getEncoder().encodeToString(x)`
2578
+ // has a call-expression receiver (`Base64.getEncoder()`) that the Java IR
2579
+ // rarely resolves to `Encoder`. Same story for `Hex.encodeHexString(x)`
2580
+ // when Hex is imported. These bare-method names are dominated by their
2581
+ // encoding use in practice; false-positive risk is low.
2582
+ { method: 'encodeToString', removes: ['sql_injection', 'command_injection', 'xss', 'path_traversal', 'code_injection'] },
2583
+ { method: 'encodeHexString', removes: ['sql_injection', 'command_injection', 'xss', 'path_traversal', 'code_injection'] },
2503
2584
  // cognium-dev #249 3.162.0: `open_redirect` restored to the URL-encoder
2504
2585
  // sanitizer cluster. Sprint 82 (#189) reclassified `sendRedirect` from
2505
2586
  // `ssrf` → `open_redirect` (config-loader.ts:1296-1299) without updating
@@ -2626,6 +2707,91 @@ export const DEFAULT_SANITIZERS = [
2626
2707
  // Command injection - shell escaping
2627
2708
  { method: 'quote', class: 'shell', removes: ['command_injection'] },
2628
2709
  { method: 'escape', class: 'shell-escape', removes: ['command_injection'] },
2710
+ // JS/Node — additional XSS/HTML encoders (cognium-dev #213 sixth slice).
2711
+ //
2712
+ // he.encode(x) / he.escape(x) — `he` npm package
2713
+ // sanitizeHtml(x) — `sanitize-html` npm
2714
+ // xss(x) / filterXSS(x) — `xss` npm (Yahoo)
2715
+ // escapeHtml(x) / escapeHTML(x) — common bare helpers
2716
+ // entities.encode(x) / entities.escape(x) — `entities` npm
2717
+ // xssFilters.inHTMLData(x) / inHTMLComment(x) / uriInHTMLData(x)
2718
+ // — `xss-filters` npm (Yahoo)
2719
+ //
2720
+ // `external_taint_escape` is included alongside `xss` — the CWE-668
2721
+ // fallback fires on any call receiving tainted data that the engine
2722
+ // does not otherwise recognize. Since these functions are explicitly
2723
+ // registered as sanitizers (they PURIFY input), they should also
2724
+ // suppress the fallback so a `res.send(sanitizeHtml(x))` flow does
2725
+ // not report an external-taint-escape at the sanitizer call itself.
2726
+ { method: 'encode', class: 'he', removes: ['xss', 'external_taint_escape'] },
2727
+ { method: 'escape', class: 'he', removes: ['xss', 'external_taint_escape'] },
2728
+ { method: 'sanitizeHtml', removes: ['xss', 'external_taint_escape'] },
2729
+ { method: 'xss', removes: ['xss', 'external_taint_escape'] },
2730
+ { method: 'filterXSS', removes: ['xss', 'external_taint_escape'] },
2731
+ { method: 'escapeHtml', removes: ['xss', 'external_taint_escape'] },
2732
+ { method: 'escapeHTML', removes: ['xss', 'external_taint_escape'] },
2733
+ { method: 'encode', class: 'entities', removes: ['xss', 'external_taint_escape'] },
2734
+ { method: 'escape', class: 'entities', removes: ['xss', 'external_taint_escape'] },
2735
+ // xss-filters: context-specific helpers, all XSS-safe by construction.
2736
+ { method: 'inHTMLData', class: 'xssFilters', removes: ['xss', 'external_taint_escape'] },
2737
+ { method: 'inHTMLComment', class: 'xssFilters', removes: ['xss', 'external_taint_escape'] },
2738
+ { method: 'uriInHTMLData', class: 'xssFilters', removes: ['xss', 'external_taint_escape'] },
2739
+ // JS/Node — SQL escaping (in addition to the mysql class above).
2740
+ //
2741
+ // SqlString.escape / .escapeId — `sqlstring` npm (raw
2742
+ // escape used by mysql /
2743
+ // node-mysql2 drivers)
2744
+ // pgFormat(sql, ...args) / format(bare) — `pg-format` npm
2745
+ // SQL.raw / SQL(bare) — `sql-template-strings`
2746
+ //
2747
+ // Bare `format` is intentionally NOT registered — it collides with
2748
+ // string.format-style helpers unrelated to SQL. Callers should use the
2749
+ // qualified form.
2750
+ { method: 'escape', class: 'SqlString', removes: ['sql_injection', 'external_taint_escape'] },
2751
+ { method: 'escapeId', class: 'SqlString', removes: ['sql_injection', 'external_taint_escape'] },
2752
+ { method: 'format', class: 'SqlString', removes: ['sql_injection', 'external_taint_escape'] },
2753
+ { method: 'format', class: 'pgFormat', removes: ['sql_injection', 'external_taint_escape'] },
2754
+ { method: 'ident', class: 'pgFormat', removes: ['sql_injection', 'external_taint_escape'] },
2755
+ { method: 'literal', class: 'pgFormat', removes: ['sql_injection', 'external_taint_escape'] },
2756
+ // JS/Node — crypto.randomUUID() and Node's crypto.randomBytes(...)toString()
2757
+ // produce cryptographically-secure typed strings that cannot carry
2758
+ // attacker-injected payload. Registered as type coercion.
2759
+ { method: 'randomUUID', class: 'crypto', removes: ['sql_injection', 'nosql_injection', 'command_injection', 'path_traversal', 'code_injection', 'xss'] },
2760
+ // Bare `randomUUID()` alias — `import { randomUUID } from 'crypto'`.
2761
+ { method: 'randomUUID', removes: ['sql_injection', 'nosql_injection', 'command_injection', 'path_traversal', 'code_injection', 'xss'] },
2762
+ // JS/Node — URL construction. `new URL(x, base)` (constructor-call
2763
+ // matched by method_name === 'URL') and `URLSearchParams.toString()`
2764
+ // safely encode components for URL context.
2765
+ { method: 'toString', class: 'URLSearchParams', removes: ['ssrf', 'open_redirect', 'xss'] },
2766
+ // Go — additional sanitizers (cognium-dev #213 sixth slice).
2767
+ //
2768
+ // regexp.QuoteMeta(x) — mirror of Python re.escape; strips regex
2769
+ // metacharacters so downstream compile/match
2770
+ // cannot execute attacker-crafted patterns.
2771
+ // bluemonday.Sanitize — dominant Go HTML sanitizer library
2772
+ // (`microcosm-cc/bluemonday`). Called on a
2773
+ // Policy value returned by UGCPolicy() /
2774
+ // StrictPolicy() / etc. Match by method name
2775
+ // alone — Policy is the receiver type.
2776
+ // net.ParseIP(x) — validates the input is a well-formed IP;
2777
+ // returns nil for bad input (developer must
2778
+ // check, but the sanitizer only applies when
2779
+ // the parsed IP flows onward).
2780
+ // sql.Named(name, val) — parameterized query binding.
2781
+ { method: 'QuoteMeta', class: 'regexp', removes: ['redos', 'code_injection', 'external_taint_escape'] },
2782
+ { method: 'Sanitize', class: 'bluemonday', removes: ['xss', 'external_taint_escape'] },
2783
+ { method: 'Sanitize', class: 'Policy', removes: ['xss', 'external_taint_escape'] },
2784
+ // Bare `Sanitize` — the receiver is a Policy variable (`p := bluemonday.UGCPolicy(); p.Sanitize(x)`).
2785
+ // `Policy` class-matching only fires when the IR resolves the receiver type;
2786
+ // since Go DFG rarely propagates the type of a locally-assigned variable
2787
+ // from a package factory call, we also register the bare method name.
2788
+ // Narrow FP risk: `Sanitize` bare is uncommon outside bluemonday context.
2789
+ { method: 'Sanitize', removes: ['xss', 'external_taint_escape'] },
2790
+ { method: 'SanitizeBytes', class: 'bluemonday', removes: ['xss', 'external_taint_escape'] },
2791
+ { method: 'SanitizeBytes', class: 'Policy', removes: ['xss', 'external_taint_escape'] },
2792
+ { method: 'SanitizeBytes', removes: ['xss', 'external_taint_escape'] },
2793
+ { method: 'ParseIP', class: 'net', removes: ['ssrf', 'command_injection', 'path_traversal', 'external_taint_escape'] },
2794
+ { method: 'Named', class: 'sql', removes: ['sql_injection', 'external_taint_escape'] },
2629
2795
  // =========================================================================
2630
2796
  // Python Sanitizers
2631
2797
  // =========================================================================