Skip to content

refactor(security): use the osv-scanner config for audit ignores #6419

Done

Description

@dan-petty

Problem

devops ci audit reads two ignore files of its own, .osv-scanner-ignore.yaml and .npm-audit-ignore.yaml, with its own loader and filter (src/devops_cli/core/dependency_audit.py:91-162, src/devops_cli/commands/ci.py:427-470, constants.py:5258-5264). osv-scanner has a native config file (osv-scanner.toml) for the same need. All 6 osv entries name tools_lock/semgrep.txt, which #4363 deletes.

Change

After #4363 deletes tools_lock/semgrep.txt and the devtools image takes the npm lock folders:

  • Delete .osv-scanner-ignore.yaml and .npm-audit-ignore.yaml, the loader and filter (dependency_audit.py:91-162, ci.py:427-470), and their tests and constants (constants.py:5258-5264).
  • A future ignore goes in osv-scanner.toml as [[IgnoredVulns]] with effectiveUntil (ignoreUntil is deprecated) and a reason, or in [[PackageOverrides]] for a per-lockfile scope.
  • Keep the guard of SECURITY.md:91 and :93 (a date, a #N statement, no wildcard) with a check-jsonschema pre-commit hook on osv-scanner.toml.
  • The devops-cli package-lock.json of build(npm): make openspec and style-dictionary devDependencies #6409 stays in this repository. Audit it with osv-scanner, not npm audit. Update SECURITY.md (A Finding with No Fix) for the new file names.

Renovate. osv-scanner comes from the devtools mise.toml (mise manager). The pre-commit manager bumps the check-jsonschema rev.

Risk. The native config makes the expiry and the reason optional, so the schema check must stay. A root osv-scanner.toml does not apply to subfolders.

Proof

  • git grep -n load_osv_audit_ignores gives nothing, and uv run devops ci audit passes.
  • The PR compares the osv-scanner and npm audit results on package-lock.json.

Depends on: dan-petty/devtools#1, #4363, #6409

Alternatives check of 2026-11-19: not-applicable.
Class: refactor, no search.
Tool: none found.

Proposed design

Problem statement

devops ci audit still keeps a custom ignore loader, filter, models, messages and constants for .npm-audit-ignore.yaml, because npm audit reads no ignore file. The six .osv-scanner-ignore.yaml entries and their loader are already gone with #4363, and the remaining npm ignore file holds no entry. osv-scanner has a native osv-scanner.toml config with [[IgnoredVulns]], and it can audit the root package-lock.json of #6409. The change deletes the npm ignore file, loader, filter, models, messages and constants, runs osv-scanner on the root lockfile, adds osv-scanner.toml with a check-jsonschema hook that keeps the SECURITY.md guard of an expiry date, a #N statement and no wildcard, and updates the guidance and the ci-dependency-audit spec.

Acceptance criteria

Requirement: Native config passes the schema hook

The repository SHALL validate osv-scanner.toml with the check-jsonschema pre-commit hook.

Scenario: The committed config passes the schema hook

  • WHEN A developer runs uv run pre-commit run check-jsonschema --files osv-scanner.toml.
  • THEN The hook exits 0 and reports no schema error.

Requirement: Schema requires expiry and tracking reason

The project schema MUST require effectiveUntil and a reason with a #N statement on each [[IgnoredVulns]] entry.

Scenario: An entry with no reason is refused

  • WHEN A developer adds an [[IgnoredVulns]] entry with no reason to osv-scanner.toml and runs uv run pre-commit run check-jsonschema --files osv-scanner.toml.
  • THEN The hook exits non-zero and names reason.

Requirement: Schema refuses a wildcard

The project schema MUST refuse an [[IgnoredVulns]] id that holds *.

Scenario: A wildcard entry is refused

  • WHEN A developer adds an [[IgnoredVulns]] entry with the id GHSA-* to osv-scanner.toml and runs uv run pre-commit run check-jsonschema --files osv-scanner.toml.
  • THEN The hook exits non-zero and names the id field.

Requirement: Custom npm ignore loader is removed

The project SHALL remove the custom npm ignore loader, filter, models, command builders, messages and constants.

Scenario: No custom npm ignore symbol remains

  • WHEN A test searches src/devops_cli/core/dependency_audit.py, src/devops_cli/commands/ci.py, src/devops_cli/config/commands.py, src/devops_cli/config/constants.py and src/devops_cli/lang/en/messages.py for load_npm_audit_ignores, active_npm_ignores, NpmAuditIgnore, AppliedIgnores, npm_advisory_ids, _read_npm_failure, build_npm_audit_cmd, npm_audit_lockfile, CONST_NPM_AUDIT_IGNORE_FILE, audit_ignored and audit_ignore_expired.
  • THEN The test finds none of these names.

Requirement: Custom ignore file is deleted

The repository SHALL delete .npm-audit-ignore.yaml and keep .osv-scanner-ignore.yaml absent.

Scenario: The custom ignore files are absent

  • WHEN A developer runs git ls-files .npm-audit-ignore.yaml .osv-scanner-ignore.yaml.
  • THEN The command prints no path.

Requirement: npm audit leaves the audit row

The audit row SHALL run no npm audit command.

Scenario: The audit command list holds no npm audit

  • WHEN A test inspects the audit CheckSpec commands in src/devops_cli/commands/ci.py.
  • THEN No command of the row has npm as its program, and no build_npm_audit_cmd call remains.

Requirement: Root package-lock is audited with osv-scanner

The audit row SHALL scan the root package-lock.json of #6409 with osv-scanner.

Scenario: The audit row scans the root lockfile

  • WHEN A test inspects the audit CheckSpec commands in src/devops_cli/commands/ci.py.
  • THEN The row holds an osv-scanner command whose arguments name the root package-lock.json.

Requirement: The audit reads the osv-scanner exit status

The audit SHALL read an osv-scanner finding from exit code 1 and an audit that could not run from any other non-zero exit code.

Scenario: The osv-scanner verdict follows the exit code

  • WHEN A test calls audit_verdict with an osv-scanner command and exit code 1, then 2.
  • THEN The first call returns VULNERABLE and the second returns NOT_RUN.

Requirement: Guidance names the native config

SECURITY.md, docs/ROUTINE_TASKS.md and docs/SDLC.md SHALL name osv-scanner.toml for an ignore and osv-scanner for the audit of the root lockfile, and MUST NOT name the deleted ignore files.

Scenario: The guidance uses the native file name

  • WHEN A test reads SECURITY.md, docs/ROUTINE_TASKS.md and docs/SDLC.md.
  • THEN The text names osv-scanner.toml and osv-scanner, and contains neither .osv-scanner-ignore.yaml nor .npm-audit-ignore.yaml.

Requirement: Audit spec states the native config

The change SHALL carry a ci-dependency-audit spec delta that states the audit reads osv-scanner.toml and drops the npm audit and the two custom ignore files.

Scenario: The openspec gate accepts the change

  • WHEN A developer runs uv run devops ci --check --only openspec.
  • THEN The command exits 0, so the change folder's spec delta passes the OpenSpec gate.

Requirement: Audit row passes with the native config

devops ci audit SHALL pass after the change.

Scenario: The audit row passes with the native config

  • WHEN A developer runs uv run devops ci audit in the repository root.
  • THEN The command exits 0 and reports no unignored advisory.

Existing Tool Considered

osv-scanner (Google) is the open, maintained tool that covers the need: its native osv-scanner.toml holds [[IgnoredVulns]] with effectiveUntil and a reason, and it reads the config from the directory of the lockfile it scans (https://github.com/google/osv-scanner, fetched 2026-11-22). It lacks a mandatory expiry and reason, and it reads no config above the lockfile, so the change adds one osv-scanner.toml beside the root lockfile and a check-jsonschema pre-commit hook with a project schema. check-jsonschema (python-jsonschema) covers the schema validation of a TOML file and needs the project schema for these fields. The change builds no custom replacement for the ignore loader: it deletes the npm loader, filter, models, messages and constants and adds one schema file.

Key questions

  • Which file holds the audit ignore entries after this change?: osv-scanner.toml in the directory of the lockfile it scopes. Each ignored advisory goes in [[IgnoredVulns]] with its id, effectiveUntil and a reason that names the tracking issue as #N. The file's directory gives the scope. The root package-lock.json is the only lockfile that osv-scanner audits, so the repository holds one root osv-scanner.toml. (best practice) [sources: src/devops_cli/security/osv_scanner.py:297, src/devops_cli/config/constants.py:5396-5404, tests/security/test_review_tool_runs.py:393-405, docs/SELF_IMPROVEMENT.md:699, https://github.com/google/osv-scanner]
    • Chosen: Native osv-scanner.toml. osv-scanner reads it and the project keeps no custom loader.
    • Rejected: Keep .npm-audit-ignore.yaml. npm audit reads no ignore file, so the project must keep a loader and a filter.
    • Rejected: Keep .osv-scanner-ignore.yaml. The file and its loader are already gone with chore(tools): remove devops install-tools and tools.lock #4363, and osv-scanner does not read it.
  • How does the project keep expiry and reason mandatory in the native config?: Add a check-jsonschema pre-commit hook on osv-scanner.toml with a project schema. The schema requires effectiveUntil and a reason with a #N statement, and it refuses a wildcard advisory ID. The hook checks the two rules of SECURITY.md that the native config drops. (best practice) [sources: SECURITY.md:91, SECURITY.md:93, .pre-commit-config.yaml:48]
    • Chosen: check-jsonschema hook. osv-scanner makes the expiry and the reason optional, and check-jsonschema is the open, maintained tool that validates a TOML file against a schema.
    • Rejected: Rely on osv-scanner validation. The native config accepts an entry with no reason and no expiry.
    • Rejected: A custom devops ci check. It builds and keeps code that check-jsonschema covers.
  • Which tool audits the devops-cli npm lockfile of build(npm): make openspec and style-dictionary devDependencies #6409?: osv-scanner scans the root package-lock.json. npm audit reads no ignore file, so auditing the lock with it would keep the custom loader and filter that this change deletes. (best practice) [sources: src/devops_cli/commands/ci.py:882-886, src/devops_cli/config/commands.py:219-242, src/devops_cli/core/dependency_audit.py:7-15, package-lock.json]
    • Chosen: osv-scanner. It reads the native config and lets the custom filter go.
    • Rejected: npm audit. It reads no ignore file, so the custom loader and filter must stay.
  • What happens to the six osv ignore entries that name src/devops_cli/tools_lock/semgrep.txt?: They are already gone. chore(tools): remove devops install-tools and tools.lock #4363 deleted src/devops_cli/tools_lock/semgrep.txt, .osv-scanner-ignore.yaml and the osv-scanner audit of the tools lock; the archive records that .osv-scanner-ignore.yaml named only requirement files of the tools lock. The repository now holds only .npm-audit-ignore.yaml, and its vulnerabilities list is empty. The new root osv-scanner.toml starts with no [[IgnoredVulns]] entry. [sources: openspec/changes/archive/2026-11-20-4363-remove-tools-lock/specs/ci-dependency-audit/spec.md:12, openspec/changes/archive/2026-11-21-6480-bump-mcp-in-the-semgrep-lock/proposal.md:32-33, .npm-audit-ignore.yaml:1-4, src/devops_cli/config/constants.py:5415-5418]
  • How does the change handle the risk that a root osv-scanner.toml does not apply to subfolders?: osv-scanner reads osv-scanner.toml in the directory of each lockfile it scans and nowhere above it. After chore(tools): remove devops install-tools and tools.lock #4363, the only lockfile that osv-scanner audits is the root package-lock.json of build(npm): make openspec and style-dictionary devDependencies #6409; uv.lock is audited by uv audit, which reads no osv-scanner config. One root osv-scanner.toml covers the root lockfile. A future subfolder lockfile gets its own osv-scanner.toml beside it. (best practice) [sources: src/devops_cli/security/osv_scanner.py:297, src/devops_cli/config/constants.py:5396-5404, tests/security/test_review_tool_runs.py:393-405, docs/SELF_IMPROVEMENT.md:699]
    • Chosen: One config beside each lockfile. The tool reads the config of the lockfile's own directory, and the only osv-scanner lockfile is at the root.
    • Rejected: Root config for subfolders. A root config does not apply to a subfolder, and a test asserts that osv-scanner finds no config above the lockfile.
  • Which committed files state the custom ignore behavior, and what must the change update?: The ci-dependency-audit spec states it in its purpose, in the npm ignore requirement and in the root lockfile requirement. SECURITY.md states it in step 1 of A Finding with No Fix. docs/ROUTINE_TASKS.md states it in the methodology, the command, the ignore-entry line and the failure row. docs/SDLC.md names npm audit for the root lockfile. The change replaces each with osv-scanner.toml and osv-scanner, and adds the spec delta that the archive applies. [sources: openspec/specs/ci-dependency-audit/spec.md:4, openspec/specs/ci-dependency-audit/spec.md:9, openspec/specs/ci-dependency-audit/spec.md:38, SECURITY.md:81, docs/ROUTINE_TASKS.md:188-192, docs/ROUTINE_TASKS.md:305, docs/SDLC.md:25]
  • Which reader does the audit row use for osv-scanner?: Add BIN_OSV_SCANNER to _FAILURE_READERS with a reader that returns VULNERABLE for exit code 1 and NOT_RUN for any other non-zero exit code. osv-scanner exits 0 when it finds nothing, and its native config filters an active [[IgnoredVulns]] entry before the exit status, so the audit keeps no filter of its own. (best practice) [sources: openspec/changes/archive/2026-11-18-3988-audit-tools-lock-advisories/design.md:17, src/devops_cli/core/dependency_audit.py:189-203]
    • Chosen: An osv-scanner reader. It tells a finding from an audit that could not run, as the archive design of fix(deps): check the tools lock requirement files for advisories #3988 did.
    • Rejected: Every non-zero exit is a finding. A missing binary or a network failure would pass as a vulnerability and hide an audit that could not run.
    • Rejected: Every non-zero exit is not run. A finding would never fail the row.
  • What command does the audit row run for the root lockfile?: osv-scanner scan source --lockfile package-lock.json, built in config/commands.py as build_osv_audit_cmd. The v2 form is the one that build_osv_scan_cmd already uses; the older osv-scanner --lockfile package-lock.json:<path> form of fix(deps): check the tools lock requirement files for advisories #3988 is gone. The command runs online, as uv audit and the former npm audit did, and the exit code alone gives the verdict. (best practice) [sources: src/devops_cli/config/commands.py:138-158, src/devops_cli/config/commands.py:108-124, openspec/changes/archive/2026-11-18-3988-audit-tools-lock-advisories/design.md:13]
    • Chosen: A small build_osv_audit_cmd. It gives the audit row the v2 scan form and the lockfile it needs, with no review-only flags.
    • Rejected: Reuse build_osv_scan_cmd. It adds --offline, --all-packages and --all-vulns for a review, which needs a fetched database and a JSON report that the audit does not read.
    • Rejected: The v1 osv-scanner --lockfile package-lock.json:<path> form. The repository runs osv-scanner v2, whose scan source --lockfile form build_osv_scan_cmd already uses.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    type/refactor
    scope/security
    source/agent
    status/new
    value/medium
    on Nov 19, 2026
  2. dan-petty commented on Nov 19, 2026

    @dan-petty
    OwnerAuthor
  3. added
    effort/medium
    priority/p2-medium
    on Nov 19, 2026
  4. devops-cli-service commented on Nov 19, 2026

    @devops-cli-service
    Contributor

    Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies and Watched files in the section Proposed design of the body.

  5. added
    status/ready
    and removed
    status/new
    on Nov 22, 2026
  6. devops-cli-service commented on Nov 22, 2026

    @devops-cli-service
    Contributor

    Next step: the stage job writes the plan of the item. See the section Proposed design of the body.

  7. added
    owner/agent
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/in-progress
    on Nov 23, 2026
  8. removed
    status/in-review
    owner/agent
    on Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p2-mediumscope/securitysource/agenttype/refactorvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions