Skip to content

feat!: disable osv-scanner pre-commit hook by default - #27

Merged
dermorz merged 1 commit into
mainfrom
chore/osv-scanner-ci-only
Aug 21, 2026
Merged

feat!: disable osv-scanner pre-commit hook by default#27
dermorz merged 1 commit into
mainfrom
chore/osv-scanner-ci-only

Conversation

@dermorz

@dermorz dermorz commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

What

Disable the osv-scanner pre-commit hook by default and document how to opt back in.

Refs opendefensecloud/solution-arsenal#669

Why

make scan resolves every dependency against the osv.dev API, adding roughly a
minute to any commit that touches go.mod, go.sum, or requirements.txt
slow enough that it discourages small, frequent commits. Vulnerability scanning
belongs in CI, where it runs on a schedule and on every pull request without
blocking a commit.

Testing

Manual: entered the dev shell in example/, confirmed the osv-scanner hook is
no longer installed by default and that setting osv-scanner.enable = true in
preCommitHooks brings it back.

Notes for reviewers

Breaking change for consumers relying on the hook running automatically.
Upgrade path: projects without a CI-side scan opt back in per-project:

preCommitHooks = {
  osv-scanner.enable = true;
};

The README/example snippets were also flipped — they now use lint as the
"disable a default hook" example and osv-scanner as the "enable a hook that's
off by default" example.

Checklist

  • Tests added/updated n/a
  • No breaking changes (or upgrade path documented above)
  • Readable commit history (squashed and cleaned up as desired)
  • AI code review considered and comments resolved

Summary by CodeRabbit

  • New Features

    • Added clearer development-shell customization guidance.
    • Added documented opt-in support for vulnerability scanning during local commits.
    • Updated the example configuration to disable linting and enable vulnerability scanning.
  • Documentation

    • Improved repository settings and Git hook documentation.
    • Clarified that vulnerability scanning runs in CI by default.
    • Normalized repository-settings table formatting.

`make scan` resolves every dependency against the osv.dev API. On a
mid-sized Go project that is roughly a minute of network round-trips on
any commit touching go.mod, go.sum, or requirements.txt — slow enough
that it discourages small, frequent commits.

Vulnerability scanning is a better fit for CI, where it runs on a
schedule and on every pull request without sitting in the commit path.
Projects that have no CI-side scan can opt back in per-project with
`osv-scanner.enable = true`.

Also swap the README and example snippets to disable `lint` instead, so
they still demonstrate turning a default hook off, and show osv-scanner
as the opt-in example.

BREAKING CHANGE: the osv-scanner pre-commit hook no longer runs by
default. Projects relying on it as their only vulnerability scan must
either add a CI-side scan or set `osv-scanner.enable = true` in
`preCommitHooks`.
@coderabbitai

coderabbitai Bot commented Aug 21, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 2bc93fec-0c0f-4605-85bb-7afdbea2ca81

📥 Commits

Reviewing files that changed from the base of the PR and between f16fb83 and 9f35f5f.

📒 Files selected for processing (3)
  • README.md
  • example/flake.nix
  • flake.nix

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The default osv-scanner hook is now disabled. CI scanning and project-level opt-in are documented. Example dev-shell configurations disable lint and enable osv-scanner. README table formatting is also normalized.

Changes

Vulnerability scanning hook configuration

Layer / File(s) Summary
Default hook behavior
flake.nix, README.md
The default osv-scanner hook is disabled. The README documents CI scanning and project-level opt-in.
Project configuration and documentation examples
example/flake.nix, README.md
The examples disable lint and enable osv-scanner. README settings tables are reformatted.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Merge Risk: ⚪ Minimal · up to 9f35f

This change disables the osv-scanner pre-commit hook by default and documents how projects can opt back in; no actionable merge-blocking risk remains after normal checks and review.

Suggested reviewers: olzemal, trevex

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: disabling the osv-scanner pre-commit hook by default.
Description check ✅ Passed The description covers the change, motivation, testing, breaking-change impact, upgrade path, and checklist.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (3 skipped: 3 unsupported.)
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/osv-scanner-ci-only

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@dermorz
dermorz merged commit ee5da7d into main Aug 21, 2026
7 checks passed
@dermorz
dermorz deleted the chore/osv-scanner-ci-only branch August 21, 2026 13:09
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.

3 participants