Skip to content

Exits normally when --gemfile-lock is not a lock file, should exit with error #403

@eliotsykes

Description

@eliotsykes

Description

It is a bit too easy for a developer to accidentally misconfigure the --gemfile-lock option and think their Gemfile.lock has no vulnerabilities. For example if they use Gemfile instead of their Gemfile.lock which has vulnerabilities, the bundle-audit command returns with exit code 0 and does not report it has been given an invalid lock file.

Steps To Reproduce

Steps to reproduce the bug:

# Command exits successfully, when Gemfile is accidentally given
# instead of the Gemfile.lock which has vulnerable gems:
bundle-audit check --gemfile-lock Gemfile
# => No vulnerabilities found

bundle-audit check --gemfile-lock Gemfile.lock
# => Vulnerabilities found!
# Giving any file other than the lock file, command exits successfully:
bundle-audit check --gemfile-lock README.md  
# => No vulnerabilities found

Expected Behavior

Command should exit with non-zero exit code, and an appropriate message output saying invalid lock file given.

Environment

$ bundler-audit --version
bundler-audit 0.9.2

$ bundle --version
Bundler version 2.5.22

$ ruby --version
3.3.8

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions