circle-ir 4.7.0 → 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.
Files changed (29) hide show
  1. package/dist/analysis/config-loader.d.ts.map +1 -1
  2. package/dist/analysis/config-loader.js +61 -4
  3. package/dist/analysis/config-loader.js.map +1 -1
  4. package/dist/analysis/findings.js +1 -1
  5. package/dist/analysis/findings.js.map +1 -1
  6. package/dist/analysis/interprocedural.d.ts.map +1 -1
  7. package/dist/analysis/interprocedural.js +16 -1
  8. package/dist/analysis/interprocedural.js.map +1 -1
  9. package/dist/analysis/passes/language-sources-pass.d.ts.map +1 -1
  10. package/dist/analysis/passes/language-sources-pass.js +53 -3
  11. package/dist/analysis/passes/language-sources-pass.js.map +1 -1
  12. package/dist/analysis/passes/scan-secrets-pass.d.ts.map +1 -1
  13. package/dist/analysis/passes/scan-secrets-pass.js +10 -0
  14. package/dist/analysis/passes/scan-secrets-pass.js.map +1 -1
  15. package/dist/analysis/passes/unrestricted-file-upload-pass.d.ts.map +1 -1
  16. package/dist/analysis/passes/unrestricted-file-upload-pass.js +6 -4
  17. package/dist/analysis/passes/unrestricted-file-upload-pass.js.map +1 -1
  18. package/dist/analysis/passes/unused-variable-pass.d.ts.map +1 -1
  19. package/dist/analysis/passes/unused-variable-pass.js +69 -20
  20. package/dist/analysis/passes/unused-variable-pass.js.map +1 -1
  21. package/dist/analysis/taint-matcher.d.ts.map +1 -1
  22. package/dist/analysis/taint-matcher.js +46 -0
  23. package/dist/analysis/taint-matcher.js.map +1 -1
  24. package/dist/browser/circle-ir.js +185 -27
  25. package/dist/core/circle-ir-core.cjs +96 -8
  26. package/dist/core/circle-ir-core.js +96 -8
  27. package/dist/core/extractors/dfg.js +6 -3
  28. package/dist/core/extractors/dfg.js.map +1 -1
  29. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"config-loader.d.ts","sourceRoot":"","sources":["../../src/analysis/config-loader.ts"],"names":[],"mappings":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AO,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,EAuwB1C,CAAC;AA+KF,eAAO,MAAM,aAAa,EAAE,WAAW,EAkgEtC,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,gBAAgB,EAuiBhD,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,sBAAsB,EAAE,kBAAkB,EAiDtD,CAAC;AAEF;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,WAAW,CAO9C;AAMD;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,EAAE,UAAU,EA8F5C,CAAC"}
@@ -1091,7 +1091,11 @@ export const DEFAULT_SINKS = [
1091
1091
  // File: covers both File(String pathname) and File(parent, child). The 2-arg
1092
1092
  // overload's child argument carries CVE-2018-8041 (Camel mail Content-Disposition
1093
1093
  // filename written to disk).
1094
- { method: 'File', class: 'constructor', type: 'path_traversal', cwe: 'CWE-22', severity: 'high', arg_positions: [0, 1] },
1094
+ // Java `new File(path)` idiom. Excluded for C#: there is no `new File()` in
1095
+ // .NET (it's `System.IO.File` statics + `FileStream`, covered separately), and
1096
+ // this over-matched ASP.NET `ControllerBase.File(stream|bytes, contentType)` —
1097
+ // a result helper that returns a file, not a path sink (cognium-ai#326 B).
1098
+ { method: 'File', class: 'constructor', type: 'path_traversal', cwe: 'CWE-22', severity: 'high', arg_positions: [0, 1], exclude_languages: ['csharp'] },
1095
1099
  { method: 'FileInputStream', class: 'constructor', type: 'path_traversal', cwe: 'CWE-22', severity: 'high', arg_positions: [0] },
1096
1100
  { method: 'FileOutputStream', class: 'constructor', type: 'path_traversal', cwe: 'CWE-22', severity: 'high', arg_positions: [0] },
1097
1101
  { method: 'FileReader', class: 'constructor', type: 'path_traversal', cwe: 'CWE-22', severity: 'high', arg_positions: [0] },
@@ -1334,8 +1338,11 @@ export const DEFAULT_SINKS = [
1334
1338
  // SAX handler sinks (can lead to XSS in parsed content)
1335
1339
  { method: 'startElement', class: 'ContentHandler', type: 'xss', cwe: 'CWE-79', severity: 'high', arg_positions: [0, 1, 2] },
1336
1340
  { method: 'characters', class: 'ContentHandler', type: 'xss', cwe: 'CWE-79', severity: 'high', arg_positions: [0] },
1337
- // Template output sinks
1338
- { method: 'output', type: 'xss', cwe: 'CWE-79', severity: 'high', arg_positions: [0] },
1341
+ // Template output sinks. `output` is classless (Java template engines /
1342
+ // Velocity), but Rust `std::process::Command::…output()` is process
1343
+ // execution, not HTML — it already fires the CWE-78 command_injection sink,
1344
+ // so exclude Rust here to drop the spurious xss (cognium-dev#146).
1345
+ { method: 'output', type: 'xss', cwe: 'CWE-79', severity: 'high', arg_positions: [0], exclude_languages: ['rust'] },
1339
1346
  { method: 'setOutput', type: 'xss', cwe: 'CWE-79', severity: 'high', arg_positions: [0] },
1340
1347
  { method: 'writeAttribute', type: 'xss', cwe: 'CWE-79', severity: 'high', arg_positions: [0, 1] },
1341
1348
  // AntiSamy specific (SAX filters)
@@ -2641,6 +2648,22 @@ export const DEFAULT_SINKS = [
2641
2648
  { method: 'FileStream', type: 'path_traversal', cwe: 'CWE-22', severity: 'high', arg_positions: [0], languages: ['csharp'] },
2642
2649
  { method: 'StreamReader', type: 'path_traversal', cwe: 'CWE-22', severity: 'high', arg_positions: [0], languages: ['csharp'] },
2643
2650
  { method: 'StreamWriter', type: 'path_traversal', cwe: 'CWE-22', severity: 'high', arg_positions: [0], languages: ['csharp'] },
2651
+ // Remaining System.IO.File path APIs — class-scoped so they don't collide
2652
+ // with unrelated methods. Copy/Move take a source AND destination path (both
2653
+ // attacker-controllable → read-anywhere / write-anywhere), hence [0, 1].
2654
+ { method: 'Copy', class: 'File', type: 'path_traversal', cwe: 'CWE-22', severity: 'high', arg_positions: [0, 1], languages: ['csharp'] },
2655
+ { method: 'Move', class: 'File', type: 'path_traversal', cwe: 'CWE-22', severity: 'high', arg_positions: [0, 1], languages: ['csharp'] },
2656
+ { method: 'Delete', class: 'File', type: 'path_traversal', cwe: 'CWE-22', severity: 'high', arg_positions: [0], languages: ['csharp'] },
2657
+ { method: 'Open', class: 'File', type: 'path_traversal', cwe: 'CWE-22', severity: 'high', arg_positions: [0], languages: ['csharp'] },
2658
+ { method: 'OpenText', class: 'File', type: 'path_traversal', cwe: 'CWE-22', severity: 'high', arg_positions: [0], languages: ['csharp'] },
2659
+ { method: 'Create', class: 'File', type: 'path_traversal', cwe: 'CWE-22', severity: 'high', arg_positions: [0], languages: ['csharp'] },
2660
+ { method: 'WriteAllLines', type: 'path_traversal', cwe: 'CWE-22', severity: 'high', arg_positions: [0], languages: ['csharp'] },
2661
+ { method: 'AppendAllLines', type: 'path_traversal', cwe: 'CWE-22', severity: 'high', arg_positions: [0], languages: ['csharp'] },
2662
+ // System.IO.Directory path APIs.
2663
+ { method: 'CreateDirectory', class: 'Directory', type: 'path_traversal', cwe: 'CWE-22', severity: 'high', arg_positions: [0], languages: ['csharp'] },
2664
+ { method: 'Delete', class: 'Directory', type: 'path_traversal', cwe: 'CWE-22', severity: 'high', arg_positions: [0], languages: ['csharp'] },
2665
+ { method: 'GetFiles', class: 'Directory', type: 'path_traversal', cwe: 'CWE-22', severity: 'high', arg_positions: [0], languages: ['csharp'] },
2666
+ { method: 'EnumerateFiles', class: 'Directory', type: 'path_traversal', cwe: 'CWE-22', severity: 'high', arg_positions: [0], languages: ['csharp'] },
2644
2667
  // C# SSRF — HttpClient / WebClient / WebRequest (CWE-918).
2645
2668
  { method: 'GetAsync', type: 'ssrf', cwe: 'CWE-918', severity: 'high', arg_positions: [0], languages: ['csharp'] },
2646
2669
  { method: 'PostAsync', type: 'ssrf', cwe: 'CWE-918', severity: 'high', arg_positions: [0], languages: ['csharp'] },
@@ -2657,9 +2680,24 @@ export const DEFAULT_SINKS = [
2657
2680
  // C# code injection — dynamic script/assembly loading (CWE-94).
2658
2681
  { method: 'EvaluateAsync', type: 'code_injection', cwe: 'CWE-94', severity: 'critical', arg_positions: [0], languages: ['csharp'] },
2659
2682
  { method: 'RunAsync', class: 'CSharpScript', type: 'code_injection', cwe: 'CWE-94', severity: 'critical', arg_positions: [0], languages: ['csharp'] },
2660
- // C# insecure deserialization BinaryFormatter et al. (CWE-502).
2683
+ // Loading an assembly from an attacker-controlled name/path is arbitrary code
2684
+ // execution. Class-scoped to `Assembly` (low FP — a tainted arg here is rare
2685
+ // in benign code). `Type.GetType`/`Activator.CreateInstance` are intentionally
2686
+ // NOT added — reflection with config-driven type names is common in DI, an FP
2687
+ // trap without the reflection-suppress machinery.
2688
+ { method: 'Load', class: 'Assembly', type: 'code_injection', cwe: 'CWE-94', severity: 'critical', arg_positions: [0], languages: ['csharp'] },
2689
+ { method: 'LoadFrom', class: 'Assembly', type: 'code_injection', cwe: 'CWE-94', severity: 'critical', arg_positions: [0], languages: ['csharp'] },
2690
+ { method: 'LoadFile', class: 'Assembly', type: 'code_injection', cwe: 'CWE-94', severity: 'critical', arg_positions: [0], languages: ['csharp'] },
2691
+ // C# insecure deserialization — the polymorphic BCL formatters that can
2692
+ // instantiate arbitrary types named in the payload (CWE-502, cognium-ai#318).
2693
+ // Each of these classes exists only to deserialize and is unsafe on untrusted
2694
+ // input; class-scoped, so no collision with safe JSON APIs (System.Text.Json /
2695
+ // Newtonsoft-default, which are intentionally NOT sinks).
2661
2696
  { method: 'Deserialize', class: 'BinaryFormatter', type: 'deserialization', cwe: 'CWE-502', severity: 'critical', arg_positions: [0], languages: ['csharp'] },
2662
2697
  { method: 'Deserialize', class: 'NetDataContractSerializer', type: 'deserialization', cwe: 'CWE-502', severity: 'critical', arg_positions: [0], languages: ['csharp'] },
2698
+ { method: 'Deserialize', class: 'SoapFormatter', type: 'deserialization', cwe: 'CWE-502', severity: 'critical', arg_positions: [0], languages: ['csharp'] },
2699
+ { method: 'Deserialize', class: 'LosFormatter', type: 'deserialization', cwe: 'CWE-502', severity: 'critical', arg_positions: [0], languages: ['csharp'] },
2700
+ { method: 'Deserialize', class: 'ObjectStateFormatter', type: 'deserialization', cwe: 'CWE-502', severity: 'critical', arg_positions: [0], languages: ['csharp'] },
2663
2701
  // C# XSS — raw HTML output (CWE-79).
2664
2702
  { method: 'Raw', class: 'Html', type: 'xss', cwe: 'CWE-79', severity: 'high', arg_positions: [0], languages: ['csharp'] },
2665
2703
  { method: 'Write', class: 'Response', type: 'xss', cwe: 'CWE-79', severity: 'high', arg_positions: [0], languages: ['csharp'] },
@@ -2684,6 +2722,20 @@ export const DEFAULT_SINKS = [
2684
2722
  // cognium-dev#273/#275). `BsonDocument.Parse(userJson)` deserializes an
2685
2723
  // attacker-controlled query document. Class-scoped (static receiver resolves).
2686
2724
  { method: 'Parse', class: 'BsonDocument', type: 'nosql_injection', cwe: 'CWE-943', severity: 'high', arg_positions: [0], languages: ['csharp'] },
2725
+ // C# log injection — Microsoft.Extensions.Logging `ILogger` (CWE-117,
2726
+ // cognium-ai#318). Only the message TEMPLATE (arg[0]) is the injectable
2727
+ // position; the structured form `LogInformation("… {Id}", id)` keeps taint in
2728
+ // later args (the logger renders them as data), so arg_positions:[0] does not
2729
+ // flag it. Mirrors the Java `Logger` sinks; severity low.
2730
+ { method: 'LogInformation', type: 'log_injection', cwe: 'CWE-117', severity: 'low', arg_positions: [0], languages: ['csharp'] },
2731
+ { method: 'LogWarning', type: 'log_injection', cwe: 'CWE-117', severity: 'low', arg_positions: [0], languages: ['csharp'] },
2732
+ { method: 'LogError', type: 'log_injection', cwe: 'CWE-117', severity: 'low', arg_positions: [0], languages: ['csharp'] },
2733
+ { method: 'LogDebug', type: 'log_injection', cwe: 'CWE-117', severity: 'low', arg_positions: [0], languages: ['csharp'] },
2734
+ { method: 'LogCritical', type: 'log_injection', cwe: 'CWE-117', severity: 'low', arg_positions: [0], languages: ['csharp'] },
2735
+ { method: 'LogTrace', type: 'log_injection', cwe: 'CWE-117', severity: 'low', arg_positions: [0], languages: ['csharp'] },
2736
+ // Generic `ILogger.Log(logLevel, message, …)` — class-scoped (`Log` alone is
2737
+ // too generic); the message is arg[1].
2738
+ { method: 'Log', class: 'ILogger', type: 'log_injection', cwe: 'CWE-117', severity: 'low', arg_positions: [1], languages: ['csharp'] },
2687
2739
  // C# XPath injection — System.Xml.XPath (CWE-643). Distinctive selector methods.
2688
2740
  { method: 'SelectSingleNode', type: 'xpath_injection', cwe: 'CWE-643', severity: 'high', arg_positions: [0], languages: ['csharp'] },
2689
2741
  { method: 'SelectNodes', type: 'xpath_injection', cwe: 'CWE-643', severity: 'high', arg_positions: [0], languages: ['csharp'] },
@@ -2692,6 +2744,11 @@ export const DEFAULT_SINKS = [
2692
2744
  { method: 'LoadXml', type: 'xxe', cwe: 'CWE-611', severity: 'high', arg_positions: [0], languages: ['csharp'] },
2693
2745
  { method: 'Load', class: 'XmlDocument', type: 'xxe', cwe: 'CWE-611', severity: 'high', arg_positions: [0], languages: ['csharp'] },
2694
2746
  { method: 'Load', class: 'XDocument', type: 'xxe', cwe: 'CWE-611', severity: 'high', arg_positions: [0], languages: ['csharp'] },
2747
+ // `new XmlTextReader(input)` — its DtdProcessing defaults to Parse (resolves
2748
+ // external entities), unlike `XmlReader.Create` (Prohibit). CWE-611,
2749
+ // cognium-ai#318. The 4.7.0 XmlResolver=null / DtdProcessing=Prohibit
2750
+ // hardening still suppresses the safe shape.
2751
+ { method: 'XmlTextReader', type: 'xxe', cwe: 'CWE-611', severity: 'high', arg_positions: [0], languages: ['csharp'] },
2695
2752
  // Python SQLi — asyncpg Connection.*
2696
2753
  { method: 'execute', class: 'Connection', type: 'sql_injection', cwe: 'CWE-89', severity: 'critical', arg_positions: [0] },
2697
2754
  { method: 'fetch', class: 'Connection', type: 'sql_injection', cwe: 'CWE-89', severity: 'critical', arg_positions: [0] },