@trustify-da/trustify-da-javascript-client 0.3.0-ea.ec6824b → 0.3.0-ea.efdc87d
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 +199 -11
- package/dist/package.json +15 -10
- package/dist/src/analysis.d.ts +47 -19
- package/dist/src/analysis.js +70 -18
- package/dist/src/cli.js +188 -6
- package/dist/src/config.d.ts +120 -0
- package/dist/src/config.js +260 -0
- package/dist/src/cyclone_dx_sbom.d.ts +13 -0
- package/dist/src/cyclone_dx_sbom.js +39 -1
- package/dist/src/index.d.ts +27 -22
- package/dist/src/index.js +27 -38
- package/dist/src/license/index.d.ts +2 -2
- package/dist/src/license/index.js +9 -6
- package/dist/src/license/licenses_api.d.ts +2 -2
- package/dist/src/license/licenses_api.js +1 -1
- package/dist/src/oci_image/images.js +15 -1
- package/dist/src/package_version.d.ts +8 -0
- package/dist/src/package_version.js +31 -0
- package/dist/src/provider.js +3 -1
- package/dist/src/providers/base_java.d.ts +53 -0
- package/dist/src/providers/base_java.js +64 -17
- package/dist/src/providers/base_javascript.d.ts +54 -0
- package/dist/src/providers/base_javascript.js +106 -4
- 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.js +49 -7
- package/dist/src/providers/java_gradle.d.ts +48 -0
- package/dist/src/providers/java_gradle.js +196 -18
- package/dist/src/providers/java_maven.d.ts +28 -8
- package/dist/src/providers/java_maven.js +104 -10
- package/dist/src/providers/javascript_bun.d.ts +12 -0
- package/dist/src/providers/javascript_bun.js +42 -1
- package/dist/src/providers/javascript_npm.d.ts +13 -0
- package/dist/src/providers/javascript_npm.js +40 -1
- package/dist/src/providers/javascript_pnpm.d.ts +13 -0
- package/dist/src/providers/javascript_pnpm.js +47 -1
- package/dist/src/providers/javascript_yarn.d.ts +12 -0
- package/dist/src/providers/javascript_yarn.js +75 -2
- package/dist/src/providers/manifest.js +6 -3
- 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 +5 -1
- package/dist/src/providers/processors/yarn_berry_processor.js +3 -2
- package/dist/src/providers/processors/yarn_classic_processor.d.ts +5 -1
- package/dist/src/providers/processors/yarn_classic_processor.js +8 -6
- package/dist/src/providers/python_controller.js +4 -1
- package/dist/src/providers/requirements_parser.js +1 -1
- package/dist/src/providers/rust_cargo.js +70 -29
- package/dist/src/providers/tree-sitter-containerfile.wasm +0 -0
- package/dist/src/remediate.d.ts +120 -0
- package/dist/src/remediate.js +253 -0
- package/dist/src/remediation.d.ts +58 -0
- package/dist/src/remediation.js +425 -0
- package/dist/src/remediation_report.d.ts +40 -0
- package/dist/src/remediation_report.js +159 -0
- package/dist/src/sbom.d.ts +11 -0
- package/dist/src/sbom.js +10 -0
- package/dist/src/tools.d.ts +9 -11
- package/dist/src/tools.js +34 -13
- package/dist/src/updaters/maven_updater.d.ts +58 -0
- package/dist/src/updaters/maven_updater.js +345 -0
- package/dist/src/updaters/toml_updater.d.ts +62 -0
- package/dist/src/updaters/toml_updater.js +276 -0
- package/dist/src/workspace.d.ts +2 -1
- package/dist/src/workspace.js +2 -1
- package/package.json +16 -11
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<h3>Usage</h3>
|
|
8
8
|
<p>
|
|
9
9
|
|
|
10
|
-
<strong>Prerequisites:</strong>
|
|
10
|
+
<strong>Prerequisites:</strong> Supply the Trustify Dependency Analytics backend URL through <code>options.TRUSTIFY_DA_BACKEND_URL</code> or the <code>TRUSTIFY_DA_BACKEND_URL</code> environment variable (see <a href="#customization">Customization</a>). Programmatic options take precedence over environment variables.
|
|
11
11
|
|
|
12
12
|
<ul>
|
|
13
13
|
<li>
|
|
@@ -103,14 +103,17 @@ Use as CLI Script
|
|
|
103
103
|
```shell
|
|
104
104
|
$ npx @trustify-da/trustify-da-javascript-client help
|
|
105
105
|
|
|
106
|
-
Usage: trustify-da-javascript-client {component|stack|image|validate-token|license}
|
|
106
|
+
Usage: trustify-da-javascript-client {component|stack|stack-batch|image|validate-token|license|sbom|remediate}
|
|
107
107
|
|
|
108
108
|
Commands:
|
|
109
109
|
trustify-da-javascript-client stack </path/to/manifest> [--workspace-dir <path>] [--html|--summary] produce stack report for manifest path
|
|
110
110
|
trustify-da-javascript-client stack-batch </path/to/workspace-root> [--html|--summary] produce stack report for all packages/crates in workspace
|
|
111
111
|
trustify-da-javascript-client component <path/to/manifest> [--workspace-dir <path>] produce component report for a manifest type and content
|
|
112
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
|
|
113
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
|
|
114
117
|
|
|
115
118
|
Options:
|
|
116
119
|
--help Show help [boolean]
|
|
@@ -160,6 +163,27 @@ $ npx @trustify-da/trustify-da-javascript-client image httpd:2.4.49^^amd64
|
|
|
160
163
|
|
|
161
164
|
# get project license information
|
|
162
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
|
|
163
187
|
```
|
|
164
188
|
</li>
|
|
165
189
|
|
|
@@ -213,6 +237,27 @@ $ trustify-da-javascript-client image httpd:2.4.49^^amd64
|
|
|
213
237
|
|
|
214
238
|
# get project license information
|
|
215
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
|
|
216
261
|
```
|
|
217
262
|
</li>
|
|
218
263
|
</ul>
|
|
@@ -230,6 +275,18 @@ $ trustify-da-javascript-client license /path/to/package.json
|
|
|
230
275
|
<li><a href="https://www.rust-lang.org/">Rust</a> - <a href="https://doc.rust-lang.org/cargo/">Cargo</a></li>
|
|
231
276
|
</ul>
|
|
232
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>
|
|
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
|
+
|
|
233
290
|
<h3>License Detection</h3>
|
|
234
291
|
<p>
|
|
235
292
|
The client automatically detects your project's license with intelligent fallback:
|
|
@@ -421,13 +478,13 @@ All of the above examples are valid for marking a package to be ignored
|
|
|
421
478
|
|
|
422
479
|
<h3>Customization</h3>
|
|
423
480
|
<p>
|
|
424
|
-
There are
|
|
481
|
+
There are two approaches for customizing <em>Trustify Dependency Analytics JavaScript Client</em>. Whether you're using this API as a
|
|
425
482
|
<em>Global Module</em>, a <em>Remote Script</em>, or an <em>ESM Module</em>, you can use <em>Environment Variables</em>
|
|
426
|
-
for various customization.
|
|
483
|
+
for various customization. <em>ESM Module</em> users can also pass programmatic options.
|
|
427
484
|
|
|
428
|
-
<strong>
|
|
485
|
+
<strong>Precedence:</strong> Programmatic options override environment variables, which override built-in defaults. A backend URL supplied through either <code>options.TRUSTIFY_DA_BACKEND_URL</code> or <code>TRUSTIFY_DA_BACKEND_URL</code> is mandatory.
|
|
429
486
|
|
|
430
|
-
|
|
487
|
+
Example programmatic customization:
|
|
431
488
|
|
|
432
489
|
```javascript
|
|
433
490
|
import client from '@trustify-da/trustify-da-javascript-client'
|
|
@@ -470,7 +527,7 @@ let imageAnalysisHtml = await client.imageAnalysis(['docker.io/library/node:18']
|
|
|
470
527
|
// Specify architecture using ^^ notation (e.g., httpd:2.4.49^^amd64)
|
|
471
528
|
let imageAnalysisWithArch = await client.imageAnalysis(['httpd:2.4.49^^amd64'], false, options)
|
|
472
529
|
```
|
|
473
|
-
**
|
|
530
|
+
**_Programmatic options take precedence over environment variables._**
|
|
474
531
|
</p>
|
|
475
532
|
|
|
476
533
|
<h4>Monorepo / Workspace Support</h4>
|
|
@@ -506,12 +563,14 @@ const options = {
|
|
|
506
563
|
}
|
|
507
564
|
```
|
|
508
565
|
|
|
566
|
+
When both are supplied, <code>options.TRUSTIFY_DA_PROXY_URL</code> takes precedence over the environment variable.
|
|
567
|
+
|
|
509
568
|
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.
|
|
510
569
|
</p>
|
|
511
570
|
|
|
512
571
|
<h4>License resolution and dependency license compliance</h4>
|
|
513
572
|
<p>
|
|
514
|
-
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.
|
|
573
|
+
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. An explicit <code>licenseCheck</code> option takes precedence over the environment variable.
|
|
515
574
|
</p>
|
|
516
575
|
|
|
517
576
|
<h4>Customizing Executables</h4>
|
|
@@ -619,7 +678,7 @@ can cause a confusion for the user in the client consuming the API and leads to
|
|
|
619
678
|
|
|
620
679
|
##### Usage
|
|
621
680
|
|
|
622
|
-
To eliminate confusion and improve clarity as discussed above, the following setting was introduced - `MATCH_MANIFEST_VERSIONS`, in the form of environment variable
|
|
681
|
+
To eliminate confusion and improve clarity as discussed above, the following setting was introduced - `MATCH_MANIFEST_VERSIONS`, in the form of an environment variable or key in opts. When both are supplied, the value in opts takes precedence.
|
|
623
682
|
for two ecosystems:
|
|
624
683
|
- Golang - Go Modules
|
|
625
684
|
- Python - pip
|
|
@@ -688,14 +747,14 @@ This increasing the chances and the probability that the automatic installation
|
|
|
688
747
|
###### Usage
|
|
689
748
|
A New setting is introduced - `TRUSTIFY_DA_PYTHON_INSTALL_BEST_EFFORTS` (as both env variable/key in `options` object)
|
|
690
749
|
1. `TRUSTIFY_DA_PYTHON_INSTALL_BEST_EFFORTS`="false" - install requirements.txt while respecting declared versions for all packages.
|
|
691
|
-
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
|
|
750
|
+
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'.
|
|
692
751
|
|
|
693
752
|
##### Using `pipdeptree`
|
|
694
753
|
By default, The API algorithm will use native commands of PIP installer as data source to build the dependency tree.
|
|
695
754
|
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'.
|
|
696
755
|
|
|
697
756
|
#### Toggle Red Hat Trusted Content recommendations
|
|
698
|
-
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 `
|
|
757
|
+
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.
|
|
699
758
|
|
|
700
759
|
#### Additional CLI arguments
|
|
701
760
|
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.
|
|
@@ -705,6 +764,135 @@ For some ecosystems we support passing additional CLI arguments to the underlyin
|
|
|
705
764
|
|Maven |TRUSTIFY_DA_MVN_ARGS|
|
|
706
765
|
|
|
707
766
|
|
|
767
|
+
<h3>Remediation</h3>
|
|
768
|
+
<p>
|
|
769
|
+
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.
|
|
770
|
+
</p>
|
|
771
|
+
|
|
772
|
+
<h4>Supported Manifest Formats</h4>
|
|
773
|
+
<ul>
|
|
774
|
+
<li><strong>Maven</strong> — <code>pom.xml</code> (single-module projects; updates dependency version elements and resolves property references)</li>
|
|
775
|
+
<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>
|
|
776
|
+
</ul>
|
|
777
|
+
|
|
778
|
+
<h4>CLI Flags</h4>
|
|
779
|
+
<table>
|
|
780
|
+
<tr>
|
|
781
|
+
<th>Flag</th>
|
|
782
|
+
<th>Alias</th>
|
|
783
|
+
<th>Type</th>
|
|
784
|
+
<th>Default</th>
|
|
785
|
+
<th>Description</th>
|
|
786
|
+
</tr>
|
|
787
|
+
<tr>
|
|
788
|
+
<td><code><path></code></td>
|
|
789
|
+
<td>—</td>
|
|
790
|
+
<td>string (positional)</td>
|
|
791
|
+
<td><em>required</em></td>
|
|
792
|
+
<td>Path to a manifest file or directory to scan recursively</td>
|
|
793
|
+
</tr>
|
|
794
|
+
<tr>
|
|
795
|
+
<td><code>--dry-run</code></td>
|
|
796
|
+
<td><code>-d</code></td>
|
|
797
|
+
<td>boolean</td>
|
|
798
|
+
<td><code>false</code></td>
|
|
799
|
+
<td>Preview changes without modifying files</td>
|
|
800
|
+
</tr>
|
|
801
|
+
<tr>
|
|
802
|
+
<td><code>--providers</code></td>
|
|
803
|
+
<td>—</td>
|
|
804
|
+
<td>string</td>
|
|
805
|
+
<td>—</td>
|
|
806
|
+
<td>Comma-separated list of vulnerability providers (env: <code>TRUSTIFY_DA_PROVIDERS</code>)</td>
|
|
807
|
+
</tr>
|
|
808
|
+
<tr>
|
|
809
|
+
<td><code>--sources</code></td>
|
|
810
|
+
<td>—</td>
|
|
811
|
+
<td>string</td>
|
|
812
|
+
<td>—</td>
|
|
813
|
+
<td>Comma-separated list of vulnerability sources (env: <code>TRUSTIFY_DA_SOURCES</code>)</td>
|
|
814
|
+
</tr>
|
|
815
|
+
<tr>
|
|
816
|
+
<td><code>--group-by</code></td>
|
|
817
|
+
<td>—</td>
|
|
818
|
+
<td>string</td>
|
|
819
|
+
<td><code>dependency</code></td>
|
|
820
|
+
<td>Report grouping strategy (<code>dependency</code> or <code>bundle</code>)</td>
|
|
821
|
+
</tr>
|
|
822
|
+
</table>
|
|
823
|
+
|
|
824
|
+
<h4>Provider Priority Resolution</h4>
|
|
825
|
+
<p>
|
|
826
|
+
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.
|
|
827
|
+
</p>
|
|
828
|
+
<ul>
|
|
829
|
+
<li>The provider ordering in <code>--providers</code> determines rank (first = highest priority).</li>
|
|
830
|
+
<li>Trustify vendor trusted packages always take precedence over non-trusted content at equal provider rank.</li>
|
|
831
|
+
<li>Two version selection strategies are used internally:
|
|
832
|
+
<ul>
|
|
833
|
+
<li><strong>Closest coverage</strong> (default) — prefers the remediation version closest to the current version within the same major version.</li>
|
|
834
|
+
<li><strong>Highest</strong> — always selects the highest available remediation version.</li>
|
|
835
|
+
</ul>
|
|
836
|
+
</li>
|
|
837
|
+
</ul>
|
|
838
|
+
|
|
839
|
+
<h4>Exit Codes</h4>
|
|
840
|
+
<ul>
|
|
841
|
+
<li><code>0</code> — no remediations needed, or remediations applied successfully</li>
|
|
842
|
+
<li><code>1</code> — error during execution</li>
|
|
843
|
+
<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>
|
|
844
|
+
</ul>
|
|
845
|
+
|
|
846
|
+
<h4>Known Limitations</h4>
|
|
847
|
+
<ul>
|
|
848
|
+
<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>
|
|
849
|
+
<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>
|
|
850
|
+
</ul>
|
|
851
|
+
|
|
852
|
+
<h4>Example: GitHub Action Workflow</h4>
|
|
853
|
+
<p>
|
|
854
|
+
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:
|
|
855
|
+
</p>
|
|
856
|
+
|
|
857
|
+
```yaml
|
|
858
|
+
name: Trustify DA Remediation Scan
|
|
859
|
+
|
|
860
|
+
on:
|
|
861
|
+
schedule:
|
|
862
|
+
# Run weekly on Monday at 08:00 UTC
|
|
863
|
+
- cron: '0 8 * * 1'
|
|
864
|
+
workflow_dispatch:
|
|
865
|
+
|
|
866
|
+
permissions:
|
|
867
|
+
contents: write
|
|
868
|
+
pull-requests: write
|
|
869
|
+
|
|
870
|
+
jobs:
|
|
871
|
+
remediate:
|
|
872
|
+
runs-on: ubuntu-latest
|
|
873
|
+
steps:
|
|
874
|
+
- uses: actions/checkout@v4
|
|
875
|
+
|
|
876
|
+
- name: Run remediation scan
|
|
877
|
+
uses: docker://ghcr.io/guacsec/trustify-da-javascript-client:latest
|
|
878
|
+
env:
|
|
879
|
+
TRUSTIFY_DA_BACKEND_URL: ${{ secrets.TRUSTIFY_DA_BACKEND_URL }}
|
|
880
|
+
with:
|
|
881
|
+
entrypoint: trustify-da-javascript-client
|
|
882
|
+
args: remediate . --providers provider1,provider2
|
|
883
|
+
|
|
884
|
+
- name: Create pull request
|
|
885
|
+
uses: peter-evans/create-pull-request@v7
|
|
886
|
+
with:
|
|
887
|
+
title: 'fix(deps): apply Trustify DA vulnerability remediations'
|
|
888
|
+
body: |
|
|
889
|
+
Automated dependency version updates from Trustify Dependency Analytics.
|
|
890
|
+
|
|
891
|
+
This PR was generated by a scheduled remediation scan.
|
|
892
|
+
branch: trustify-da-remediation
|
|
893
|
+
commit-message: 'fix(deps): apply Trustify DA vulnerability remediations'
|
|
894
|
+
```
|
|
895
|
+
|
|
708
896
|
<!-- Badge links -->
|
|
709
897
|
[0]: https://img.shields.io/github/v/release/guacsec/trustify-da-javascript-client?color=green&label=latest
|
|
710
898
|
[1]: https://img.shields.io/github/v/release/guacsec/trustify-da-javascript-client?color=yellow&include_prereleases&label=early-access
|
package/dist/package.json
CHANGED
|
@@ -25,7 +25,9 @@
|
|
|
25
25
|
"provenance": true
|
|
26
26
|
},
|
|
27
27
|
"type": "module",
|
|
28
|
-
"bin":
|
|
28
|
+
"bin": {
|
|
29
|
+
"trustify-da": "dist/src/cli.js"
|
|
30
|
+
},
|
|
29
31
|
"main": "dist/src/index.js",
|
|
30
32
|
"module": "dist/src/index.js",
|
|
31
33
|
"types": "dist/src/index.d.ts",
|
|
@@ -40,15 +42,14 @@
|
|
|
40
42
|
"test": "c8 npm run tests",
|
|
41
43
|
"tests": "mocha --config .mocharc.json",
|
|
42
44
|
"tests:rep": "mocha --reporter-option maxDiffSize=0 --reporter json > unit-tests-result.json",
|
|
43
|
-
"pretest": "cp node_modules/tree-sitter-requirements/tree-sitter-requirements.wasm src/providers/tree-sitter-requirements.wasm && cp node_modules/tree-sitter-gomod/tree-sitter-gomod.wasm src/providers/tree-sitter-gomod.wasm",
|
|
45
|
+
"pretest": "cp node_modules/tree-sitter-requirements/tree-sitter-requirements.wasm src/providers/tree-sitter-requirements.wasm && cp node_modules/tree-sitter-gomod/tree-sitter-gomod.wasm src/providers/tree-sitter-gomod.wasm && cp node_modules/tree-sitter-containerfile/tree-sitter-containerfile.wasm src/providers/tree-sitter-containerfile.wasm",
|
|
44
46
|
"precompile": "rm -rf dist",
|
|
45
47
|
"compile": "tsc -p tsconfig.json",
|
|
46
48
|
"compile:dev": "tsc -p tsconfig.dev.json",
|
|
47
|
-
"postcompile": "cp node_modules/tree-sitter-requirements/tree-sitter-requirements.wasm dist/src/providers/tree-sitter-requirements.wasm && cp node_modules/tree-sitter-gomod/tree-sitter-gomod.wasm dist/src/providers/tree-sitter-gomod.wasm"
|
|
49
|
+
"postcompile": "cp node_modules/tree-sitter-requirements/tree-sitter-requirements.wasm dist/src/providers/tree-sitter-requirements.wasm && cp node_modules/tree-sitter-gomod/tree-sitter-gomod.wasm dist/src/providers/tree-sitter-gomod.wasm && cp node_modules/tree-sitter-containerfile/tree-sitter-containerfile.wasm dist/src/providers/tree-sitter-containerfile.wasm"
|
|
48
50
|
},
|
|
49
51
|
"dependencies": {
|
|
50
|
-
"@
|
|
51
|
-
"@cyclonedx/cyclonedx-library": "^10.0.0",
|
|
52
|
+
"@yarnpkg/parsers": "^3.1.0",
|
|
52
53
|
"eslint-import-resolver-typescript": "^4.4.4",
|
|
53
54
|
"fast-glob": "^3.3.3",
|
|
54
55
|
"fast-xml-parser": "^5.3.4",
|
|
@@ -61,25 +62,26 @@
|
|
|
61
62
|
"p-limit": "^7.3.0",
|
|
62
63
|
"packageurl-js": "~1.0.2",
|
|
63
64
|
"smol-toml": "^1.6.0",
|
|
65
|
+
"tree-sitter-containerfile": "^0.8.1",
|
|
64
66
|
"tree-sitter-gomod": "github:strum355/tree-sitter-go-mod#56326f2ad478892ace58ff247a97d492a3cbcdda",
|
|
65
67
|
"tree-sitter-requirements": "github:Strum355/tree-sitter-requirements#d0261ee76b84253997fe70d7d397e78c006c3801",
|
|
66
68
|
"web-tree-sitter": "^0.26.7",
|
|
67
69
|
"yargs": "^18.0.0"
|
|
68
70
|
},
|
|
69
71
|
"devDependencies": {
|
|
70
|
-
"@
|
|
71
|
-
"@
|
|
72
|
+
"@cyclonedx/cyclonedx-library": "^10.2.0",
|
|
73
|
+
"@eslint/js": "^10.0.0",
|
|
74
|
+
"@trustify-da/trustify-da-api-model": "^2.0.12",
|
|
72
75
|
"@types/node": "^25.9.1",
|
|
73
76
|
"@types/which": "^3.0.4",
|
|
74
|
-
"
|
|
77
|
+
"ajv": "^8.20.0",
|
|
75
78
|
"c8": "^11.0.0",
|
|
76
79
|
"chai": "^6.2.2",
|
|
77
|
-
"@eslint/js": "^10.0.0",
|
|
78
80
|
"eslint": "^10.4.1",
|
|
79
81
|
"eslint-import-resolver-typescript": "^4.4.4",
|
|
80
82
|
"eslint-plugin-import-x": "^4.16.2",
|
|
81
|
-
"globals": "^17.6.0",
|
|
82
83
|
"esmock": "^2.6.2",
|
|
84
|
+
"globals": "^17.6.0",
|
|
83
85
|
"mocha": "^11.7.6",
|
|
84
86
|
"msw": "^2.12.7",
|
|
85
87
|
"sinon": "^22.0.0",
|
|
@@ -117,6 +119,9 @@
|
|
|
117
119
|
"text"
|
|
118
120
|
]
|
|
119
121
|
},
|
|
122
|
+
"overrides": {
|
|
123
|
+
"tree-sitter": "0.22.4"
|
|
124
|
+
},
|
|
120
125
|
"resolutions": {
|
|
121
126
|
"@hapi/joi": "17.1.1"
|
|
122
127
|
}
|
package/dist/src/analysis.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ declare namespace _default {
|
|
|
6
6
|
export { requestStackBatch };
|
|
7
7
|
export { requestImages };
|
|
8
8
|
export { validateToken };
|
|
9
|
+
export { appendAnalysisQueryParams };
|
|
9
10
|
}
|
|
10
11
|
export default _default;
|
|
11
12
|
/**
|
|
@@ -14,41 +15,62 @@ export default _default;
|
|
|
14
15
|
* @param {string} manifest - path for the manifest
|
|
15
16
|
* @param {string} url - the backend url to send the request to
|
|
16
17
|
* @param {import("index.js").Options} [opts={}] - optional various options to pass along the application
|
|
17
|
-
* @returns {Promise<import('@trustify-da/trustify-da-api-model/model/v5/AnalysisReport').AnalysisReport>}
|
|
18
|
+
* @returns {Promise<import('@trustify-da/trustify-da-api-model/model/v5/AnalysisReport.ts').AnalysisReport>}
|
|
18
19
|
*/
|
|
19
|
-
declare function requestComponent(provider: any, manifest: string, url: string, opts?: any): Promise<
|
|
20
|
+
declare function requestComponent(provider: any, manifest: string, url: string, opts?: any): Promise<import("@trustify-da/trustify-da-api-model/model/v5/AnalysisReport.ts").AnalysisReport>;
|
|
20
21
|
/**
|
|
21
|
-
*
|
|
22
|
-
* @param {import('./provider').Provider} provider
|
|
23
|
-
* @param {string} manifest
|
|
24
|
-
* @param {string} url
|
|
25
|
-
* @param {
|
|
26
|
-
* @param {import("index.js").Options} [opts={}]
|
|
27
|
-
* @returns {Promise<string
|
|
22
|
+
* @overload
|
|
23
|
+
* @param {import('./provider').Provider} provider
|
|
24
|
+
* @param {string} manifest
|
|
25
|
+
* @param {string} url
|
|
26
|
+
* @param {true} [html]
|
|
27
|
+
* @param {import("index.js").Options} [opts={}]
|
|
28
|
+
* @returns {Promise<string>}
|
|
28
29
|
*/
|
|
29
|
-
declare function requestStack(provider: any, manifest: string, url: string, html?:
|
|
30
|
+
declare function requestStack(provider: any, manifest: string, url: string, html?: true | undefined, opts?: any): Promise<string>;
|
|
30
31
|
/**
|
|
31
|
-
*
|
|
32
|
-
* @param {
|
|
33
|
-
* @param {string}
|
|
34
|
-
* @param {
|
|
32
|
+
* @overload
|
|
33
|
+
* @param {import('./provider').Provider} provider
|
|
34
|
+
* @param {string} manifest
|
|
35
|
+
* @param {string} url
|
|
36
|
+
* @param {false} [html]
|
|
35
37
|
* @param {import("index.js").Options} [opts={}]
|
|
36
|
-
* @returns {Promise<
|
|
38
|
+
* @returns {Promise<import('@trustify-da/trustify-da-api-model/model/v5/AnalysisReport.ts').AnalysisReport>>}
|
|
39
|
+
*/
|
|
40
|
+
declare function requestStack(provider: any, manifest: string, url: string, html?: false | undefined, opts?: any): Promise<import("@trustify-da/trustify-da-api-model/model/v5/AnalysisReport.ts").AnalysisReport>;
|
|
41
|
+
/**
|
|
42
|
+
* @overload
|
|
43
|
+
* @param {Object.<string, object>} sbomByPurl
|
|
44
|
+
* @param {string} url
|
|
45
|
+
* @param {true} [html=false]
|
|
46
|
+
* @param {import("index.js").Options} [opts={}]
|
|
47
|
+
* @returns {Promise<string>}
|
|
37
48
|
*/
|
|
38
49
|
declare function requestStackBatch(sbomByPurl: {
|
|
39
50
|
[x: string]: object;
|
|
40
|
-
}, url: string, html?:
|
|
41
|
-
|
|
51
|
+
}, url: string, html?: true | undefined, opts?: any): Promise<string>;
|
|
52
|
+
/**
|
|
53
|
+
* @overload
|
|
54
|
+
* @param {Object.<string, object>} sbomByPurl
|
|
55
|
+
* @param {string} url
|
|
56
|
+
* @param {false} [html=false]
|
|
57
|
+
* @param {import("index.js").Options} [opts={}]
|
|
58
|
+
* @returns {Promise<Object.<string, import('@trustify-da/trustify-da-api-model/model/v5/AnalysisReport.ts').AnalysisReport>>}
|
|
59
|
+
*/
|
|
60
|
+
declare function requestStackBatch(sbomByPurl: {
|
|
61
|
+
[x: string]: object;
|
|
62
|
+
}, url: string, html?: false | undefined, opts?: any): Promise<{
|
|
63
|
+
[x: string]: import("@trustify-da/trustify-da-api-model/model/v5/AnalysisReport.ts").AnalysisReport;
|
|
42
64
|
}>;
|
|
43
65
|
/**
|
|
44
66
|
*
|
|
45
67
|
* @param {Array<string>} imageRefs
|
|
46
68
|
* @param {string} url
|
|
47
69
|
* @param {import("index.js").Options} [opts={}] - optional various options to pass along the application
|
|
48
|
-
* @returns {Promise<string|Object.<string, import('@trustify-da/trustify-da-api-model/model/v5/AnalysisReport').AnalysisReport>>}
|
|
70
|
+
* @returns {Promise<string|Object.<string, import('@trustify-da/trustify-da-api-model/model/v5/AnalysisReport.ts').AnalysisReport>>}
|
|
49
71
|
*/
|
|
50
72
|
declare function requestImages(imageRefs: Array<string>, url: string, html?: boolean, opts?: any): Promise<string | {
|
|
51
|
-
[x: string]:
|
|
73
|
+
[x: string]: import("@trustify-da/trustify-da-api-model/model/v5/AnalysisReport.ts").AnalysisReport;
|
|
52
74
|
}>;
|
|
53
75
|
/**
|
|
54
76
|
*
|
|
@@ -57,3 +79,9 @@ declare function requestImages(imageRefs: Array<string>, url: string, html?: boo
|
|
|
57
79
|
* @return {Promise<number>} return the HTTP status Code of the response from the validate token request.
|
|
58
80
|
*/
|
|
59
81
|
declare function validateToken(url: any, opts?: any): Promise<number>;
|
|
82
|
+
/**
|
|
83
|
+
* Append common analysis query parameters (recommend, providers, sources) to a URL.
|
|
84
|
+
* @param {URL} url - the URL object to append query parameters to
|
|
85
|
+
* @param {import("index.js").Options} [opts={}] - options containing parameter overrides
|
|
86
|
+
*/
|
|
87
|
+
declare function appendAnalysisQueryParams(url: URL, opts?: any): void;
|