@cyclonedx/cdxgen 12.1.4 → 12.2.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.
Files changed (184) hide show
  1. package/README.md +47 -39
  2. package/bin/cdxgen.js +181 -90
  3. package/bin/evinse.js +4 -4
  4. package/bin/repl.js +3 -3
  5. package/bin/sign.js +102 -0
  6. package/bin/validate.js +233 -0
  7. package/bin/verify.js +69 -28
  8. package/data/queries.json +1 -1
  9. package/data/rules/ci-permissions.yaml +186 -0
  10. package/data/rules/dependency-sources.yaml +123 -0
  11. package/data/rules/package-integrity.yaml +135 -0
  12. package/data/rules/vscode-extensions.yaml +228 -0
  13. package/lib/cli/index.js +484 -440
  14. package/lib/evinser/db.js +137 -0
  15. package/lib/{helpers → evinser}/db.poku.js +2 -6
  16. package/lib/evinser/evinser.js +5 -18
  17. package/lib/evinser/swiftsem.js +1 -1
  18. package/lib/helpers/bomSigner.js +312 -0
  19. package/lib/helpers/bomSigner.poku.js +156 -0
  20. package/lib/helpers/caxa.js +1 -1
  21. package/lib/helpers/ciParsers/azurePipelines.js +295 -0
  22. package/lib/helpers/ciParsers/azurePipelines.poku.js +253 -0
  23. package/lib/helpers/ciParsers/circleCi.js +286 -0
  24. package/lib/helpers/ciParsers/circleCi.poku.js +230 -0
  25. package/lib/helpers/ciParsers/common.js +24 -0
  26. package/lib/helpers/ciParsers/githubActions.js +636 -0
  27. package/lib/helpers/ciParsers/githubActions.poku.js +802 -0
  28. package/lib/helpers/ciParsers/gitlabCi.js +213 -0
  29. package/lib/helpers/ciParsers/gitlabCi.poku.js +247 -0
  30. package/lib/helpers/ciParsers/jenkins.js +181 -0
  31. package/lib/helpers/ciParsers/jenkins.poku.js +197 -0
  32. package/lib/helpers/depsUtils.js +203 -0
  33. package/lib/helpers/depsUtils.poku.js +150 -0
  34. package/lib/helpers/display.js +429 -14
  35. package/lib/helpers/envcontext.js +23 -8
  36. package/lib/helpers/formulationParsers.js +351 -0
  37. package/lib/helpers/logger.js +14 -0
  38. package/lib/helpers/protobom.js +9 -9
  39. package/lib/helpers/pythonutils.js +305 -0
  40. package/lib/helpers/pythonutils.poku.js +469 -0
  41. package/lib/helpers/utils.js +970 -528
  42. package/lib/helpers/utils.poku.js +139 -256
  43. package/lib/helpers/versutils.js +202 -0
  44. package/lib/helpers/versutils.poku.js +315 -0
  45. package/lib/helpers/vsixutils.js +1061 -0
  46. package/lib/helpers/vsixutils.poku.js +2247 -0
  47. package/lib/managers/binary.js +19 -19
  48. package/lib/managers/docker.js +108 -1
  49. package/lib/managers/oci.js +10 -0
  50. package/lib/managers/piptree.js +4 -10
  51. package/lib/parsers/npmrc.js +92 -0
  52. package/lib/parsers/npmrc.poku.js +528 -0
  53. package/lib/server/openapi.yaml +1 -10
  54. package/lib/server/server.js +58 -16
  55. package/lib/server/server.poku.js +123 -144
  56. package/lib/stages/postgen/annotator.js +1 -1
  57. package/lib/stages/postgen/auditBom.js +197 -0
  58. package/lib/stages/postgen/auditBom.poku.js +378 -0
  59. package/lib/stages/postgen/postgen.js +54 -1
  60. package/lib/stages/postgen/postgen.poku.js +90 -1
  61. package/lib/stages/postgen/ruleEngine.js +369 -0
  62. package/lib/stages/pregen/envAudit.js +299 -0
  63. package/lib/stages/pregen/envAudit.poku.js +572 -0
  64. package/lib/stages/pregen/pregen.js +12 -8
  65. package/lib/third-party/arborist/lib/deepest-nesting-target.js +1 -1
  66. package/lib/third-party/arborist/lib/node.js +3 -3
  67. package/lib/third-party/arborist/lib/shrinkwrap.js +1 -1
  68. package/lib/third-party/arborist/lib/tree-check.js +1 -1
  69. package/lib/{helpers/validator.js → validator/bomValidator.js} +107 -47
  70. package/lib/validator/complianceEngine.js +241 -0
  71. package/lib/validator/complianceEngine.poku.js +168 -0
  72. package/lib/validator/complianceRules.js +1610 -0
  73. package/lib/validator/complianceRules.poku.js +328 -0
  74. package/lib/validator/index.js +222 -0
  75. package/lib/validator/index.poku.js +144 -0
  76. package/lib/validator/reporters/annotations.js +121 -0
  77. package/lib/validator/reporters/console.js +149 -0
  78. package/lib/validator/reporters/index.js +41 -0
  79. package/lib/validator/reporters/json.js +37 -0
  80. package/lib/validator/reporters/sarif.js +184 -0
  81. package/lib/validator/reporters.poku.js +150 -0
  82. package/package.json +8 -8
  83. package/types/bin/sign.d.ts +3 -0
  84. package/types/bin/sign.d.ts.map +1 -0
  85. package/types/bin/validate.d.ts +3 -0
  86. package/types/bin/validate.d.ts.map +1 -0
  87. package/types/helpers/utils.d.ts +0 -1
  88. package/types/lib/cli/index.d.ts +49 -52
  89. package/types/lib/cli/index.d.ts.map +1 -1
  90. package/types/lib/evinser/db.d.ts +34 -0
  91. package/types/lib/evinser/db.d.ts.map +1 -0
  92. package/types/lib/evinser/evinser.d.ts +63 -16
  93. package/types/lib/evinser/evinser.d.ts.map +1 -1
  94. package/types/lib/helpers/bomSigner.d.ts +27 -0
  95. package/types/lib/helpers/bomSigner.d.ts.map +1 -0
  96. package/types/lib/helpers/ciParsers/azurePipelines.d.ts +17 -0
  97. package/types/lib/helpers/ciParsers/azurePipelines.d.ts.map +1 -0
  98. package/types/lib/helpers/ciParsers/circleCi.d.ts +17 -0
  99. package/types/lib/helpers/ciParsers/circleCi.d.ts.map +1 -0
  100. package/types/lib/helpers/ciParsers/common.d.ts +11 -0
  101. package/types/lib/helpers/ciParsers/common.d.ts.map +1 -0
  102. package/types/lib/helpers/ciParsers/githubActions.d.ts +34 -0
  103. package/types/lib/helpers/ciParsers/githubActions.d.ts.map +1 -0
  104. package/types/lib/helpers/ciParsers/gitlabCi.d.ts +17 -0
  105. package/types/lib/helpers/ciParsers/gitlabCi.d.ts.map +1 -0
  106. package/types/lib/helpers/ciParsers/jenkins.d.ts +17 -0
  107. package/types/lib/helpers/ciParsers/jenkins.d.ts.map +1 -0
  108. package/types/lib/helpers/depsUtils.d.ts +21 -0
  109. package/types/lib/helpers/depsUtils.d.ts.map +1 -0
  110. package/types/lib/helpers/display.d.ts +111 -11
  111. package/types/lib/helpers/display.d.ts.map +1 -1
  112. package/types/lib/helpers/envcontext.d.ts +19 -7
  113. package/types/lib/helpers/envcontext.d.ts.map +1 -1
  114. package/types/lib/helpers/formulationParsers.d.ts +50 -0
  115. package/types/lib/helpers/formulationParsers.d.ts.map +1 -0
  116. package/types/lib/helpers/logger.d.ts +15 -1
  117. package/types/lib/helpers/logger.d.ts.map +1 -1
  118. package/types/lib/helpers/protobom.d.ts +2 -2
  119. package/types/lib/helpers/pythonutils.d.ts +18 -0
  120. package/types/lib/helpers/pythonutils.d.ts.map +1 -0
  121. package/types/lib/helpers/utils.d.ts +532 -128
  122. package/types/lib/helpers/utils.d.ts.map +1 -1
  123. package/types/lib/helpers/versutils.d.ts +8 -0
  124. package/types/lib/helpers/versutils.d.ts.map +1 -0
  125. package/types/lib/helpers/vsixutils.d.ts +130 -0
  126. package/types/lib/helpers/vsixutils.d.ts.map +1 -0
  127. package/types/lib/managers/docker.d.ts +12 -31
  128. package/types/lib/managers/docker.d.ts.map +1 -1
  129. package/types/lib/managers/oci.d.ts +11 -1
  130. package/types/lib/managers/oci.d.ts.map +1 -1
  131. package/types/lib/managers/piptree.d.ts.map +1 -1
  132. package/types/lib/parsers/npmrc.d.ts +26 -0
  133. package/types/lib/parsers/npmrc.d.ts.map +1 -0
  134. package/types/lib/server/server.d.ts +21 -2
  135. package/types/lib/server/server.d.ts.map +1 -1
  136. package/types/lib/stages/postgen/auditBom.d.ts +20 -0
  137. package/types/lib/stages/postgen/auditBom.d.ts.map +1 -0
  138. package/types/lib/stages/postgen/postgen.d.ts +8 -1
  139. package/types/lib/stages/postgen/postgen.d.ts.map +1 -1
  140. package/types/lib/stages/postgen/ruleEngine.d.ts +18 -0
  141. package/types/lib/stages/postgen/ruleEngine.d.ts.map +1 -0
  142. package/types/lib/stages/pregen/envAudit.d.ts +8 -0
  143. package/types/lib/stages/pregen/envAudit.d.ts.map +1 -0
  144. package/types/lib/stages/pregen/pregen.d.ts.map +1 -1
  145. package/types/lib/{helpers/validator.d.ts → validator/bomValidator.d.ts} +1 -1
  146. package/types/lib/validator/bomValidator.d.ts.map +1 -0
  147. package/types/lib/validator/complianceEngine.d.ts +66 -0
  148. package/types/lib/validator/complianceEngine.d.ts.map +1 -0
  149. package/types/lib/validator/complianceRules.d.ts +70 -0
  150. package/types/lib/validator/complianceRules.d.ts.map +1 -0
  151. package/types/lib/validator/index.d.ts +70 -0
  152. package/types/lib/validator/index.d.ts.map +1 -0
  153. package/types/lib/validator/reporters/annotations.d.ts +31 -0
  154. package/types/lib/validator/reporters/annotations.d.ts.map +1 -0
  155. package/types/lib/validator/reporters/console.d.ts +30 -0
  156. package/types/lib/validator/reporters/console.d.ts.map +1 -0
  157. package/types/lib/validator/reporters/index.d.ts +21 -0
  158. package/types/lib/validator/reporters/index.d.ts.map +1 -0
  159. package/types/lib/validator/reporters/json.d.ts +11 -0
  160. package/types/lib/validator/reporters/json.d.ts.map +1 -0
  161. package/types/lib/validator/reporters/sarif.d.ts +16 -0
  162. package/types/lib/validator/reporters/sarif.d.ts.map +1 -0
  163. package/lib/helpers/db.js +0 -162
  164. package/types/helpers/db.d.ts +0 -35
  165. package/types/helpers/db.d.ts.map +0 -1
  166. package/types/lib/helpers/db.d.ts +0 -35
  167. package/types/lib/helpers/db.d.ts.map +0 -1
  168. package/types/lib/helpers/validator.d.ts.map +0 -1
  169. package/types/managers/binary.d.ts +0 -37
  170. package/types/managers/binary.d.ts.map +0 -1
  171. package/types/managers/docker.d.ts +0 -56
  172. package/types/managers/docker.d.ts.map +0 -1
  173. package/types/managers/oci.d.ts +0 -2
  174. package/types/managers/oci.d.ts.map +0 -1
  175. package/types/managers/piptree.d.ts +0 -2
  176. package/types/managers/piptree.d.ts.map +0 -1
  177. package/types/server/server.d.ts +0 -34
  178. package/types/server/server.d.ts.map +0 -1
  179. package/types/stages/postgen/annotator.d.ts +0 -27
  180. package/types/stages/postgen/annotator.d.ts.map +0 -1
  181. package/types/stages/postgen/postgen.d.ts +0 -51
  182. package/types/stages/postgen/postgen.d.ts.map +0 -1
  183. package/types/stages/pregen/pregen.d.ts +0 -59
  184. package/types/stages/pregen/pregen.d.ts.map +0 -1
@@ -7,6 +7,7 @@ import { assert, describe, it, test } from "poku";
7
7
  import { parse } from "ssri";
8
8
  import { parse as loadYaml } from "yaml";
9
9
 
10
+ import { validateRefs } from "../validator/bomValidator.js";
10
11
  import {
11
12
  buildObjectForCocoaPod,
12
13
  buildObjectForGradleModule,
@@ -113,7 +114,6 @@ import {
113
114
  toGemModuleNames,
114
115
  yarnLockToIdentMap,
115
116
  } from "./utils.js";
116
- import { validateRefs } from "./validator.js";
117
117
 
118
118
  it("SSRI test", () => {
119
119
  // gopkg.lock hash
@@ -2596,12 +2596,15 @@ it("parse mix lock data", () => {
2596
2596
  it("parse github actions workflow data", () => {
2597
2597
  assert.deepStrictEqual(parseGitHubWorkflowData(null), []);
2598
2598
  let dep_list = parseGitHubWorkflowData("./.github/workflows/nodejs.yml");
2599
- assert.deepStrictEqual(dep_list.length, 8);
2599
+ assert.deepStrictEqual(dep_list.length, 13);
2600
2600
  assert.deepStrictEqual(dep_list[0], {
2601
+ "bom-ref":
2602
+ "pkg:github/actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd",
2603
+ type: "application",
2601
2604
  group: "actions",
2602
2605
  name: "checkout",
2603
- version: "6.0.2",
2604
- purl: "pkg:github/actions/checkout@6.0.2?commit=de0fac2e4500dabe0009e67214ff5f5447ce83dd",
2606
+ version: "de0fac2e4500dabe0009e67214ff5f5447ce83dd",
2607
+ purl: "pkg:github/actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd",
2605
2608
  properties: [
2606
2609
  {
2607
2610
  name: "SrcFile",
@@ -2611,6 +2614,10 @@ it("parse github actions workflow data", () => {
2611
2614
  name: "cdx:github:workflow:name",
2612
2615
  value: "Node CI",
2613
2616
  },
2617
+ {
2618
+ name: "cdx:github:workflow:file",
2619
+ value: "./.github/workflows/nodejs.yml",
2620
+ },
2614
2621
  {
2615
2622
  name: "cdx:github:job:name",
2616
2623
  value: "read-node-versions",
@@ -2631,277 +2638,40 @@ it("parse github actions workflow data", () => {
2631
2638
  name: "cdx:github:action:isShaPinned",
2632
2639
  value: "true",
2633
2640
  },
2634
- {
2635
- name: "cdx:github:workflow:concurrencyGroup",
2636
- value:
2637
- "${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}",
2638
- },
2639
2641
  {
2640
2642
  name: "cdx:actions:isOfficial",
2641
2643
  value: "true",
2642
2644
  },
2645
+ {
2646
+ name: "cdx:github:checkout:persistCredentials",
2647
+ value: "false",
2648
+ },
2643
2649
  {
2644
2650
  name: "cdx:github:workflow:triggers",
2645
2651
  value: "pull_request,push,workflow_dispatch",
2646
2652
  },
2647
2653
  ],
2654
+ scope: "required",
2648
2655
  evidence: {
2649
- identity: {
2650
- field: "purl",
2651
- confidence: 0.7,
2652
- methods: [
2653
- {
2654
- technique: "source-code-analysis",
2655
- confidence: 0.7,
2656
- value: "./.github/workflows/nodejs.yml",
2657
- },
2658
- ],
2659
- },
2660
- },
2661
- });
2662
- dep_list = parseGitHubWorkflowData("./test/data/github-actions-tj.yaml");
2663
- assert.deepStrictEqual(dep_list.length, 4);
2664
- assert.deepStrictEqual(dep_list, [
2665
- {
2666
- group: "pixel",
2667
- name: "steamcmd",
2668
- version: "1.2.7",
2669
- purl: "pkg:github/pixel/steamcmd@1.2.7?commit=foo",
2670
- properties: [
2671
- {
2672
- name: "SrcFile",
2673
- value: "./test/data/github-actions-tj.yaml",
2674
- },
2675
- {
2676
- name: "cdx:github:workflow:name",
2677
- value: "Testing",
2678
- },
2679
- {
2680
- name: "cdx:github:job:name",
2681
- value: "vulnerable-actions",
2682
- },
2683
- {
2684
- name: "cdx:github:job:runner",
2685
- value: "ubuntu-latest",
2686
- },
2687
- {
2688
- name: "cdx:github:action:uses",
2689
- value: "pixel/steamcmd@foo",
2690
- },
2691
- {
2692
- name: "cdx:github:action:versionPinningType",
2693
- value: "tag",
2694
- },
2695
- {
2696
- name: "cdx:github:action:isShaPinned",
2697
- value: "false",
2698
- },
2699
- {
2700
- name: "cdx:github:step:name",
2701
- value: "Test action 1",
2702
- },
2703
- {
2704
- name: "cdx:github:workflow:triggers",
2705
- value: "push,pull_request_target",
2706
- },
2707
- ],
2708
- evidence: {
2709
- identity: {
2710
- field: "purl",
2711
- confidence: 0.7,
2712
- methods: [
2713
- {
2714
- technique: "source-code-analysis",
2715
- confidence: 0.7,
2716
- value: "./test/data/github-actions-tj.yaml",
2717
- },
2718
- ],
2719
- },
2720
- },
2721
- },
2722
- {
2723
- group: "tj",
2724
- name: "branch",
2725
- version: "8.2.0",
2726
- purl: "pkg:github/tj/branch@8.2.0?commit=47dd",
2727
- properties: [
2728
- {
2729
- name: "SrcFile",
2730
- value: "./test/data/github-actions-tj.yaml",
2731
- },
2732
- {
2733
- name: "cdx:github:workflow:name",
2734
- value: "Testing",
2735
- },
2736
- {
2737
- name: "cdx:github:job:name",
2738
- value: "vulnerable-actions",
2739
- },
2740
- {
2741
- name: "cdx:github:job:runner",
2742
- value: "ubuntu-latest",
2743
- },
2744
- {
2745
- name: "cdx:github:action:uses",
2746
- value: "tj/branch@47dd",
2747
- },
2748
- {
2749
- name: "cdx:github:action:versionPinningType",
2750
- value: "tag",
2751
- },
2752
- {
2753
- name: "cdx:github:action:isShaPinned",
2754
- value: "false",
2755
- },
2756
- {
2757
- name: "cdx:github:step:name",
2758
- value: "Test action 2",
2759
- },
2656
+ identity: [
2760
2657
  {
2761
- name: "cdx:github:workflow:triggers",
2762
- value: "push,pull_request_target",
2763
- },
2764
- ],
2765
- evidence: {
2766
- identity: {
2767
2658
  field: "purl",
2768
- confidence: 0.7,
2659
+ confidence: 0.5,
2769
2660
  methods: [
2770
2661
  {
2771
2662
  technique: "source-code-analysis",
2772
- confidence: 0.7,
2773
- value: "./test/data/github-actions-tj.yaml",
2663
+ confidence: 0.5,
2664
+ value: "./.github/workflows/nodejs.yml",
2774
2665
  },
2775
2666
  ],
2776
2667
  },
2777
- },
2778
- },
2779
- {
2780
- group: "tj",
2781
- name: "branch2",
2782
- version: "08",
2783
- purl: "pkg:github/tj/branch2@08?tag=v0.0.18",
2784
- properties: [
2785
- {
2786
- name: "SrcFile",
2787
- value: "./test/data/github-actions-tj.yaml",
2788
- },
2789
- {
2790
- name: "cdx:github:workflow:name",
2791
- value: "Testing",
2792
- },
2793
- {
2794
- name: "cdx:github:job:name",
2795
- value: "vulnerable-actions",
2796
- },
2797
- {
2798
- name: "cdx:github:job:runner",
2799
- value: "ubuntu-latest",
2800
- },
2801
- {
2802
- name: "cdx:github:action:uses",
2803
- value: "tj/branch2@v0.0.18",
2804
- },
2805
- {
2806
- name: "cdx:github:action:versionPinningType",
2807
- value: "tag",
2808
- },
2809
- {
2810
- name: "cdx:github:action:isShaPinned",
2811
- value: "false",
2812
- },
2813
- {
2814
- name: "cdx:github:step:name",
2815
- value: "Test action 3",
2816
- },
2817
- {
2818
- name: "cdx:github:workflow:triggers",
2819
- value: "push,pull_request_target",
2820
- },
2821
2668
  ],
2822
- evidence: {
2823
- identity: {
2824
- field: "purl",
2825
- confidence: 0.7,
2826
- methods: [
2827
- {
2828
- technique: "source-code-analysis",
2829
- confidence: 0.7,
2830
- value: "./test/data/github-actions-tj.yaml",
2831
- },
2832
- ],
2833
- },
2834
- },
2835
2669
  },
2836
- {
2837
- group: "github/codeql-action",
2838
- name: "upload-sarif",
2839
- version: "3.30.3",
2840
- purl: "pkg:github/github/codeql-action/upload-sarif@3.30.3?commit=192325c86100d080feab897ff886c34abd4c83a3",
2841
- properties: [
2842
- {
2843
- name: "SrcFile",
2844
- value: "./test/data/github-actions-tj.yaml",
2845
- },
2846
- {
2847
- name: "cdx:github:workflow:name",
2848
- value: "Testing",
2849
- },
2850
- {
2851
- name: "cdx:github:job:name",
2852
- value: "vulnerable-actions",
2853
- },
2854
- {
2855
- name: "cdx:github:job:runner",
2856
- value: "ubuntu-latest",
2857
- },
2858
- {
2859
- name: "cdx:github:action:uses",
2860
- value:
2861
- "github/codeql-action/upload-sarif@192325c86100d080feab897ff886c34abd4c83a3",
2862
- },
2863
- {
2864
- name: "cdx:github:action:versionPinningType",
2865
- value: "sha",
2866
- },
2867
- {
2868
- name: "cdx:github:action:isShaPinned",
2869
- value: "true",
2870
- },
2871
- {
2872
- name: "cdx:github:step:name",
2873
- value: "Upload to code-scanning",
2874
- },
2875
- {
2876
- name: "cdx:actions:isOfficial",
2877
- value: "true",
2878
- },
2879
- {
2880
- name: "cdx:actions:isVerified",
2881
- value: "true",
2882
- },
2883
- {
2884
- name: "cdx:github:workflow:triggers",
2885
- value: "push,pull_request_target",
2886
- },
2887
- ],
2888
- evidence: {
2889
- identity: {
2890
- field: "purl",
2891
- confidence: 0.7,
2892
- methods: [
2893
- {
2894
- technique: "source-code-analysis",
2895
- confidence: 0.7,
2896
- value: "./test/data/github-actions-tj.yaml",
2897
- },
2898
- ],
2899
- },
2900
- },
2901
- },
2902
- ]);
2670
+ });
2671
+ dep_list = parseGitHubWorkflowData("./test/data/github-actions-tj.yaml");
2672
+ assert.deepStrictEqual(dep_list.length, 4);
2903
2673
  dep_list = parseGitHubWorkflowData("./.github/workflows/repotests.yml");
2904
- assert.deepStrictEqual(dep_list.length, 17);
2674
+ assert.deepStrictEqual(dep_list.length, 90);
2905
2675
  });
2906
2676
  // biome-ignore-end lint/suspicious/noTemplateCurlyInString: fp
2907
2677
 
@@ -4472,7 +4242,10 @@ it("pnpmMetadata with scoped packages", async () => {
4472
4242
  it("pnpmMetadata integration with parsePnpmLock", async () => {
4473
4243
  // Test that the integration works by parsing a real pnpm lock file
4474
4244
  const parsedList = await parsePnpmLock("./pnpm-lock.yaml");
4475
-
4245
+ const externalRefDistPackages = parsedList.pkgList.filter((pkg) =>
4246
+ pkg.externalReferences?.some((p) => p.type === "distribution"),
4247
+ );
4248
+ assert.ok(externalRefDistPackages.length > 0);
4476
4249
  // Check that some packages have been enhanced with LocalNodeModulesPath
4477
4250
  const enhancedPackages = parsedList.pkgList.filter((pkg) =>
4478
4251
  pkg.properties?.some((p) => p.name === "LocalNodeModulesPath"),
@@ -5694,6 +5467,33 @@ it("parseComposerLock", () => {
5694
5467
  ref: "pkg:composer/doctrine/annotations@v1.2.1",
5695
5468
  dependsOn: ["pkg:composer/doctrine/lexer@v1.0"],
5696
5469
  });
5470
+
5471
+ // Platform requirements (php, ext-*) must not appear in rootList
5472
+ const platformRootRequires = {
5473
+ php: "^7.1.3|^8",
5474
+ "ext-SimpleXML": "*",
5475
+ "ext-dom": "*",
5476
+ "amphp/amp": "^2.1",
5477
+ "amphp/byte-stream": "^1.5",
5478
+ };
5479
+ retMap = parseComposerLock(
5480
+ "./test/data/composer-2.lock",
5481
+ platformRootRequires,
5482
+ );
5483
+ assert.ok(
5484
+ !retMap.rootList.some((p) => p.name === "php"),
5485
+ "php must not be in rootList",
5486
+ );
5487
+ assert.ok(
5488
+ !retMap.rootList.some((p) => p.name?.startsWith("ext-")),
5489
+ "ext-* must not be in rootList",
5490
+ );
5491
+ // Regular packages that are in rootRequires should still be in rootList
5492
+ // Note: apkg.name is basename(pkg.name), so "amphp/amp" → name "amp"
5493
+ assert.ok(
5494
+ retMap.rootList.some((p) => p.name === "amp"),
5495
+ "amphp/amp should be in rootList",
5496
+ );
5697
5497
  });
5698
5498
 
5699
5499
  it("parseComposerJson", () => {
@@ -6367,6 +6167,18 @@ it("parse requirements.txt", async () => {
6367
6167
  ],
6368
6168
  },
6369
6169
  },
6170
+ hashes: [
6171
+ {
6172
+ alg: "SHA-256",
6173
+ content:
6174
+ "19297512c647d4b27a2cf7c34caa7e405c0d60b5560618a29a9fe027b18b0107",
6175
+ },
6176
+ {
6177
+ alg: "SHA-256",
6178
+ content:
6179
+ "84ec2218d8419404abcb9f0c02df3f34c6e0a68ed41072acfb1cef5cbc29051a",
6180
+ },
6181
+ ],
6370
6182
  properties: [
6371
6183
  {
6372
6184
  name: "SrcFile",
@@ -6398,6 +6210,13 @@ it("parse requirements.txt", async () => {
6398
6210
  value: "./test/data/requirements-lock.linux_py3.txt",
6399
6211
  },
6400
6212
  ],
6213
+ hashes: [
6214
+ {
6215
+ alg: "SHA-256",
6216
+ content:
6217
+ "fd17e5661f60634ddf96a569b95d34ccb8a98de60593d729c28bdcfe360eaad1",
6218
+ },
6219
+ ],
6401
6220
  evidence: {
6402
6221
  identity: {
6403
6222
  field: "purl",
@@ -6412,6 +6231,42 @@ it("parse requirements.txt", async () => {
6412
6231
  },
6413
6232
  },
6414
6233
  });
6234
+ assert.deepStrictEqual(deps[1], {
6235
+ name: "aenum",
6236
+ version: "3.1.0",
6237
+ scope: undefined,
6238
+ evidence: {
6239
+ identity: {
6240
+ field: "purl",
6241
+ confidence: 0.5,
6242
+ methods: [
6243
+ {
6244
+ technique: "manifest-analysis",
6245
+ confidence: 0.5,
6246
+ value: "./test/data/requirements-lock.linux_py3.txt",
6247
+ },
6248
+ ],
6249
+ },
6250
+ },
6251
+ hashes: [
6252
+ {
6253
+ alg: "SHA-256",
6254
+ content:
6255
+ "1f92fb906e3d745064e85f9a1937006ee341e00a35ecd8b7f899041b8e1d67d7",
6256
+ },
6257
+ {
6258
+ alg: "SHA-256",
6259
+ content:
6260
+ "f8401f1a258436719ed013444ab37ff22a72517e0e3097058dd1511cf284447c",
6261
+ },
6262
+ ],
6263
+ properties: [
6264
+ {
6265
+ name: "SrcFile",
6266
+ value: "./test/data/requirements-lock.linux_py3.txt",
6267
+ },
6268
+ ],
6269
+ });
6415
6270
  assert.deepStrictEqual(deps[deps.length - 1], {
6416
6271
  name: "zipp",
6417
6272
  scope: undefined,
@@ -6422,6 +6277,13 @@ it("parse requirements.txt", async () => {
6422
6277
  value: "./test/data/requirements-lock.linux_py3.txt",
6423
6278
  },
6424
6279
  ],
6280
+ hashes: [
6281
+ {
6282
+ alg: "SHA-256",
6283
+ content:
6284
+ "f06903e9f1f43b12d371004b4ac7b06ab39a44adc747266928ae6debfa7b3335",
6285
+ },
6286
+ ],
6425
6287
  evidence: {
6426
6288
  identity: {
6427
6289
  field: "purl",
@@ -6742,6 +6604,10 @@ it("parse wheel metadata", () => {
6742
6604
  },
6743
6605
  ],
6744
6606
  properties: [
6607
+ {
6608
+ name: "SrcFile",
6609
+ value: "./test/data/METADATA",
6610
+ },
6745
6611
  {
6746
6612
  name: "cdx:python:requires_python",
6747
6613
  value: ">=3.5.*",
@@ -6817,6 +6683,10 @@ it("parse wheel metadata", () => {
6817
6683
  },
6818
6684
  ],
6819
6685
  properties: [
6686
+ {
6687
+ name: "SrcFile",
6688
+ value: "./test/data/dist-info/METADATA1",
6689
+ },
6820
6690
  {
6821
6691
  name: "cdx:python:requires_python",
6822
6692
  value: ">=3.10",
@@ -6875,6 +6745,10 @@ it("parse wheel metadata", () => {
6875
6745
  },
6876
6746
  ],
6877
6747
  properties: [
6748
+ {
6749
+ name: "SrcFile",
6750
+ value: "./test/data/dist-info/METADATA2",
6751
+ },
6878
6752
  {
6879
6753
  name: "cdx:python:requires_python",
6880
6754
  value: ">=3.10",
@@ -6936,6 +6810,10 @@ it("parse wheel metadata", () => {
6936
6810
  },
6937
6811
  ],
6938
6812
  properties: [
6813
+ {
6814
+ name: "SrcFile",
6815
+ value: "./test/data/dist-info/METADATA3",
6816
+ },
6939
6817
  {
6940
6818
  name: "cdx:python:requires_python",
6941
6819
  value: ">=3.10",
@@ -6981,7 +6859,12 @@ it("parse wheel metadata", () => {
6981
6859
  url: "https://mercurial-scm.org/",
6982
6860
  },
6983
6861
  ],
6984
- properties: [],
6862
+ properties: [
6863
+ {
6864
+ name: "SrcFile",
6865
+ value: "./test/data/mercurial-5.5.2-py3.8.egg-info",
6866
+ },
6867
+ ],
6985
6868
  homepage: {
6986
6869
  url: "https://mercurial-scm.org/",
6987
6870
  },