This package is a command-line interface (CLI) tool designed to integrate Node.js project security audits into GitLab's dependency scanning feature. It parses the JSON output from `npm audit --json` and transforms it into GitLab's standardized `gl-dependency-scanning-report.json` format, which is then consumable by GitLab CI/CD pipelines for displaying security vulnerabilities in the UI. Currently at version 1.0.4, its release cadence is typically driven by changes in `npm audit` output formats or updates to GitLab's security report schemas. The primary differentiator is its specialized function for GitLab CI, addressing the gap where raw `npm audit` output is not directly compatible with GitLab's security dashboards. It acts as middleware, ensuring that npm audit findings can be properly ingested and displayed within GitLab's security features.
npm install gitlab-npm-audit-parserVerified import paths — ran on the pinned version, not inferred.
This GitLab CI/CD job snippet demonstrates how to run an `npm audit` and process its JSON output into a GitLab-compatible dependency scanning report using `gitlab-npm-audit-parser`.
Update your `.gitlab-ci.yml` to use a current Node.js LTS image, e.g., `node:16-alpine` or `node:lts-alpine`.
Ensure `npm audit --json` runs successfully and its output is the sole content piped to `gitlab-npm-audit-parser`. If using `npm run-script`, add `--silent` to prevent extra output: `npm run audit -- --json --silent`.
Always explicitly specify the output filename using the `-o` or `--out` option to match the `artifacts:reports:dependency_scanning` path in your `.gitlab-ci.yml` (e.g., `-o gl-dependency-scanning.json`).
Verify that `npm audit --json` produces valid JSON. If running `npm audit` via a script, ensure `--silent` is used to prevent additional logging from interfering with the JSON output: `npm audit --json --silent | npx gitlab-npm-audit-parser`.
Ensure your Node.js Docker image includes `npm` (and thus `npx`). If using a very slim image, you might need to explicitly install `npm` or use a slightly larger Node.js base image. Alternatively, if globally installed, ensure the global `node_modules/.bin` is in PATH.
No dependency data recorded yet.