@trustify-da/trustify-da-javascript-client 0.3.0-ea.02983f2 → 0.3.0-ea.071e51e
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.
- package/README.md +379 -13
- package/dist/package.json +48 -28
- package/dist/src/analysis.d.ts +28 -5
- package/dist/src/analysis.js +99 -89
- package/dist/src/batch_opts.d.ts +24 -0
- package/dist/src/batch_opts.js +35 -0
- package/dist/src/cli.js +346 -9
- package/dist/src/cyclone_dx_sbom.d.ts +30 -3
- package/dist/src/cyclone_dx_sbom.js +95 -9
- package/dist/src/index.d.ts +202 -12
- package/dist/src/index.js +365 -30
- package/dist/src/license/index.d.ts +28 -0
- package/dist/src/license/index.js +103 -0
- package/dist/src/license/license_utils.d.ts +40 -0
- package/dist/src/license/license_utils.js +137 -0
- package/dist/src/license/licenses_api.d.ts +34 -0
- package/dist/src/license/licenses_api.js +98 -0
- package/dist/src/license/project_license.d.ts +20 -0
- package/dist/src/license/project_license.js +62 -0
- package/dist/src/oci_image/images.d.ts +4 -5
- package/dist/src/oci_image/images.js +15 -1
- package/dist/src/oci_image/utils.d.ts +7 -7
- package/dist/src/oci_image/utils.js +11 -2
- package/dist/src/package_version.d.ts +8 -0
- package/dist/src/package_version.js +31 -0
- package/dist/src/provider.d.ts +18 -5
- package/dist/src/provider.js +33 -5
- package/dist/src/providers/base_java.d.ts +68 -15
- package/dist/src/providers/base_java.js +82 -61
- package/dist/src/providers/base_javascript.d.ts +99 -12
- package/dist/src/providers/base_javascript.js +243 -27
- package/dist/src/providers/base_pyproject.d.ts +158 -0
- package/dist/src/providers/base_pyproject.js +322 -0
- package/dist/src/providers/containerfile_parser.d.ts +5 -0
- package/dist/src/providers/containerfile_parser.js +20 -0
- package/dist/src/providers/golang_gomodules.d.ts +30 -13
- package/dist/src/providers/golang_gomodules.js +219 -122
- package/dist/src/providers/gomod_parser.d.ts +4 -0
- package/dist/src/providers/gomod_parser.js +16 -0
- package/dist/src/providers/java_gradle.d.ts +76 -3
- package/dist/src/providers/java_gradle.js +323 -21
- package/dist/src/providers/java_gradle_groovy.d.ts +1 -1
- package/dist/src/providers/java_gradle_kotlin.d.ts +1 -1
- package/dist/src/providers/java_maven.d.ts +45 -10
- package/dist/src/providers/java_maven.js +300 -14
- package/dist/src/providers/javascript_bun.d.ts +22 -0
- package/dist/src/providers/javascript_bun.js +141 -0
- package/dist/src/providers/javascript_npm.d.ts +19 -0
- package/dist/src/providers/javascript_npm.js +61 -1
- package/dist/src/providers/javascript_pnpm.d.ts +14 -1
- package/dist/src/providers/javascript_pnpm.js +55 -5
- package/dist/src/providers/javascript_yarn.d.ts +12 -0
- package/dist/src/providers/javascript_yarn.js +75 -2
- package/dist/src/providers/manifest.d.ts +2 -0
- package/dist/src/providers/manifest.js +28 -7
- package/dist/src/providers/marker_evaluator.d.ts +14 -0
- package/dist/src/providers/marker_evaluator.js +191 -0
- package/dist/src/providers/oci_dockerfile.d.ts +51 -0
- package/dist/src/providers/oci_dockerfile.js +177 -0
- package/dist/src/providers/processors/yarn_berry_processor.d.ts +6 -2
- package/dist/src/providers/processors/yarn_berry_processor.js +91 -7
- package/dist/src/providers/processors/yarn_classic_processor.d.ts +6 -2
- package/dist/src/providers/processors/yarn_classic_processor.js +8 -6
- package/dist/src/providers/python_controller.d.ts +10 -3
- package/dist/src/providers/python_controller.js +122 -63
- package/dist/src/providers/python_pip.d.ts +16 -4
- package/dist/src/providers/python_pip.js +51 -58
- package/dist/src/providers/python_pip_pyproject.d.ts +61 -0
- package/dist/src/providers/python_pip_pyproject.js +146 -0
- package/dist/src/providers/python_poetry.d.ts +98 -0
- package/dist/src/providers/python_poetry.js +286 -0
- package/dist/src/providers/python_uv.d.ts +46 -0
- package/dist/src/providers/python_uv.js +269 -0
- package/dist/src/providers/requirements_parser.d.ts +6 -0
- package/dist/src/providers/requirements_parser.js +24 -0
- package/dist/src/providers/rust_cargo.d.ts +56 -0
- package/dist/src/providers/rust_cargo.js +682 -0
- package/dist/src/providers/tree-sitter-containerfile.wasm +0 -0
- package/dist/src/providers/tree-sitter-gomod.wasm +0 -0
- package/dist/src/providers/tree-sitter-requirements.wasm +0 -0
- package/dist/src/remediate.d.ts +21 -0
- package/dist/src/remediate.js +149 -0
- package/dist/src/remediation.d.ts +57 -0
- package/dist/src/remediation.js +436 -0
- package/dist/src/remediation_report.d.ts +40 -0
- package/dist/src/remediation_report.js +159 -0
- package/dist/src/sbom.d.ts +28 -2
- package/dist/src/sbom.js +26 -4
- package/dist/src/tools.d.ts +48 -6
- package/dist/src/tools.js +138 -2
- package/dist/src/updaters/maven_updater.d.ts +26 -0
- package/dist/src/updaters/maven_updater.js +322 -0
- package/dist/src/updaters/toml_updater.d.ts +33 -0
- package/dist/src/updaters/toml_updater.js +244 -0
- package/dist/src/workspace.d.ts +70 -0
- package/dist/src/workspace.js +256 -0
- package/package.json +49 -29
package/README.md
CHANGED
|
@@ -32,6 +32,11 @@ let stackAnalysis = await client.stackAnalysis('/path/to/pom.xml')
|
|
|
32
32
|
let stackAnalysisHtml = await client.stackAnalysis('/path/to/pom.xml', true)
|
|
33
33
|
// Get component analysis in JSON format
|
|
34
34
|
let componentAnalysis = await client.componentAnalysis('/path/to/pom.xml')
|
|
35
|
+
// For monorepos, pass workspace root so the client finds the lock file
|
|
36
|
+
let monorepoOpts = { workspaceDir: '/path/to/workspace-root' }
|
|
37
|
+
let stackAnalysisMonorepo = await client.stackAnalysis('/path/to/package.json', false, monorepoOpts)
|
|
38
|
+
// Batch analysis for entire workspace (Cargo or JS/TS); optional parallel SBOM generation
|
|
39
|
+
let batchReport = await client.stackAnalysisBatch('/path/to/workspace-root', false, { batchConcurrency: 10 })
|
|
35
40
|
// Get image analysis in JSON format
|
|
36
41
|
let imageAnalysis = await client.imageAnalysis(['docker.io/library/node:18'])
|
|
37
42
|
// Get image analysis in HTML format (string)
|
|
@@ -43,6 +48,21 @@ let imageAnalysisWithArch = await client.imageAnalysis(['httpd:2.4.49^^amd64'])
|
|
|
43
48
|
```
|
|
44
49
|
</li>
|
|
45
50
|
</ul>
|
|
51
|
+
|
|
52
|
+
<h3>License Detection</h3>
|
|
53
|
+
<p>
|
|
54
|
+
The client automatically detects your project's license with intelligent fallback:
|
|
55
|
+
</p>
|
|
56
|
+
<ul>
|
|
57
|
+
<li><strong>Manifest-first:</strong> For ecosystems with license support (Maven, JavaScript, Rust Cargo), reads from manifest file (<code>pom.xml</code>, <code>package.json</code>, <code>Cargo.toml</code>)</li>
|
|
58
|
+
<li><strong>LICENSE file fallback:</strong> If no license in manifest, or for ecosystems without license support (Gradle, Go, Python), automatically reads from <code>LICENSE</code>, <code>LICENSE.md</code>, or <code>LICENSE.txt</code></li>
|
|
59
|
+
<li><strong>SBOM integration:</strong> Detected licenses are included in generated SBOMs for all ecosystems</li>
|
|
60
|
+
<li><strong>SPDX support:</strong> Automatically detects common licenses (Apache-2.0, MIT, GPL, BSD) from LICENSE file content</li>
|
|
61
|
+
</ul>
|
|
62
|
+
<p>
|
|
63
|
+
See <a href="./docs/license-resolution-and-compliance.md">License Resolution and Compliance</a> for detailed documentation.
|
|
64
|
+
</p>
|
|
65
|
+
|
|
46
66
|
<ul>
|
|
47
67
|
<li>
|
|
48
68
|
Use as ESM Module from Common-JS module
|
|
@@ -83,12 +103,17 @@ Use as CLI Script
|
|
|
83
103
|
```shell
|
|
84
104
|
$ npx @trustify-da/trustify-da-javascript-client help
|
|
85
105
|
|
|
86
|
-
Usage: trustify-da-javascript-client {component|stack|image|validate-token}
|
|
106
|
+
Usage: trustify-da-javascript-client {component|stack|stack-batch|image|validate-token|license|sbom|remediate}
|
|
87
107
|
|
|
88
108
|
Commands:
|
|
89
|
-
trustify-da-javascript-client stack </path/to/manifest> [--html|--summary] produce stack report for manifest path
|
|
90
|
-
trustify-da-javascript-client
|
|
109
|
+
trustify-da-javascript-client stack </path/to/manifest> [--workspace-dir <path>] [--html|--summary] produce stack report for manifest path
|
|
110
|
+
trustify-da-javascript-client stack-batch </path/to/workspace-root> [--html|--summary] produce stack report for all packages/crates in workspace
|
|
111
|
+
trustify-da-javascript-client component <path/to/manifest> [--workspace-dir <path>] produce component report for a manifest type and content
|
|
91
112
|
trustify-da-javascript-client image <image-refs..> [--html|--summary] produce image analysis report for OCI image references
|
|
113
|
+
trustify-da-javascript-client validate-token <token-provider> [--token-value <value>] validate input token if authentic and authorized
|
|
114
|
+
trustify-da-javascript-client license </path/to/manifest> display project license information from manifest and LICENSE file in JSON format
|
|
115
|
+
trustify-da-javascript-client sbom </path/to/manifest> [--output <file>] generate a CycloneDX SBOM from a manifest file
|
|
116
|
+
trustify-da-javascript-client remediate <path> [--dry-run] [--providers <list>] [--sources <list>] [--group-by <strategy>] scan and apply vulnerability remediations
|
|
92
117
|
|
|
93
118
|
Options:
|
|
94
119
|
--help Show help [boolean]
|
|
@@ -105,9 +130,21 @@ $ npx @trustify-da/trustify-da-javascript-client stack /path/to/pom.xml --summar
|
|
|
105
130
|
# get stack analysis in html format format
|
|
106
131
|
$ npx @trustify-da/trustify-da-javascript-client stack /path/to/pom.xml --html
|
|
107
132
|
|
|
133
|
+
# get stack analysis for monorepo (lock file at workspace root)
|
|
134
|
+
$ npx @trustify-da/trustify-da-javascript-client stack /path/to/package.json --workspace-dir /path/to/workspace-root
|
|
135
|
+
|
|
108
136
|
# get component analysis
|
|
109
137
|
$ npx @trustify-da/trustify-da-javascript-client component /path/to/pom.xml
|
|
110
138
|
|
|
139
|
+
# get component analysis for monorepo
|
|
140
|
+
$ npx @trustify-da/trustify-da-javascript-client component /path/to/package.json -w /path/to/workspace-root
|
|
141
|
+
|
|
142
|
+
# batch stack analysis for entire workspace (Cargo or JS/TS)
|
|
143
|
+
$ npx @trustify-da/trustify-da-javascript-client stack-batch /path/to/workspace-root
|
|
144
|
+
|
|
145
|
+
# optional: extra discovery excludes (merged with defaults); repeat --ignore or use TRUSTIFY_DA_WORKSPACE_DISCOVERY_IGNORE
|
|
146
|
+
$ npx @trustify-da/trustify-da-javascript-client stack-batch /path/to/workspace-root --ignore '**/fixtures/**'
|
|
147
|
+
|
|
111
148
|
# get image analysis in json format
|
|
112
149
|
$ npx @trustify-da/trustify-da-javascript-client image docker.io/library/node:18
|
|
113
150
|
|
|
@@ -123,6 +160,30 @@ $ npx @trustify-da/trustify-da-javascript-client image docker.io/library/node:18
|
|
|
123
160
|
|
|
124
161
|
# specify architecture using ^^ notation (e.g., httpd:2.4.49^^amd64)
|
|
125
162
|
$ npx @trustify-da/trustify-da-javascript-client image httpd:2.4.49^^amd64
|
|
163
|
+
|
|
164
|
+
# get project license information
|
|
165
|
+
$ npx @trustify-da/trustify-da-javascript-client license /path/to/package.json
|
|
166
|
+
|
|
167
|
+
# generate a CycloneDX SBOM from a manifest file
|
|
168
|
+
$ npx @trustify-da/trustify-da-javascript-client sbom /path/to/pom.xml
|
|
169
|
+
|
|
170
|
+
# generate SBOM and write to a file
|
|
171
|
+
$ npx @trustify-da/trustify-da-javascript-client sbom /path/to/pom.xml --output sbom.json
|
|
172
|
+
|
|
173
|
+
# scan a manifest and apply vulnerability remediations
|
|
174
|
+
$ npx @trustify-da/trustify-da-javascript-client remediate /path/to/pom.xml
|
|
175
|
+
|
|
176
|
+
# preview remediations without modifying files
|
|
177
|
+
$ npx @trustify-da/trustify-da-javascript-client remediate /path/to/pom.xml --dry-run
|
|
178
|
+
|
|
179
|
+
# scan a directory for all supported manifests
|
|
180
|
+
$ npx @trustify-da/trustify-da-javascript-client remediate /path/to/project/
|
|
181
|
+
|
|
182
|
+
# filter by vulnerability providers (order determines priority)
|
|
183
|
+
$ npx @trustify-da/trustify-da-javascript-client remediate /path/to/pom.xml --providers provider1,provider2
|
|
184
|
+
|
|
185
|
+
# group report output by bundle instead of per-dependency
|
|
186
|
+
$ npx @trustify-da/trustify-da-javascript-client remediate /path/to/pom.xml --dry-run --group-by bundle
|
|
126
187
|
```
|
|
127
188
|
</li>
|
|
128
189
|
|
|
@@ -143,9 +204,21 @@ $ trustify-da-javascript-client stack /path/to/pom.xml --summary
|
|
|
143
204
|
# get stack analysis in html format format
|
|
144
205
|
$ trustify-da-javascript-client stack /path/to/pom.xml --html
|
|
145
206
|
|
|
207
|
+
# get stack analysis for monorepo (lock file at workspace root)
|
|
208
|
+
$ trustify-da-javascript-client stack /path/to/package.json --workspace-dir /path/to/workspace-root
|
|
209
|
+
|
|
146
210
|
# get component analysis
|
|
147
211
|
$ trustify-da-javascript-client component /path/to/pom.xml
|
|
148
212
|
|
|
213
|
+
# get component analysis for monorepo
|
|
214
|
+
$ trustify-da-javascript-client component /path/to/package.json -w /path/to/workspace-root
|
|
215
|
+
|
|
216
|
+
# batch stack analysis for entire workspace
|
|
217
|
+
$ trustify-da-javascript-client stack-batch /path/to/workspace-root
|
|
218
|
+
|
|
219
|
+
# with extra discovery excludes
|
|
220
|
+
$ trustify-da-javascript-client stack-batch /path/to/workspace-root -i '**/vendor/**'
|
|
221
|
+
|
|
149
222
|
# get image analysis in json format
|
|
150
223
|
$ trustify-da-javascript-client image docker.io/library/node:18
|
|
151
224
|
|
|
@@ -161,6 +234,30 @@ $ trustify-da-javascript-client image docker.io/library/node:18 docker.io/librar
|
|
|
161
234
|
|
|
162
235
|
# specify architecture using ^^ notation (e.g., httpd:2.4.49^^amd64)
|
|
163
236
|
$ trustify-da-javascript-client image httpd:2.4.49^^amd64
|
|
237
|
+
|
|
238
|
+
# get project license information
|
|
239
|
+
$ trustify-da-javascript-client license /path/to/package.json
|
|
240
|
+
|
|
241
|
+
# generate a CycloneDX SBOM from a manifest file
|
|
242
|
+
$ trustify-da-javascript-client sbom /path/to/pom.xml
|
|
243
|
+
|
|
244
|
+
# generate SBOM and write to a file
|
|
245
|
+
$ trustify-da-javascript-client sbom /path/to/pom.xml --output sbom.json
|
|
246
|
+
|
|
247
|
+
# scan a manifest and apply vulnerability remediations
|
|
248
|
+
$ trustify-da-javascript-client remediate /path/to/pom.xml
|
|
249
|
+
|
|
250
|
+
# preview remediations without modifying files
|
|
251
|
+
$ trustify-da-javascript-client remediate /path/to/pom.xml --dry-run
|
|
252
|
+
|
|
253
|
+
# scan a directory for all supported manifests
|
|
254
|
+
$ trustify-da-javascript-client remediate /path/to/project/
|
|
255
|
+
|
|
256
|
+
# filter by vulnerability providers (order determines priority)
|
|
257
|
+
$ trustify-da-javascript-client remediate /path/to/pom.xml --providers provider1,provider2
|
|
258
|
+
|
|
259
|
+
# group report output by bundle instead of per-dependency
|
|
260
|
+
$ trustify-da-javascript-client remediate /path/to/pom.xml --dry-run --group-by bundle
|
|
164
261
|
```
|
|
165
262
|
</li>
|
|
166
263
|
</ul>
|
|
@@ -172,9 +269,38 @@ $ trustify-da-javascript-client image httpd:2.4.49^^amd64
|
|
|
172
269
|
<li><a href="https://www.javascript.com/">JavaScript</a> - <a href="https://pnpm.io/">pnpm</a></li>
|
|
173
270
|
<li><a href="https://www.javascript.com/">JavaScript</a> - <a href="https://classic.yarnpkg.com/">Yarn Classic</a> / <a href="https://yarnpkg.com/">Yarn Berry</a></li>
|
|
174
271
|
<li><a href="https://go.dev/">Golang</a> - <a href="https://go.dev/blog/using-go-modules/">Go Modules</a></li>
|
|
175
|
-
<li><a href="https://www.python.org/">Python</a> - <a href="https://pypi.org/project/pip/">pip Installer</a
|
|
272
|
+
<li><a href="https://www.python.org/">Python</a> - <a href="https://pypi.org/project/pip/">pip Installer</a> (<code>requirements.txt</code>)</li>
|
|
273
|
+
<li><a href="https://www.python.org/">Python</a> - <a href="https://python-poetry.org/">Poetry</a> / <a href="https://docs.astral.sh/uv/">uv</a> (<code>pyproject.toml</code>)</li>
|
|
176
274
|
<li><a href="https://gradle.org/">Gradle (Groovy and Kotlin DSL)</a> - <a href="https://gradle.org/install/">Gradle Installation</a></li>
|
|
275
|
+
<li><a href="https://www.rust-lang.org/">Rust</a> - <a href="https://doc.rust-lang.org/cargo/">Cargo</a></li>
|
|
276
|
+
</ul>
|
|
277
|
+
|
|
278
|
+
<h3>Dockerfile Analysis Prerequisites</h3>
|
|
279
|
+
<p>
|
|
280
|
+
OCI image and <code>Dockerfile</code>/<code>Containerfile</code> analysis require the following external tools to be installed and available on your <code>PATH</code>:
|
|
281
|
+
</p>
|
|
282
|
+
<ul>
|
|
283
|
+
<li><a href="https://github.com/anchore/syft">Syft</a> — generates the image SBOM.</li>
|
|
284
|
+
<li><a href="https://github.com/containers/skopeo">skopeo</a> — resolves the image digest and manifest from the registry.</li>
|
|
177
285
|
</ul>
|
|
286
|
+
<p>
|
|
287
|
+
<strong>Dockerfile analysis is not supported on Windows</strong>, because <code>skopeo</code> provides no native Windows binary.
|
|
288
|
+
</p>
|
|
289
|
+
|
|
290
|
+
<h3>License Detection</h3>
|
|
291
|
+
<p>
|
|
292
|
+
The client automatically detects your project's license with intelligent fallback:
|
|
293
|
+
</p>
|
|
294
|
+
<ul>
|
|
295
|
+
<li><strong>Manifest-first:</strong> For ecosystems with license support (Maven, JavaScript, Rust Cargo), reads from manifest file (<code>pom.xml</code>, <code>package.json</code>, <code>Cargo.toml</code>)</li>
|
|
296
|
+
<li><strong>LICENSE file fallback:</strong> If no license in manifest, or for ecosystems without license support (Gradle, Go, Python), automatically reads from <code>LICENSE</code>, <code>LICENSE.md</code>, or <code>LICENSE.txt</code></li>
|
|
297
|
+
<li><strong>SBOM integration:</strong> Detected licenses are included in generated SBOMs for all ecosystems</li>
|
|
298
|
+
<li><strong>SPDX support:</strong> Automatically detects common licenses (Apache-2.0, MIT, GPL, BSD) from LICENSE file content</li>
|
|
299
|
+
</ul>
|
|
300
|
+
<p>
|
|
301
|
+
See <a href="./docs/license-resolution-and-compliance.md">License Resolution and Compliance</a> for detailed documentation.
|
|
302
|
+
</p>
|
|
303
|
+
|
|
178
304
|
|
|
179
305
|
<h3>Excluding Packages</h3>
|
|
180
306
|
<p>
|
|
@@ -219,8 +345,11 @@ Excluding a package from any analysis can be achieved by marking the package for
|
|
|
219
345
|
]
|
|
220
346
|
}
|
|
221
347
|
```
|
|
348
|
+
</li>
|
|
349
|
+
|
|
350
|
+
<li>
|
|
351
|
+
<em>Golang</em> users can add in go.mod a comment with <code>// exhortignore</code> next to the package to be ignored, or to "piggyback" on existing comment ( e.g - <code>// indirect</code>), for example:
|
|
222
352
|
|
|
223
|
-
<em>Golang</em> users can add in go.mod a comment with //exhortignore next to the package to be ignored, or to "piggyback" on existing comment ( e.g - //indirect) , for example:
|
|
224
353
|
```go
|
|
225
354
|
module github.com/trustify-da/SaaSi/deployer
|
|
226
355
|
|
|
@@ -229,7 +358,7 @@ go 1.19
|
|
|
229
358
|
require (
|
|
230
359
|
github.com/gin-gonic/gin v1.9.1
|
|
231
360
|
github.com/google/uuid v1.1.2
|
|
232
|
-
github.com/jessevdk/go-flags v1.5.0 //exhortignore
|
|
361
|
+
github.com/jessevdk/go-flags v1.5.0 // exhortignore
|
|
233
362
|
github.com/kr/pretty v0.3.1
|
|
234
363
|
gopkg.in/yaml.v2 v2.4.0
|
|
235
364
|
k8s.io/apimachinery v0.26.1
|
|
@@ -237,14 +366,20 @@ require (
|
|
|
237
366
|
)
|
|
238
367
|
|
|
239
368
|
require (
|
|
240
|
-
github.com/davecgh/go-spew v1.1.1 // indirect exhortignore
|
|
369
|
+
github.com/davecgh/go-spew v1.1.1 // indirect; exhortignore
|
|
241
370
|
github.com/emicklei/go-restful/v3 v3.9.0 // indirect
|
|
242
|
-
github.com/go-logr/logr v1.2.3 // indirect
|
|
371
|
+
github.com/go-logr/logr v1.2.3 // indirect; exhortignore
|
|
243
372
|
|
|
244
373
|
)
|
|
245
374
|
```
|
|
246
375
|
|
|
376
|
+
<b>NOTE</b>: It is important to format <code>exhortignore</code> markers on indirect dependencies as shown above, otherwise the Go tooling (as well as this library) may incorrectly parse dependencies marked as indirect as being direct dependencies instead.
|
|
377
|
+
</li>
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
<li>
|
|
247
381
|
<em>Python pip</em> users can add in requirements.txt a comment with #exhortignore(or # exhortignore) to the right of the same artifact to be ignored, for example:
|
|
382
|
+
|
|
248
383
|
```properties
|
|
249
384
|
anyio==3.6.2
|
|
250
385
|
asgiref==3.4.1
|
|
@@ -275,11 +410,14 @@ Werkzeug==2.0.3
|
|
|
275
410
|
zipp==3.6.0
|
|
276
411
|
|
|
277
412
|
```
|
|
413
|
+
</li>
|
|
278
414
|
|
|
415
|
+
<li>
|
|
279
416
|
<em>Gradle</em> users can add in build.gradle a comment with //exhortignore next to the package to be ignored:
|
|
417
|
+
|
|
280
418
|
```build.gradle
|
|
281
419
|
plugins {
|
|
282
|
-
id 'java'
|
|
420
|
+
id 'java'
|
|
283
421
|
}
|
|
284
422
|
|
|
285
423
|
group = 'groupName'
|
|
@@ -297,9 +435,45 @@ test {
|
|
|
297
435
|
}
|
|
298
436
|
```
|
|
299
437
|
|
|
300
|
-
|
|
301
|
-
|
|
438
|
+
<em>Rust Cargo</em> users can add a comment with <code># trustify-da-ignore</code> (or <code># exhortignore</code>) in <em>Cargo.toml</em> next to the dependency to be ignored. This works for inline declarations, table-based declarations, and workspace-level dependency sections:
|
|
439
|
+
|
|
440
|
+
```toml
|
|
441
|
+
[dependencies]
|
|
442
|
+
serde = "1.0" # trustify-da-ignore
|
|
443
|
+
tokio = { version = "1.35", features = ["full"] }
|
|
444
|
+
|
|
445
|
+
[dependencies.regex] # trustify-da-ignore
|
|
446
|
+
version = "1.10"
|
|
447
|
+
|
|
448
|
+
[workspace.dependencies]
|
|
449
|
+
log = "0.4" # trustify-da-ignore
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
|
|
453
|
+
<em>Python pyproject.toml</em> users can add a comment with <code>#exhortignore</code> (or <code># trustify-da-ignore</code>) next to the dependency in <code>pyproject.toml</code>.
|
|
454
|
+
|
|
455
|
+
PEP 621 style (<code>[project]</code> dependencies):
|
|
456
|
+
```toml
|
|
457
|
+
[project]
|
|
458
|
+
dependencies = [
|
|
459
|
+
"flask>=2.0.3",
|
|
460
|
+
"requests>=2.25.1",
|
|
461
|
+
"uvicorn>=0.17.0", #exhortignore
|
|
462
|
+
"click>=8.0.4", # trustify-da-ignore
|
|
463
|
+
]
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
Poetry style (<code>[tool.poetry.dependencies]</code>):
|
|
467
|
+
```toml
|
|
468
|
+
[tool.poetry.dependencies]
|
|
469
|
+
flask = "^2.0.3"
|
|
470
|
+
requests = "^2.25.1"
|
|
471
|
+
uvicorn = "^0.17.0" #exhortignore
|
|
472
|
+
click = "^8.0.4" # trustify-da-ignore
|
|
473
|
+
```
|
|
302
474
|
|
|
475
|
+
All of the above examples are valid for marking a package to be ignored
|
|
476
|
+
</li>
|
|
303
477
|
</ul>
|
|
304
478
|
|
|
305
479
|
<h3>Customization</h3>
|
|
@@ -328,7 +502,12 @@ let options = {
|
|
|
328
502
|
'TRUSTIFY_DA_PIP3_PATH' : '/path/to/pip3',
|
|
329
503
|
'TRUSTIFY_DA_PYTHON_PATH' : '/path/to/python',
|
|
330
504
|
'TRUSTIFY_DA_PIP_PATH' : '/path/to/pip',
|
|
505
|
+
'TRUSTIFY_DA_UV_PATH' : '/path/to/uv',
|
|
506
|
+
'TRUSTIFY_DA_POETRY_PATH' : '/path/to/poetry',
|
|
331
507
|
'TRUSTIFY_DA_GRADLE_PATH' : '/path/to/gradle',
|
|
508
|
+
'TRUSTIFY_DA_CARGO_PATH' : '/path/to/cargo',
|
|
509
|
+
// Workspace root for monorepos (Cargo, npm/pnpm/yarn); lock file expected here
|
|
510
|
+
'workspaceDir': '/path/to/workspace-root',
|
|
332
511
|
// Configure proxy for all requests
|
|
333
512
|
'TRUSTIFY_DA_PROXY_URL': 'http://proxy.example.com:8080'
|
|
334
513
|
}
|
|
@@ -351,6 +530,21 @@ let imageAnalysisWithArch = await client.imageAnalysis(['httpd:2.4.49^^amd64'],
|
|
|
351
530
|
**_Environment variables takes precedence._**
|
|
352
531
|
</p>
|
|
353
532
|
|
|
533
|
+
<h4>Monorepo / Workspace Support</h4>
|
|
534
|
+
<p>
|
|
535
|
+
For monorepos (Cargo workspaces, npm/pnpm/yarn workspaces) where the lock file lives at the workspace root rather than next to the manifest, pass the workspace root via <code>workspaceDir</code> or <code>TRUSTIFY_DA_WORKSPACE_DIR</code>:
|
|
536
|
+
</p>
|
|
537
|
+
<ul>
|
|
538
|
+
<li><strong>Cargo:</strong> When set, the client checks only the given directory for <code>Cargo.lock</code> instead of walking up from the manifest.</li>
|
|
539
|
+
<li><strong>JavaScript (npm, pnpm, yarn):</strong> When set, the client looks for the lock file (<code>package-lock.json</code>, <code>pnpm-lock.yaml</code>, <code>yarn.lock</code>) at the workspace root.</li>
|
|
540
|
+
</ul>
|
|
541
|
+
<p>
|
|
542
|
+
Use <code>stackAnalysisBatch(workspaceRoot, html, opts)</code> to analyze all packages/crates in a workspace in one request. Supports Cargo workspaces and JS/TS workspaces (pnpm, npm, yarn). Optional <code>batchConcurrency</code> (or <code>TRUSTIFY_DA_BATCH_CONCURRENCY</code>) limits parallel SBOM generation (default 10). For JS/TS, each <code>package.json</code> must have non-empty <code>name</code> and <code>version</code>; invalid manifests are skipped (warnings). Per-manifest SBOM failures are skipped if at least one SBOM succeeds (unless <code>continueOnError: false</code>). Set <code>batchMetadata: true</code> (or <code>TRUSTIFY_DA_BATCH_METADATA</code>) to receive <code>{ analysis, metadata }</code> with <code>errors[]</code>. CLI: <code>stack-batch --metadata</code>, <code>--fail-fast</code>. See <a href="./docs/monorepo-implementation-plan.md">monorepo implementation plan</a> §2.3 and §3.5.
|
|
543
|
+
</p>
|
|
544
|
+
<p>
|
|
545
|
+
See <a href="./docs/vscode-extension-integration-requirements.md">VS Code Extension Integration Requirements</a> for integration details.
|
|
546
|
+
</p>
|
|
547
|
+
|
|
354
548
|
<h4>Proxy Configuration</h4>
|
|
355
549
|
<p>
|
|
356
550
|
You can configure a proxy for all HTTP/HTTPS requests made by the API. This is useful when your environment requires going through a proxy to access external services.
|
|
@@ -372,6 +566,11 @@ const options = {
|
|
|
372
566
|
The proxy URL should be in the format: `http://host:port` or `https://host:port`. The API will automatically use the appropriate protocol (HTTP or HTTPS) based on the proxy URL provided.
|
|
373
567
|
</p>
|
|
374
568
|
|
|
569
|
+
<h4>License resolution and dependency license compliance</h4>
|
|
570
|
+
<p>
|
|
571
|
+
The client can resolve the <strong>project license</strong> from the manifest (e.g. <code>package.json</code> <code>license</code>, <code>pom.xml</code> <code><licenses></code>, <code>Cargo.toml</code> <code>license</code>) and from a <code>LICENSE</code> or <code>LICENSE.md</code> file in the project, and report when they differ. For <strong>component analysis</strong>, you can optionally run a license check: the client fetches dependency licenses from the backend (by purl) and reports dependencies whose licenses are incompatible with the project license. See <a href="docs/license-resolution-and-compliance.md">License resolution and compliance</a> for design and behavior. To disable the check on component analysis, set <code>TRUSTIFY_DA_LICENSE_CHECK=false</code> or pass <code>licenseCheck: false</code> in the options.
|
|
572
|
+
</p>
|
|
573
|
+
|
|
375
574
|
<h4>Customizing Executables</h4>
|
|
376
575
|
<p>
|
|
377
576
|
This project uses each ecosystem's executable for creating dependency trees. These executables are expected to be
|
|
@@ -445,6 +644,26 @@ following keys for setting custom paths for the said executables.
|
|
|
445
644
|
<td><em>gradle</em></td>
|
|
446
645
|
<td>TRUSTIFY_DA_PREFER_GRADLEW</td>
|
|
447
646
|
</tr>
|
|
647
|
+
<tr>
|
|
648
|
+
<td><a href="https://www.rust-lang.org/">Rust Cargo</a></td>
|
|
649
|
+
<td><em>cargo</em></td>
|
|
650
|
+
<td>TRUSTIFY_DA_CARGO_PATH</td>
|
|
651
|
+
</tr>
|
|
652
|
+
<tr>
|
|
653
|
+
<td><a href="https://docs.astral.sh/uv/">uv</a></td>
|
|
654
|
+
<td><em>uv</em></td>
|
|
655
|
+
<td>TRUSTIFY_DA_UV_PATH</td>
|
|
656
|
+
</tr>
|
|
657
|
+
<tr>
|
|
658
|
+
<td><a href="https://python-poetry.org/">Poetry</a></td>
|
|
659
|
+
<td><em>poetry</em></td>
|
|
660
|
+
<td>TRUSTIFY_DA_POETRY_PATH</td>
|
|
661
|
+
</tr>
|
|
662
|
+
<tr>
|
|
663
|
+
<td>Workspace root (monorepos)</td>
|
|
664
|
+
<td>—</td>
|
|
665
|
+
<td>workspaceDir / TRUSTIFY_DA_WORKSPACE_DIR</td>
|
|
666
|
+
</tr>
|
|
448
667
|
</table>
|
|
449
668
|
|
|
450
669
|
#### Match Manifest Versions Feature
|
|
@@ -493,6 +712,24 @@ TRUSTIFY_DA_GO_MVS_LOGIC_ENABLED=false
|
|
|
493
712
|
|
|
494
713
|
#### Python Support
|
|
495
714
|
|
|
715
|
+
The client supports two Python manifest formats:
|
|
716
|
+
|
|
717
|
+
- **`requirements.txt`** — uses pip/pip3 to resolve dependencies
|
|
718
|
+
- **`pyproject.toml`** — uses [uv](https://docs.astral.sh/uv/) or [Poetry](https://python-poetry.org/) to resolve dependencies
|
|
719
|
+
|
|
720
|
+
##### pyproject.toml
|
|
721
|
+
|
|
722
|
+
For `pyproject.toml` projects, the client detects which tool manages the project by checking for lock files:
|
|
723
|
+
- If `poetry.lock` is present and `[tool.poetry]` is defined, **Poetry** is used (`poetry show --tree` and `poetry show --all`)
|
|
724
|
+
- If `uv.lock` is present, **uv** is used (`uv export --format requirements.txt --frozen --no-hashes`)
|
|
725
|
+
- If neither lock file is found, an error is thrown
|
|
726
|
+
|
|
727
|
+
Both PEP 621 (`[project]` dependencies) and Poetry-style (`[tool.poetry.dependencies]`) are supported.
|
|
728
|
+
|
|
729
|
+
Custom executable paths can be set via `TRUSTIFY_DA_UV_PATH` and `TRUSTIFY_DA_POETRY_PATH`.
|
|
730
|
+
|
|
731
|
+
##### requirements.txt
|
|
732
|
+
|
|
496
733
|
By default, For python support, the api assumes that the package is installed using the pip/pip3 binary on the system PATH, or using the customized
|
|
497
734
|
Binaries passed to environment variables. In any case, If the package is not installed , then an error will be thrown.
|
|
498
735
|
|
|
@@ -508,14 +745,14 @@ This increasing the chances and the probability that the automatic installation
|
|
|
508
745
|
###### Usage
|
|
509
746
|
A New setting is introduced - `TRUSTIFY_DA_PYTHON_INSTALL_BEST_EFFORTS` (as both env variable/key in `options` object)
|
|
510
747
|
1. `TRUSTIFY_DA_PYTHON_INSTALL_BEST_EFFORTS`="false" - install requirements.txt while respecting declared versions for all packages.
|
|
511
|
-
2. `TRUSTIFY_DA_PYTHON_INSTALL_BEST_EFFORTS`="true" - install all packages from requirements.txt, not respecting the declared version, but trying to install a version tailored for the used python version. When using this setting, you must set
|
|
748
|
+
2. `TRUSTIFY_DA_PYTHON_INSTALL_BEST_EFFORTS`="true" - install all packages from requirements.txt, not respecting the declared version, but trying to install a version tailored for the used python version. When using this setting, you must set `TRUSTIFY_DA_PYTHON_VIRTUAL_ENV` to 'true' and `MATCH_MANIFEST_VERSIONS` to 'false'.
|
|
512
749
|
|
|
513
750
|
##### Using `pipdeptree`
|
|
514
751
|
By default, The API algorithm will use native commands of PIP installer as data source to build the dependency tree.
|
|
515
752
|
It's also possible to use the lightweight Python PIP utility [pipdeptree](https://pypi.org/project/pipdeptree/) as data source instead. In order to activate this, you need to set the environment variable/option `TRUSTIFY_DA_PIP_USE_DEP_TREE` to 'true'.
|
|
516
753
|
|
|
517
754
|
#### Toggle Red Hat Trusted Content recommendations
|
|
518
|
-
Both the HTML-based report and JSON response will by default contain recommendations for migrating to Red Hat-based Trusted Content repositories. This feature can be disabled by setting `
|
|
755
|
+
Both the HTML-based report and JSON response will by default contain recommendations for migrating to Red Hat-based Trusted Content repositories. This feature can be disabled by setting `TRUSTIFY_DA_RECOMMEND` to 'false' via environment variables or options.
|
|
519
756
|
|
|
520
757
|
#### Additional CLI arguments
|
|
521
758
|
For some ecosystems we support passing additional CLI arguments to the underlying tools. The following table outlines the supported ecosystems and the environment variable/option that configures this. Note that the arguments are expected to be in the format of a JSON array.
|
|
@@ -525,6 +762,135 @@ For some ecosystems we support passing additional CLI arguments to the underlyin
|
|
|
525
762
|
|Maven |TRUSTIFY_DA_MVN_ARGS|
|
|
526
763
|
|
|
527
764
|
|
|
765
|
+
<h3>Remediation</h3>
|
|
766
|
+
<p>
|
|
767
|
+
The <code>remediate</code> command scans manifest files for known vulnerabilities and applies version upgrades to resolve them. By default, it modifies manifest files in place. Use <code>--dry-run</code> to preview changes without modifying any files.
|
|
768
|
+
</p>
|
|
769
|
+
|
|
770
|
+
<h4>Supported Manifest Formats</h4>
|
|
771
|
+
<ul>
|
|
772
|
+
<li><strong>Maven</strong> — <code>pom.xml</code> (single-module projects; updates dependency version elements and resolves property references)</li>
|
|
773
|
+
<li><strong>Gradle Version Catalog</strong> — <code>libs.versions.toml</code> or any <code>*.versions.toml</code> file (updates centralized version references and inline version declarations)</li>
|
|
774
|
+
</ul>
|
|
775
|
+
|
|
776
|
+
<h4>CLI Flags</h4>
|
|
777
|
+
<table>
|
|
778
|
+
<tr>
|
|
779
|
+
<th>Flag</th>
|
|
780
|
+
<th>Alias</th>
|
|
781
|
+
<th>Type</th>
|
|
782
|
+
<th>Default</th>
|
|
783
|
+
<th>Description</th>
|
|
784
|
+
</tr>
|
|
785
|
+
<tr>
|
|
786
|
+
<td><code><path></code></td>
|
|
787
|
+
<td>—</td>
|
|
788
|
+
<td>string (positional)</td>
|
|
789
|
+
<td><em>required</em></td>
|
|
790
|
+
<td>Path to a manifest file or directory to scan recursively</td>
|
|
791
|
+
</tr>
|
|
792
|
+
<tr>
|
|
793
|
+
<td><code>--dry-run</code></td>
|
|
794
|
+
<td><code>-d</code></td>
|
|
795
|
+
<td>boolean</td>
|
|
796
|
+
<td><code>false</code></td>
|
|
797
|
+
<td>Preview changes without modifying files</td>
|
|
798
|
+
</tr>
|
|
799
|
+
<tr>
|
|
800
|
+
<td><code>--providers</code></td>
|
|
801
|
+
<td>—</td>
|
|
802
|
+
<td>string</td>
|
|
803
|
+
<td>—</td>
|
|
804
|
+
<td>Comma-separated list of vulnerability providers (env: <code>TRUSTIFY_DA_PROVIDERS</code>)</td>
|
|
805
|
+
</tr>
|
|
806
|
+
<tr>
|
|
807
|
+
<td><code>--sources</code></td>
|
|
808
|
+
<td>—</td>
|
|
809
|
+
<td>string</td>
|
|
810
|
+
<td>—</td>
|
|
811
|
+
<td>Comma-separated list of vulnerability sources (env: <code>TRUSTIFY_DA_SOURCES</code>)</td>
|
|
812
|
+
</tr>
|
|
813
|
+
<tr>
|
|
814
|
+
<td><code>--group-by</code></td>
|
|
815
|
+
<td>—</td>
|
|
816
|
+
<td>string</td>
|
|
817
|
+
<td><code>dependency</code></td>
|
|
818
|
+
<td>Report grouping strategy (<code>dependency</code> or <code>bundle</code>)</td>
|
|
819
|
+
</tr>
|
|
820
|
+
</table>
|
|
821
|
+
|
|
822
|
+
<h4>Provider Priority Resolution</h4>
|
|
823
|
+
<p>
|
|
824
|
+
When multiple vulnerability providers suggest different remediation versions for the same dependency, the <code>--providers</code> flag determines priority. Providers listed first have the highest priority.
|
|
825
|
+
</p>
|
|
826
|
+
<ul>
|
|
827
|
+
<li>The provider ordering in <code>--providers</code> determines rank (first = highest priority).</li>
|
|
828
|
+
<li>Trustify vendor trusted packages always take precedence over non-trusted content at equal provider rank.</li>
|
|
829
|
+
<li>Two version selection strategies are used internally:
|
|
830
|
+
<ul>
|
|
831
|
+
<li><strong>Closest coverage</strong> (default) — prefers the remediation version closest to the current version within the same major version.</li>
|
|
832
|
+
<li><strong>Highest</strong> — always selects the highest available remediation version.</li>
|
|
833
|
+
</ul>
|
|
834
|
+
</li>
|
|
835
|
+
</ul>
|
|
836
|
+
|
|
837
|
+
<h4>Exit Codes</h4>
|
|
838
|
+
<ul>
|
|
839
|
+
<li><code>0</code> — no remediations needed, or remediations applied successfully</li>
|
|
840
|
+
<li><code>1</code> — error during execution</li>
|
|
841
|
+
<li><code>2</code> — remediations available (only returned in <code>--dry-run</code> mode when changes would be made; never returned when changes are applied)</li>
|
|
842
|
+
</ul>
|
|
843
|
+
|
|
844
|
+
<h4>Known Limitations</h4>
|
|
845
|
+
<ul>
|
|
846
|
+
<li>Gradle DSL files (<code>build.gradle</code>, <code>build.gradle.kts</code>) are not supported — only version catalog files (<code>*.versions.toml</code>).</li>
|
|
847
|
+
<li>Multi-module Maven projects with inherited dependency versions from parent POMs are not supported — only versions declared directly in the scanned <code>pom.xml</code> are updated.</li>
|
|
848
|
+
</ul>
|
|
849
|
+
|
|
850
|
+
<h4>Example: GitHub Action Workflow</h4>
|
|
851
|
+
<p>
|
|
852
|
+
The following workflow runs a scheduled remediation scan using the container image and opens a pull request with any version updates. Save this as <code>.github/workflows/trustify-da-remediation.yml</code> in your repository:
|
|
853
|
+
</p>
|
|
854
|
+
|
|
855
|
+
```yaml
|
|
856
|
+
name: Trustify DA Remediation Scan
|
|
857
|
+
|
|
858
|
+
on:
|
|
859
|
+
schedule:
|
|
860
|
+
# Run weekly on Monday at 08:00 UTC
|
|
861
|
+
- cron: '0 8 * * 1'
|
|
862
|
+
workflow_dispatch:
|
|
863
|
+
|
|
864
|
+
permissions:
|
|
865
|
+
contents: write
|
|
866
|
+
pull-requests: write
|
|
867
|
+
|
|
868
|
+
jobs:
|
|
869
|
+
remediate:
|
|
870
|
+
runs-on: ubuntu-latest
|
|
871
|
+
steps:
|
|
872
|
+
- uses: actions/checkout@v4
|
|
873
|
+
|
|
874
|
+
- name: Run remediation scan
|
|
875
|
+
uses: docker://ghcr.io/guacsec/trustify-da-javascript-client:latest
|
|
876
|
+
env:
|
|
877
|
+
TRUSTIFY_DA_BACKEND_URL: ${{ secrets.TRUSTIFY_DA_BACKEND_URL }}
|
|
878
|
+
with:
|
|
879
|
+
entrypoint: trustify-da-javascript-client
|
|
880
|
+
args: remediate . --providers provider1,provider2
|
|
881
|
+
|
|
882
|
+
- name: Create pull request
|
|
883
|
+
uses: peter-evans/create-pull-request@v7
|
|
884
|
+
with:
|
|
885
|
+
title: 'fix(deps): apply Trustify DA vulnerability remediations'
|
|
886
|
+
body: |
|
|
887
|
+
Automated dependency version updates from Trustify Dependency Analytics.
|
|
888
|
+
|
|
889
|
+
This PR was generated by a scheduled remediation scan.
|
|
890
|
+
branch: trustify-da-remediation
|
|
891
|
+
commit-message: 'fix(deps): apply Trustify DA vulnerability remediations'
|
|
892
|
+
```
|
|
893
|
+
|
|
528
894
|
<!-- Badge links -->
|
|
529
895
|
[0]: https://img.shields.io/github/v/release/guacsec/trustify-da-javascript-client?color=green&label=latest
|
|
530
896
|
[1]: https://img.shields.io/github/v/release/guacsec/trustify-da-javascript-client?color=yellow&include_prereleases&label=early-access
|