Skip to content

Run npm audit on the repository's Node.js and allow --omit=dev - #13

Merged
PavlosIsaris merged 1 commit into
mainfrom
feat/security-audit-node-and-omit-dev
Oct 22, 2026
Merged

PavlosIsaris merged 1 commit into
mainfrom
feat/security-audit-node-and-omit-dev

Conversation

@PavlosIsaris

Copy link
Copy Markdown
Member

Problem

The Dependency audit job of security.yml runs npm audit on the runner's Node.js (22.23.3 today). A repository that applies the npm-harden policy declares devEngines.runtime with only patched Node.js versions. npm then refuses to run, and the job fails with EBADDEVENGINES before it audits anything. Seen in scify/annotation-management-system#65.

A second, older problem: braces has a high advisory without a fixed release (GHSA-vfj7-8cjw-p6xm). It comes in through stylelint, a dev tool, so every repository with stylelint fails the audit with no way to fix it. annotation-management-system has failed this job on main since 5 October.

Changes

  • security.yml, audit job: a new step finds the Node.js version file and actions/setup-node (same SHA as laravel-ci.yml, package-manager-cache: false) installs that version before npm audit.
  • New input node-version-file (default ''): the .nvmrc in working-directory when it exists, else the runner's Node.js, so repositories without .nvmrc behave as before.
  • New input npm-audit-omit-dev (default false): runs npm audit --omit=dev, so only the production dependencies are audited.
  • Workflow guide, template and fixtures README document both inputs.

Both inputs are additive with defaults that keep the current behaviour, so this fits the v0.1 line (v0.1.8).

Failing cases

The security fixture now has .nvmrc 24.22.1, a devEngines rule that allows only that version, and the dev dependency braces 3.0.3. security-fixture passes only when the audit runs on the .nvmrc version and with npm-audit-omit-dev: true. Checked locally: without --omit=dev the audit exits 1; on Node.js 22.23.4 npm exits with EBADDEVENGINES.

GitHub's dependency graph will report the fixture's braces entry. Dismiss that alert as "Vulnerable code is not actually used".

Checked locally

actionlint 1.7.12 on the workflows and templates, scripts/shellcheck-actions.py with shellcheck 0.11.0, scripts/check-workflow-docs.py: all pass.

The audit job ran npm audit on the runner's Node.js. A repository with
devEngines.runtime (the npm-harden policy) refuses an unpatched runner
version, so the audit failed with EBADDEVENGINES before it checked
anything.

- The audit job now sets up Node.js from the new input
  node-version-file, or from the .nvmrc in working-directory when the
  input is empty. Without a version file it keeps the runner's Node.js.
- New input npm-audit-omit-dev runs npm audit --omit=dev. Use it when a
  dev tool has an advisory without a fixed release, such as braces
  through stylelint.
- The security fixture now fails unless both work: its .nvmrc and
  devEngines allow only Node.js 24.22.1, and its dev dependency braces
  3.0.3 has a high advisory without a fix.
@PavlosIsaris
PavlosIsaris merged commit c1a0647 into main Oct 22, 2026
28 checks passed
@PavlosIsaris
PavlosIsaris deleted the feat/security-audit-node-and-omit-dev branch October 22, 2026 06:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant