Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

npm audit step passes when the audit request fails

Open Beginner friendly
#556 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@zaid3 is already working on this.

Since Oct 18, 2026.

  • #565 by @zaid3 — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
82/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
github-actions, javascript
Domain
ci-cd, security

Research direction

Read npm-vulnerability-scanner.yaml and inspect the “Run NPM Audit & Generate Summary” script, especially how it handles audit errors and missing metadata.vulnerabilities. Reproduce the registry failure with the command and test setup described in the issue. Done when an audit request failure makes the step fail instead of reporting that all packages passed.

Written by the indexing model from the issue text.

Description

The "Run NPM Audit & Generate Summary" step in npm-vulnerability-scanner.yaml runs npm audit --audit-level=high --json 2>/dev/null || true, then reads the critical and high counts with a parser whose catch prints 0. When npm cannot reach the advisory endpoint, npm audit exits 1 with a JSON error that has no metadata. Both counts become 0, and the step passes with "No high or critical vulnerabilities found! All JS packages passed security checks."

To reproduce

Run the step's script from the repo root, with lodash 4.17.15 (rated high) added to package.json and package-lock.json:

  • npm_config_registry=https://registry.npmjs.org/: the step exits 1, reporting 0 critical and 1 high.
  • npm_config_registry=http://127.0.0.1:9/: npm audit prints {"message": "request to http://127.0.0.1:9/-/npm/v1/security/advisories/bulk failed, ..."} and exits 1. The step exits 0 with the all-clear summary.

So a registry or network outage during a PR's run reports the dependencies as clean.

Possible fix

Fail the step when the audit output has an error or no metadata.vulnerabilities, rather than treating it as zero. Alternatively, take the pass or fail from npm audit --audit-level=high's own exit code and use the JSON only for the summary.

Dominant language
Ruby
Stars
16
Forks
48
Avg merge
1d 11h
Merged PRs (30d)
14

Getting set up

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from alphagov/tech-docs-gem

All issues in alphagov/tech-docs-gem

Similar issues

More Ruby issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.