Add exclude option to skip gems by name during audit#419
Open
mlarraz wants to merge 1 commit intorubysec:masterfrom
Open
Add exclude option to skip gems by name during audit#419mlarraz wants to merge 1 commit intorubysec:masterfrom
exclude option to skip gems by name during audit#419mlarraz wants to merge 1 commit intorubysec:masterfrom
Conversation
Allow users to exclude entire gems from scanning via config file (`exclude:` key in .bundler-audit.yml) or CLI (`--exclude`/`-e` flag). Unlike `ignore` which skips specific advisory IDs after lookup, `exclude` skips gems entirely before any advisory database check. This is useful for Rails apps that bundle gems they don't actually use (e.g. activestorage, actiontext) where every new CVE triggers a false audit failure. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
jonswar
approved these changes
Apr 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds an
excludeconfiguration option (and--exclude/-eCLI flag) that skips entire gems by name during scanning, so they never hit the advisory database at all.This is semantically different from
ignore(which skips specific advisory IDs after lookup):excludeis a scoping decision — "this gem isn't part of my application" — whileignoreis a risk acceptance — "I know about this CVE and accept it."Useful for Rails apps that bundle gems they don't actually use (e.g.
activestorage,actiontext,actionmailbox) where every new CVE triggers a false audit failure. Currently the only workaround is adding each CVE ID to theignorelist, which is tedious and never-ending.Usage
Config file (
.bundler-audit.yml):CLI:
Changes
Configuration: newattr_reader :exclude(returnsSet<String>), YAML validation mirroringignoreScanner#scan_specs: resolvesexcludefrom options or config, skips gem before advisory lookup vianext if exclude.include?(gem.name)CLI#check: new--exclude/-earray option, passed through toscanner.reportTest plan
#initializetests (default empty Set, given:excludelist):excludeoption filters gems from results.bundler-audit.ymlconfig file works