Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@
!/src/commands/raw-npx/
!/src/commands/repository/
!/src/commands/scan/
!/src/commands/scan/gitlab-dependency-report.mts
!/src/commands/scan/gitlab-dependency-report.test.mts
!/src/commands/threat-feed/
!/src/commands/uninstall/
!/src/commands/wrapper/
Expand Down
1 change: 1 addition & 0 deletions docs/commands/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Guides for Socket CLI commands:
- [cdxgen](cdxgen.md)
- [patch](patch/README.md)
- [ci](ci.md)
- [`socket scan report`](scan/report.md)

Patch subcommands:

Expand Down
34 changes: 34 additions & 0 deletions docs/commands/scan/report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# `socket scan report`

Generate a report for a completed Socket scan. The command can also write a
GitLab Dependency Scanning report for GitLab's Security Dashboard:

```sh
socket scan report "$SOCKET_SCAN_ID" --enable-gitlab-security
```

This writes `gl-dependency-scanning-report.json` in the current directory.
Choose another destination with `--gitlab-security-file`:

```sh
socket scan report "$SOCKET_SCAN_ID" \
--enable-gitlab-security \
--gitlab-security-file reports/dependency-scanning.json
```

Add the report to the `dependency_scanning` CI artifact so GitLab can ingest it:

```yaml
socket-dependency-scan:
script:
- socket scan report "$SOCKET_SCAN_ID" --enable-gitlab-security
artifacts:
reports:
dependency_scanning: gl-dependency-scanning-report.json
paths:
- gl-dependency-scanning-report.json
```

The report uses GitLab Dependency Scanning schema version `15.0.0`. Findings
are generated from the scan's package and alert data before CLI report folding
or policy-level filtering is applied.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@
"@typescript-eslint/parser": "8.43.0",
"@typescript/native-preview": "7.0.0-dev.20250912.1",
"@vitest/coverage-v8": "5.1.1",
"ajv": "8.20.0",
"ajv-formats": "3.0.1",
"blessed": "0.1.81",
"blessed-contrib": "4.11.0",
"browserslist": "4.29.6",
Expand Down
12 changes: 9 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 21 additions & 1 deletion src/commands/scan/cmd-scan-report.mts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@ async function run(
default: constants.FOLD_SETTING_NONE,
description: `Fold reported alerts to some degree (default '${constants.FOLD_SETTING_NONE}')`,
},
enableGitlabSecurity: {
type: 'boolean',
default: false,
description: 'Write a GitLab Dependency Scanning report',
},
gitlabSecurityFile: {
type: 'string',
default: 'gl-dependency-scanning-report.json',
description: 'Output path for the GitLab Dependency Scanning report',
},
interactive: {
type: 'boolean',
default: true,
Expand Down Expand Up @@ -124,7 +134,13 @@ async function run(
parentName,
})

const { json, markdown, org: orgFlag } = cli.flags
const {
enableGitlabSecurity,
gitlabSecurityFile,
json,
markdown,
org: orgFlag,
} = cli.flags

const dryRun = !!cli.flags['dryRun']

Expand Down Expand Up @@ -194,5 +210,9 @@ async function run(
fold,
short,
reportLevel,
enableGitlabSecurity: !!enableGitlabSecurity,
gitlabSecurityFile: String(
gitlabSecurityFile || 'gl-dependency-scanning-report.json',
),
})
}
2 changes: 2 additions & 0 deletions src/commands/scan/cmd-scan-report.test.mts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ describe('socket scan report', async () => {
- Permissions: full-scans:list

Options
--enable-gitlab-security Write a GitLab Dependency Scanning report
--fold Fold reported alerts to some degree (default 'none')
--gitlab-security-file Output path for the GitLab Dependency Scanning report
--interactive Allow for interactive elements, asking for input. Use --no-interactive to prevent any input questions,
defaulting them to cancel/no.
--json Output as JSON
Expand Down
Loading
Loading