@herodevs/cli 2.0.0-beta.11 → 2.0.0-beta.12
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 +16 -11
- package/dist/service/cdx.svc.d.ts +9 -1
- package/dist/service/cdx.svc.js +17 -12
- package/package.json +8 -9
- package/dist/service/sbom.worker.d.ts +0 -1
- package/dist/service/sbom.worker.js +0 -26
package/README.md
CHANGED
|
@@ -43,11 +43,11 @@ npm install -g @herodevs/cli@beta
|
|
|
43
43
|
HeroDevs CLI is available as a binary installation, without requiring `npm`. To do that, you may either download and run the script manually, or use the following cURL or Wget command:
|
|
44
44
|
|
|
45
45
|
```sh
|
|
46
|
-
curl -o- https://raw.githubusercontent.com/herodevs/cli/v2.0.0-beta.
|
|
46
|
+
curl -o- https://raw.githubusercontent.com/herodevs/cli/v2.0.0-beta.12/scripts/install.sh | bash
|
|
47
47
|
```
|
|
48
48
|
|
|
49
49
|
```sh
|
|
50
|
-
wget -qO- https://raw.githubusercontent.com/herodevs/cli/v2.0.0-beta.
|
|
50
|
+
wget -qO- https://raw.githubusercontent.com/herodevs/cli/v2.0.0-beta.12/scripts/install.sh | bash
|
|
51
51
|
```
|
|
52
52
|
|
|
53
53
|
## Scanning Behavior
|
|
@@ -209,6 +209,8 @@ You can use `@herodevs/cli` in your CI/CD pipelines to automate EOL scanning.
|
|
|
209
209
|
We provide a Docker image that's pre-configured to run EOL scans. Based on [`cdxgen`](https://github.com/CycloneDX/cdxgen),
|
|
210
210
|
it contains build tools for most project types and will provide best results when generating an SBOM. Use these templates to generate a report and save it to your CI job artifact for analysis and processing after your scan runs.
|
|
211
211
|
|
|
212
|
+
**Note:** There is a potential to run into permission issues writing out the report to your CI runner. Please ensure that your CI runner is setup to have proper read/write permissions for wherever your output files are being written to.
|
|
213
|
+
|
|
212
214
|
#### GitHub Actions
|
|
213
215
|
|
|
214
216
|
```yaml
|
|
@@ -227,20 +229,22 @@ jobs:
|
|
|
227
229
|
environment: demo
|
|
228
230
|
steps:
|
|
229
231
|
- name: Checkout repository
|
|
230
|
-
uses: actions/checkout@
|
|
232
|
+
uses: actions/checkout@v5
|
|
231
233
|
|
|
232
234
|
- name: Run EOL Scan
|
|
233
235
|
run: |
|
|
234
|
-
docker run --
|
|
236
|
+
docker run --name eol-scanner \
|
|
235
237
|
-v $GITHUB_WORKSPACE:/app \
|
|
236
238
|
-w /app \
|
|
237
|
-
ghcr.io/herodevs/eol-scan --save
|
|
239
|
+
ghcr.io/herodevs/eol-scan --save --output /tmp/herodevs.report.json
|
|
240
|
+
docker cp eol-scanner:/tmp/herodevs.report.json ${{ runner.temp }}/herodevs.report.json
|
|
241
|
+
docker rm eol-scanner
|
|
238
242
|
|
|
239
243
|
- name: Upload artifact
|
|
240
|
-
uses: actions/upload-artifact@
|
|
244
|
+
uses: actions/upload-artifact@v5
|
|
241
245
|
with:
|
|
242
246
|
name: my-eol-report
|
|
243
|
-
path:
|
|
247
|
+
path: ${{ runner.temp }}/herodevs.report.json
|
|
244
248
|
```
|
|
245
249
|
|
|
246
250
|
#### GitLab CI/CD
|
|
@@ -283,10 +287,11 @@ jobs:
|
|
|
283
287
|
scan:
|
|
284
288
|
runs-on: ubuntu-latest
|
|
285
289
|
steps:
|
|
286
|
-
- uses: actions/checkout@
|
|
287
|
-
|
|
290
|
+
- uses: actions/checkout@v5
|
|
291
|
+
|
|
292
|
+
- uses: actions/setup-node@v6
|
|
288
293
|
with:
|
|
289
|
-
node-version: '
|
|
294
|
+
node-version: '24'
|
|
290
295
|
|
|
291
296
|
- run: echo # Prepare environment, install tooling, perform setup, etc.
|
|
292
297
|
|
|
@@ -294,7 +299,7 @@ jobs:
|
|
|
294
299
|
run: npx @herodevs/cli@beta scan eol
|
|
295
300
|
|
|
296
301
|
- name: Upload artifact
|
|
297
|
-
uses: actions/upload-artifact@
|
|
302
|
+
uses: actions/upload-artifact@v5
|
|
298
303
|
with:
|
|
299
304
|
name: my-eol-report
|
|
300
305
|
path: herodevs.report.json
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { createBom } from '@cyclonedx/cdxgen';
|
|
2
|
+
import { postProcess } from '@cyclonedx/cdxgen/stages/postgen/postgen';
|
|
1
3
|
import type { CdxBom } from '@herodevs/eol-shared';
|
|
2
4
|
export declare const SBOM_DEFAULT__OPTIONS: {
|
|
3
5
|
$0: string;
|
|
@@ -61,4 +63,10 @@ export declare const SBOM_DEFAULT__OPTIONS: {
|
|
|
61
63
|
* Lazy loads cdxgen (for ESM purposes), scans
|
|
62
64
|
* `directory`, and returns the `bomJson` property.
|
|
63
65
|
*/
|
|
64
|
-
|
|
66
|
+
type CreateSbomDependencies = {
|
|
67
|
+
createBom: typeof createBom;
|
|
68
|
+
postProcess: typeof postProcess;
|
|
69
|
+
};
|
|
70
|
+
export declare function createSbomFactory({ createBom: createBomDependency, postProcess: postProcessDependency, }?: Partial<CreateSbomDependencies>): (directory: string) => Promise<CdxBom>;
|
|
71
|
+
export declare const createSbom: (directory: string) => Promise<CdxBom>;
|
|
72
|
+
export {};
|
package/dist/service/cdx.svc.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createBom } from '@cyclonedx/cdxgen';
|
|
2
|
+
import { postProcess } from '@cyclonedx/cdxgen/stages/postgen/postgen';
|
|
2
3
|
import { debugLogger } from "./log.svc.js";
|
|
3
4
|
const author = process.env.npm_package_author ?? 'HeroDevs, Inc.';
|
|
4
5
|
export const SBOM_DEFAULT__OPTIONS = {
|
|
@@ -24,8 +25,8 @@ export const SBOM_DEFAULT__OPTIONS = {
|
|
|
24
25
|
includeFormulation: false,
|
|
25
26
|
'no-install-deps': true,
|
|
26
27
|
noInstallDeps: true,
|
|
27
|
-
'min-confidence': 1,
|
|
28
|
-
minConfidence: 1,
|
|
28
|
+
'min-confidence': 0.1,
|
|
29
|
+
minConfidence: 0.1,
|
|
29
30
|
multiProject: true,
|
|
30
31
|
'no-banner': false,
|
|
31
32
|
noBabel: false,
|
|
@@ -62,14 +63,18 @@ export const SBOM_DEFAULT__OPTIONS = {
|
|
|
62
63
|
usagesSlicesFile: 'usages.slices.json',
|
|
63
64
|
validate: true,
|
|
64
65
|
};
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
66
|
+
export function createSbomFactory({ createBom: createBomDependency = createBom, postProcess: postProcessDependency = postProcess, } = {}) {
|
|
67
|
+
return async function createSbom(directory) {
|
|
68
|
+
const sbom = await createBomDependency(directory, SBOM_DEFAULT__OPTIONS);
|
|
69
|
+
if (!sbom) {
|
|
70
|
+
throw new Error('SBOM not generated');
|
|
71
|
+
}
|
|
72
|
+
const postProcessedSbom = postProcessDependency(sbom, SBOM_DEFAULT__OPTIONS);
|
|
73
|
+
if (!postProcessedSbom) {
|
|
74
|
+
throw new Error('SBOM not generated');
|
|
75
|
+
}
|
|
76
|
+
debugLogger('Successfully generated SBOM');
|
|
77
|
+
return postProcessedSbom.bomJson;
|
|
78
|
+
};
|
|
75
79
|
}
|
|
80
|
+
export const createSbom = createSbomFactory();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@herodevs/cli",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.12",
|
|
4
4
|
"author": "HeroDevs, Inc",
|
|
5
5
|
"bin": {
|
|
6
6
|
"hd": "./bin/run.js"
|
|
@@ -39,16 +39,15 @@
|
|
|
39
39
|
"herodevs cli"
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@amplitude/analytics-node": "^1.5.
|
|
42
|
+
"@amplitude/analytics-node": "^1.5.20",
|
|
43
43
|
"@apollo/client": "^3.13.8",
|
|
44
|
-
"@cyclonedx/cdxgen": "
|
|
44
|
+
"@cyclonedx/cdxgen": "^11.11.0",
|
|
45
45
|
"@herodevs/eol-shared": "github:herodevs/eol-shared#v0.1.11",
|
|
46
46
|
"@oclif/core": "^4.5.3",
|
|
47
47
|
"@oclif/plugin-help": "^6.2.32",
|
|
48
|
-
"@oclif/plugin-update": "^4.7.
|
|
49
|
-
"graphql": "^16.11.0",
|
|
48
|
+
"@oclif/plugin-update": "^4.7.13",
|
|
50
49
|
"node-machine-id": "^1.1.12",
|
|
51
|
-
"ora": "^
|
|
50
|
+
"ora": "^9.0.0",
|
|
52
51
|
"packageurl-js": "^2.0.1",
|
|
53
52
|
"terminal-link": "^5.0.0",
|
|
54
53
|
"update-notifier": "^7.3.1"
|
|
@@ -57,15 +56,15 @@
|
|
|
57
56
|
"@biomejs/biome": "^2.2.2",
|
|
58
57
|
"@oclif/test": "^4.1.13",
|
|
59
58
|
"@types/inquirer": "^9.0.9",
|
|
60
|
-
"@types/node": "^24.
|
|
59
|
+
"@types/node": "^24.9.2",
|
|
61
60
|
"@types/sinon": "^17.0.4",
|
|
62
61
|
"@types/update-notifier": "^6.0.8",
|
|
63
62
|
"globstar": "^1.0.0",
|
|
64
|
-
"oclif": "^4.22.
|
|
63
|
+
"oclif": "^4.22.38",
|
|
65
64
|
"shx": "^0.4.0",
|
|
66
65
|
"sinon": "^21.0.0",
|
|
67
66
|
"ts-node": "^10.9.2",
|
|
68
|
-
"tsx": "^4.20.
|
|
67
|
+
"tsx": "^4.20.6",
|
|
69
68
|
"typescript": "^5.9.3"
|
|
70
69
|
},
|
|
71
70
|
"engines": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { writeFileSync } from 'node:fs';
|
|
2
|
-
import { join } from 'node:path';
|
|
3
|
-
import { createBom } from '@cyclonedx/cdxgen';
|
|
4
|
-
import { filenamePrefix } from "../config/constants.js";
|
|
5
|
-
import { SBOM_DEFAULT__OPTIONS } from "./cdx.svc.js";
|
|
6
|
-
process.on('uncaughtException', (err) => {
|
|
7
|
-
console.error('Uncaught exception:', err.message);
|
|
8
|
-
process.exit(1);
|
|
9
|
-
});
|
|
10
|
-
process.on('unhandledRejection', (reason) => {
|
|
11
|
-
console.error('Unhandled rejection:', reason);
|
|
12
|
-
process.exit(1);
|
|
13
|
-
});
|
|
14
|
-
try {
|
|
15
|
-
console.log('Sbom worker started');
|
|
16
|
-
const options = JSON.parse(process.argv[2]);
|
|
17
|
-
const { path, opts } = options;
|
|
18
|
-
const { bomJson } = await createBom(path, { ...SBOM_DEFAULT__OPTIONS, ...opts });
|
|
19
|
-
const outputPath = join(path, `${filenamePrefix}.sbom.json`);
|
|
20
|
-
writeFileSync(outputPath, JSON.stringify(bomJson, null, 2));
|
|
21
|
-
process.exit(0);
|
|
22
|
-
}
|
|
23
|
-
catch (error) {
|
|
24
|
-
console.error('Error creating SBOM', error.message);
|
|
25
|
-
process.exit(1);
|
|
26
|
-
}
|