@cyclonedx/cdxgen 11.0.10 → 11.1.1

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 (37) hide show
  1. package/README.md +16 -1
  2. package/bin/cdxgen.js +5 -6
  3. package/bin/evinse.js +1 -0
  4. package/bin/repl.js +3 -2
  5. package/data/README.md +2 -1
  6. package/data/component-tags.json +0 -1
  7. package/data/frameworks-list.json +11 -1
  8. package/data/ruby-known-modules.json +281 -0
  9. package/lib/cli/index.js +460 -108
  10. package/lib/evinser/evinser.js +154 -20
  11. package/lib/evinser/swiftsem.js +1 -1
  12. package/lib/helpers/envcontext.js +467 -10
  13. package/lib/helpers/protobom.test.js +3 -3
  14. package/lib/helpers/utils.js +953 -105
  15. package/lib/helpers/utils.test.js +307 -11
  16. package/lib/helpers/validator.js +68 -4
  17. package/lib/managers/binary.js +24 -18
  18. package/lib/managers/docker.js +4 -9
  19. package/lib/managers/piptree.js +2 -2
  20. package/lib/server/server.js +3 -2
  21. package/lib/stages/postgen/postgen.js +10 -3
  22. package/lib/stages/pregen/pregen.js +332 -58
  23. package/package.json +2 -2
  24. package/types/lib/cli/index.d.ts.map +1 -1
  25. package/types/lib/helpers/envcontext.d.ts +54 -0
  26. package/types/lib/helpers/envcontext.d.ts.map +1 -1
  27. package/types/lib/helpers/utils.d.ts +48 -6
  28. package/types/lib/helpers/utils.d.ts.map +1 -1
  29. package/types/lib/helpers/validator.d.ts +6 -0
  30. package/types/lib/helpers/validator.d.ts.map +1 -1
  31. package/types/lib/managers/binary.d.ts.map +1 -1
  32. package/types/lib/managers/docker.d.ts.map +1 -1
  33. package/types/lib/server/server.d.ts.map +1 -1
  34. package/types/lib/stages/postgen/postgen.d.ts +1 -0
  35. package/types/lib/stages/postgen/postgen.d.ts.map +1 -1
  36. package/types/lib/stages/pregen/pregen.d.ts +7 -0
  37. package/types/lib/stages/pregen/pregen.d.ts.map +1 -1
package/README.md CHANGED
@@ -64,6 +64,12 @@ If you are a [Homebrew][homebrew-homepage] user, you can also install [cdxgen][h
64
64
  $ brew install cdxgen
65
65
  ```
66
66
 
67
+ If you are a [Winget][winget-homepage] user on windows, you can also install cdxgen via:
68
+
69
+ ```shell
70
+ $ winget install cdxgen
71
+ ```
72
+
67
73
  Deno and bun runtime can be used with limited support.
68
74
 
69
75
  ```shell
@@ -456,7 +462,9 @@ Use the [CycloneDX CLI][cyclonedx-cli-github] tool for advanced use cases such a
456
462
 
457
463
  ## Including .NET Global Assembly Cache dependencies in the results
458
464
 
459
- Global Assembly Cache (GAC) dependencies must be made available in the build output of the project for cdxgen in order for it to inspect and include in the results. A cdxgen scan with the `--deep` flag will look for additional dependencies in the form of dll files. A simple way to have the dotnet build copy the GAC dependencies into the build directory is to place the file `Directory.Build.props` into the root of the project and ensure the contents include the following:
465
+ For `dotnet` and `dotnet-framework`, SBOM could include components without a version number. Often, these components begin with the prefix `System.`.
466
+
467
+ Global Assembly Cache (GAC) dependencies (System Runtime dependencies) must be made available in the build output of the project for version detection. A simple way to have the dotnet build copy the GAC dependencies into the build directory is to place the file `Directory.Build.props` into the root of the project and ensure the contents include the following:
460
468
 
461
469
  ```
462
470
  <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
@@ -468,6 +476,8 @@ Global Assembly Cache (GAC) dependencies must be made available in the build out
468
476
  </Project>
469
477
  ```
470
478
 
479
+ Then, run cdxgen cli with the `--deep` argument.
480
+
471
481
  ## License
472
482
 
473
483
  Permission to modify and redistribute is granted under the terms of the Apache 2.0 license. See the [LICENSE][github-license] file for the full license.
@@ -509,6 +519,10 @@ pnpm run lint
509
519
  pnpm test
510
520
  ```
511
521
 
522
+ ## Sponsors
523
+
524
+ <img src="./docs/_media/LevoLogo-LightBg.jpg" width="200" height="auto">
525
+
512
526
  <!-- LINK LABELS -->
513
527
  <!-- Badges -->
514
528
 
@@ -548,6 +562,7 @@ pnpm test
548
562
  [github-rate-limit]: https://docs.github.com/en/rest/overview/rate-limits-for-the-rest-api#primary-rate-limit-for-github_token-in-github-actions
549
563
  [homebrew-homepage]: https://brew.sh
550
564
  [homebrew-cdxgen]: https://formulae.brew.sh/formula/cdxgen
565
+ [winget-homepage]: https://learn.microsoft.com/en-us/windows/package-manager/winget/
551
566
  [jsr-cdxgen]: https://jsr.io/@cyclonedx/cdxgen
552
567
  [jwt-homepage]: https://jwt.io
553
568
  [jwt-libraries]: https://jwt.io/libraries
package/bin/cdxgen.js CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  import crypto from "node:crypto";
4
4
  import fs from "node:fs";
5
- import { tmpdir } from "node:os";
6
5
  import { basename, dirname, join, resolve } from "node:path";
7
6
  import process from "node:process";
8
7
  import { URL } from "node:url";
@@ -22,7 +21,7 @@ import {
22
21
  printSummary,
23
22
  printTable,
24
23
  } from "../lib/helpers/display.js";
25
- import { ATOM_DB, dirNameStr } from "../lib/helpers/utils.js";
24
+ import { ATOM_DB, dirNameStr, getTmpDir } from "../lib/helpers/utils.js";
26
25
  import { validateBom } from "../lib/helpers/validator.js";
27
26
  import { postProcess } from "../lib/stages/postgen/postgen.js";
28
27
  import { prepareEnv } from "../lib/stages/pregen/pregen.js";
@@ -168,6 +167,7 @@ const args = yargs(hideBin(process.argv))
168
167
  })
169
168
  .option("install-deps", {
170
169
  type: "boolean",
170
+ default: true,
171
171
  description:
172
172
  "Install dependencies automatically for some projects. Defaults to true but disabled for containers and oci scans. Use --no-install-deps to disable this feature.",
173
173
  })
@@ -296,7 +296,7 @@ const args = yargs(hideBin(process.argv))
296
296
  .option("feature-flags", {
297
297
  description: "Experimental feature flags to enable. Advanced users only.",
298
298
  hidden: true,
299
- choices: ["safe-pip-install", "suggest-build-tools"],
299
+ choices: ["safe-pip-install", "suggest-build-tools", "ruby-docker-install"],
300
300
  })
301
301
  .option("min-confidence", {
302
302
  description:
@@ -507,7 +507,6 @@ const applyAdvancedOptions = (options) => {
507
507
  options.installDeps = true;
508
508
  break;
509
509
  default:
510
- options.installDeps = true;
511
510
  break;
512
511
  }
513
512
  // When the user specifies source-code-analysis as a technique, then enable deep and evidence mode.
@@ -541,9 +540,9 @@ const checkPermissions = (filePath) => {
541
540
  );
542
541
  return false;
543
542
  }
544
- if (!process.permission.has("fs.write", tmpdir())) {
543
+ if (!process.permission.has("fs.write", getTmpDir())) {
545
544
  console.log(
546
- `FileSystemWrite permission required. Please invoke with the argument --allow-fs-write="${tmpdir()}"`,
545
+ `FileSystemWrite permission required. Please invoke with the argument --allow-fs-write="${getTmpDir()}"`,
547
546
  );
548
547
  return false;
549
548
  }
package/bin/evinse.js CHANGED
@@ -72,6 +72,7 @@ const args = yargs(hideBin(process.argv))
72
72
  "php",
73
73
  "swift",
74
74
  "ios",
75
+ "ruby",
75
76
  ],
76
77
  })
77
78
  .option("db-path", {
package/bin/repl.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import fs from "node:fs";
4
- import { homedir, tmpdir } from "node:os";
4
+ import { homedir } from "node:os";
5
5
  import { join } from "node:path";
6
6
  import process from "node:process";
7
7
  import repl from "node:repl";
@@ -19,6 +19,7 @@ import {
19
19
  printTable,
20
20
  printVulnerabilities,
21
21
  } from "../lib/helpers/display.js";
22
+ import { getTmpDir } from "../lib/helpers/utils.js";
22
23
  import { validateBom } from "../lib/helpers/validator.js";
23
24
 
24
25
  const options = {
@@ -107,7 +108,7 @@ cdxgenRepl.defineCommand("create", {
107
108
  help: "create an SBOM for the given path",
108
109
  async action(sbomOrPath) {
109
110
  this.clearBufferedCommand();
110
- const tempDir = fs.mkdtempSync(join(tmpdir(), "cdxgen-repl-"));
111
+ const tempDir = fs.mkdtempSync(join(getTmpDir(), "cdxgen-repl-"));
111
112
  const bomFile = join(tempDir, "bom.json");
112
113
  const bomNSData = await createBom(sbomOrPath, {
113
114
  multiProject: true,
package/data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  Contents of data directory and their purpose.
4
4
 
5
5
  | Filename | Purpose |
6
- | --------------------- | -------------------------------------------------------------------------------------------------------- |
6
+ | --------------------- |----------------------------------------------------------------------------------------------------------|
7
7
  | bom-1.4.schema.json | CycloneDX 1.4 jsonschema for validation |
8
8
  | bom-1.5.schema.json | CycloneDX 1.5 jsonschema for validation |
9
9
  | cosdb-queries.json | osquery useful for identifying OS packages for C |
@@ -24,3 +24,4 @@ Contents of data directory and their purpose.
24
24
  | crypto-oid.json | Peter Gutmann's crypto oid [mapping](https://www.cs.auckland.ac.nz/~pgut001). GPL, BSD, or CC BY license |
25
25
  | glibc-stdlib.json | Standard libraries that can be filtered out in C++ |
26
26
  | component-tags.json | List of tags to extract from component description text for easy classification. |
27
+ | ruby-known-modules.json | Module names for certain known gems. Example: rails |
@@ -125,7 +125,6 @@
125
125
  "properties": {
126
126
  "all": [
127
127
  "sql",
128
- "http",
129
128
  "xml",
130
129
  "cloud",
131
130
  "middleware",
@@ -191,6 +191,16 @@
191
191
  "pkg:composer/roducks",
192
192
  "pkg:composer/queryphp",
193
193
  "pkg:composer/silex",
194
- "pkg:composer/psr"
194
+ "pkg:composer/psr",
195
+ "pkg:gem/rails",
196
+ "pkg:gem/sinatra",
197
+ "pkg:gem/hanami",
198
+ "pkg:gem/padrino",
199
+ "pkg:gem/cuba",
200
+ "pkg:gem/grape",
201
+ "pkg:gem/volt",
202
+ "pkg:gem/trailblazer",
203
+ "pkg:gem/ramaze",
204
+ "pkg:gem/scorched"
195
205
  ]
196
206
  }
@@ -0,0 +1,281 @@
1
+ {
2
+ "abstractcontroller": [
3
+ "AbstractController",
4
+ "AbstractController::Caching",
5
+ "AbstractController::Callbacks",
6
+ "AbstractController::Collector",
7
+ "AbstractController::Helpers",
8
+ "AbstractController::Railties",
9
+ "AbstractController::Rendering",
10
+ "AbstractController::Translation",
11
+ "AbstractController::UrlFor"
12
+ ],
13
+ "actioncable": [
14
+ "ActionCable",
15
+ "ActionCable::Channel",
16
+ "ActionCable::Connection",
17
+ "ActionCable::Helpers",
18
+ "ActionCable::Server",
19
+ "ActionCable::SubscriptionAdapter",
20
+ "ActionCable::TestHelper",
21
+ "ActionCable::VERSION"
22
+ ],
23
+ "actioncontroller": [
24
+ "ActionController",
25
+ "ActionController::AllowBrowser",
26
+ "ActionController::ApiRendering",
27
+ "ActionController::Caching",
28
+ "ActionController::ConditionalGet",
29
+ "ActionController::ContentSecurityPolicy",
30
+ "ActionController::Cookies",
31
+ "ActionController::DataStreaming",
32
+ "ActionController::DefaultHeaders",
33
+ "ActionController::EtagWithFlash",
34
+ "ActionController::EtagWithTemplateDigest",
35
+ "ActionController::Flash",
36
+ "ActionController::FormBuilder",
37
+ "ActionController::Head",
38
+ "ActionController::Helpers",
39
+ "ActionController::HttpAuthentication",
40
+ "ActionController::ImplicitRender",
41
+ "ActionController::Instrumentation",
42
+ "ActionController::Live",
43
+ "ActionController::Logging",
44
+ "ActionController::MimeResponds",
45
+ "ActionController::ParameterEncoding",
46
+ "ActionController::ParamsWrapper",
47
+ "ActionController::PermissionsPolicy",
48
+ "ActionController::Railties",
49
+ "ActionController::RateLimiting",
50
+ "ActionController::Redirecting",
51
+ "ActionController::Renderers",
52
+ "ActionController::Rendering",
53
+ "ActionController::RequestForgeryProtection",
54
+ "ActionController::Rescue",
55
+ "ActionController::Streaming",
56
+ "ActionController::StrongParameters",
57
+ "ActionController::Testing",
58
+ "ActionController::UrlFor"
59
+ ],
60
+ "actiondispatch": [
61
+ "ActionDispatch",
62
+ "ActionDispatch::Assertions",
63
+ "ActionDispatch::Constants",
64
+ "ActionDispatch::Http",
65
+ "ActionDispatch::Integration",
66
+ "ActionDispatch::Journey",
67
+ "ActionDispatch::RequestCookieMethods",
68
+ "ActionDispatch::Routing",
69
+ "ActionDispatch::Session",
70
+ "ActionDispatch::SystemTesting",
71
+ "ActionDispatch::TestHelpers",
72
+ "ActionDispatch::TestProcess"
73
+ ],
74
+ "actionmailbox": [
75
+ "ActionMailbox",
76
+ "ActionMailbox::Callbacks",
77
+ "ActionMailbox::Ingresses",
78
+ "ActionMailbox::Routing",
79
+ "ActionMailbox::TestHelper",
80
+ "ActionMailbox::VERSION"
81
+ ],
82
+ "actionmailer": [
83
+ "ActionMailer",
84
+ "ActionMailer::Callbacks",
85
+ "ActionMailer::DeliveryMethods",
86
+ "ActionMailer::FormBuilder",
87
+ "ActionMailer::MailHelper",
88
+ "ActionMailer::Parameterized",
89
+ "ActionMailer::Previews",
90
+ "ActionMailer::QueuedDelivery",
91
+ "ActionMailer::Rescuable",
92
+ "ActionMailer::TestHelper",
93
+ "ActionMailer::VERSION"
94
+ ],
95
+ "actionpack": ["ActionPack"],
96
+ "actiontext": [
97
+ "ActionText",
98
+ "ActionText::Attachable",
99
+ "ActionText::Attachables",
100
+ "ActionText::Attachments",
101
+ "ActionText::Attribute",
102
+ "ActionText::ContentHelper",
103
+ "ActionText::Encryption",
104
+ "ActionText::HtmlConversion",
105
+ "ActionText::PlainTextConversion",
106
+ "ActionText::Serialization",
107
+ "ActionText::SystemTestHelper",
108
+ "ActionText::TagHelper",
109
+ "ActionText::VERSION"
110
+ ],
111
+ "actionview": [
112
+ "ActionView",
113
+ "ActionView::CacheExpiry",
114
+ "ActionView::Context",
115
+ "ActionView::Helpers",
116
+ "ActionView::Layouts",
117
+ "ActionView::RecordIdentifier",
118
+ "ActionView::RenderParser",
119
+ "ActionView::Rendering",
120
+ "ActionView::RoutingUrlFor",
121
+ "ActionView::VERSION",
122
+ "ActionView::ViewPaths"
123
+ ],
124
+ "activejob": [
125
+ "ActiveJob",
126
+ "ActiveJob::Arguments",
127
+ "ActiveJob::Callbacks",
128
+ "ActiveJob::Core",
129
+ "ActiveJob::Enqueuing",
130
+ "ActiveJob::Exceptions",
131
+ "ActiveJob::Execution",
132
+ "ActiveJob::Logging",
133
+ "ActiveJob::QueueAdapter",
134
+ "ActiveJob::QueueAdapters",
135
+ "ActiveJob::QueueName",
136
+ "ActiveJob::QueuePriority",
137
+ "ActiveJob::Serializers",
138
+ "ActiveJob::TestHelper",
139
+ "ActiveJob::VERSION"
140
+ ],
141
+ "activemodel": [
142
+ "ActiveModel",
143
+ "ActiveModel::API",
144
+ "ActiveModel::AttributeAssignment",
145
+ "ActiveModel::AttributeMethods",
146
+ "ActiveModel::Attributes",
147
+ "ActiveModel::Callbacks",
148
+ "ActiveModel::Conversion",
149
+ "ActiveModel::Dirty",
150
+ "ActiveModel::Lint",
151
+ "ActiveModel::Model",
152
+ "ActiveModel::Naming",
153
+ "ActiveModel::SecurePassword",
154
+ "ActiveModel::Serialization",
155
+ "ActiveModel::Serializers",
156
+ "ActiveModel::Translation",
157
+ "ActiveModel::Type",
158
+ "ActiveModel::VERSION",
159
+ "ActiveModel::Validations"
160
+ ],
161
+ "activerecord": [
162
+ "ActiveRecord",
163
+ "ActiveRecord::Aggregations",
164
+ "ActiveRecord::Assertions",
165
+ "ActiveRecord::Associations",
166
+ "ActiveRecord::AttributeAssignment",
167
+ "ActiveRecord::AttributeMethods",
168
+ "ActiveRecord::Attributes",
169
+ "ActiveRecord::AutosaveAssociation",
170
+ "ActiveRecord::Batches",
171
+ "ActiveRecord::Calculations",
172
+ "ActiveRecord::Callbacks",
173
+ "ActiveRecord::Coders",
174
+ "ActiveRecord::ConnectionAdapters",
175
+ "ActiveRecord::ConnectionHandling",
176
+ "ActiveRecord::Core",
177
+ "ActiveRecord::CounterCache",
178
+ "ActiveRecord::DelegatedType",
179
+ "ActiveRecord::DynamicMatchers",
180
+ "ActiveRecord::Encryption",
181
+ "ActiveRecord::Enum",
182
+ "ActiveRecord::Explain",
183
+ "ActiveRecord::FinderMethods",
184
+ "ActiveRecord::Inheritance",
185
+ "ActiveRecord::Integration",
186
+ "ActiveRecord::Locking",
187
+ "ActiveRecord::Marshalling",
188
+ "ActiveRecord::MessagePack",
189
+ "ActiveRecord::Middleware",
190
+ "ActiveRecord::ModelSchema",
191
+ "ActiveRecord::NestedAttributes",
192
+ "ActiveRecord::NoTouching",
193
+ "ActiveRecord::Normalization",
194
+ "ActiveRecord::Persistence",
195
+ "ActiveRecord::QueryLogs",
196
+ "ActiveRecord::QueryMethods",
197
+ "ActiveRecord::Querying",
198
+ "ActiveRecord::ReadonlyAttributes",
199
+ "ActiveRecord::Reflection",
200
+ "ActiveRecord::Sanitization",
201
+ "ActiveRecord::Scoping",
202
+ "ActiveRecord::SecurePassword",
203
+ "ActiveRecord::SecureToken",
204
+ "ActiveRecord::Serialization",
205
+ "ActiveRecord::SignedId",
206
+ "ActiveRecord::SpawnMethods",
207
+ "ActiveRecord::Store",
208
+ "ActiveRecord::Suppressor",
209
+ "ActiveRecord::Tasks",
210
+ "ActiveRecord::TestFixtures",
211
+ "ActiveRecord::Timestamp",
212
+ "ActiveRecord::TokenFor",
213
+ "ActiveRecord::Transactions",
214
+ "ActiveRecord::Translation",
215
+ "ActiveRecord::Type",
216
+ "ActiveRecord::VERSION",
217
+ "ActiveRecord::Validations"
218
+ ],
219
+ "activestorage": [
220
+ "ActiveStorage",
221
+ "ActiveStorage::Blobs",
222
+ "ActiveStorage::DisableSession",
223
+ "ActiveStorage::Reflection",
224
+ "ActiveStorage::Representations",
225
+ "ActiveStorage::SetCurrent",
226
+ "ActiveStorage::Streaming",
227
+ "ActiveStorage::Transformers",
228
+ "ActiveStorage::VERSION"
229
+ ],
230
+ "activesupport": [
231
+ "ActiveSupport",
232
+ "ActiveSupport::ActionableError",
233
+ "ActiveSupport::Autoload",
234
+ "ActiveSupport::Benchmarkable",
235
+ "ActiveSupport::Cache",
236
+ "ActiveSupport::Callbacks",
237
+ "ActiveSupport::CompareWithRange",
238
+ "ActiveSupport::Concern",
239
+ "ActiveSupport::Concurrency",
240
+ "ActiveSupport::Configurable",
241
+ "ActiveSupport::CoreExt",
242
+ "ActiveSupport::Dependencies",
243
+ "ActiveSupport::DescendantsTracker",
244
+ "ActiveSupport::EnumerableCoreExt",
245
+ "ActiveSupport::ForkTracker",
246
+ "ActiveSupport::Gzip",
247
+ "ActiveSupport::Inflector",
248
+ "ActiveSupport::JSON",
249
+ "ActiveSupport::LazyLoadHooks",
250
+ "ActiveSupport::LoggerSilence",
251
+ "ActiveSupport::MessagePack",
252
+ "ActiveSupport::Messages",
253
+ "ActiveSupport::Multibyte",
254
+ "ActiveSupport::Notifications",
255
+ "ActiveSupport::NumberHelper",
256
+ "ActiveSupport::NumericWithFormat",
257
+ "ActiveSupport::RaiseWarnings",
258
+ "ActiveSupport::RangeWithFormat",
259
+ "ActiveSupport::Rescuable",
260
+ "ActiveSupport::SecurityUtils",
261
+ "ActiveSupport::TaggedLogging",
262
+ "ActiveSupport::Testing",
263
+ "ActiveSupport::VERSION",
264
+ "ActiveSupport::XmlMini",
265
+ "ActiveSupport::XmlMini_LibXMLSAX",
266
+ "ActiveSupport::XmlMini_NokogiriSAX"
267
+ ],
268
+ "mail": ["Mail"],
269
+ "mime": ["Mime"],
270
+ "minitest": ["Minitest"],
271
+ "rails": ["Rails"],
272
+ "railties": ["Railtie"],
273
+ "mini_portile2": ["MiniPortile"],
274
+ "rubocop": ["RuboCop"],
275
+ "rubyzip": ["Zip"],
276
+ "solid_cable": ["SolidCable"],
277
+ "solid_cache": ["SolidCache"],
278
+ "solid_queue": ["SolidQueue"],
279
+ "globalid": ["GlobalID"],
280
+ "tzinfo": ["TZInfo"]
281
+ }