lockfile_audit 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6f02ad30c5d73027023967b15462cf39489383751cd89acb440fb0c6eb993e70
4
- data.tar.gz: a4d6a9fbd40231af0c64935759faf225f5891bb93a617723cc540bd1adacd2c2
3
+ metadata.gz: 9a40680aa11ae2f41281b039b0aabe9d75a447e62df4a48cef08eda71fb39af3
4
+ data.tar.gz: a6fd341f09f84792cc3ecfb13dacfce27ba31142552f73452756ef5cac238eb4
5
5
  SHA512:
6
- metadata.gz: 7c0fc2776fe8bc32ae760225ac8d76ed805dc8e839fb85fb27d60aae31894608a41b6f341eecdef0e396149a7bc4bd8da7cf136ea79a782e53e73b018c73bbb9
7
- data.tar.gz: 6b62f3b0e60043aa76e4bc771adb14082df5f36f6a2afe34f621dbc299b7f1bdc59852666e855f0c1bf6548e1442cd3468b5065cbbc80a2558b6b5b96f2ca03b
6
+ metadata.gz: 29745b256e0a86f9817a06ab48476ea711bbc325f7f17476a08db4b64f8488608ee401f4d3b5e197beaa8d1b1f5540b925303f6c676109f126402010d57f2b99
7
+ data.tar.gz: 6569e296605666ec7424908121924f7580ec00906c44f83597edadc89e44defe2fe53be41220923c84f71856e7d541990feef6281838be9e47aa931de1de6db2
data/CHANGELOG.md CHANGED
@@ -7,6 +7,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.1.2] - 2026-10-03
11
+
12
+ ### Changed
13
+
14
+ - Source moved to the `betterwebsites/ror_gems` monorepo. Gemspec metadata
15
+ links updated. No code changes.
16
+ ## [0.1.1] - 2026-09-26
17
+
18
+ ### Fixed
19
+
20
+ - `VulnerabilityCollector` now invokes `bundle-audit` using the same Ruby
21
+ as the host application (`RbConfig.ruby`) and resolves the exact binary
22
+ path via `Gem.bin_path`, instead of relying on `PATH`. This prevents
23
+ `Bundler::RubyVersionMismatch` errors when the app's Ruby differs from
24
+ the one on `PATH`.
25
+ - Added a missing `raise_not_installed` helper so the collector raises a
26
+ clear `BundlerAuditNotInstalled` error (with stderr detail) instead of
27
+ a `NoMethodError`.
28
+
10
29
  ## [0.1.0] - 2026-09-26
11
30
 
12
31
  ### Added
@@ -26,5 +45,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
26
45
  - `LockfileAudit::Errors` namespace with `LockfileNotFound`,
27
46
  `BundlerAuditNotInstalled`, and `InvalidAuditJson`.
28
47
 
29
- [Unreleased]: https://github.com/Behnam1369/lockfile_audit/compare/v0.1.0...HEAD
48
+ [Unreleased]: https://github.com/Behnam1369/lockfile_audit/compare/v0.1.1...HEAD
49
+ [0.1.1]: https://github.com/Behnam1369/lockfile_audit/compare/v0.1.0...v0.1.1
30
50
  [0.1.0]: https://github.com/Behnam1369/lockfile_audit/releases/tag/v0.1.0
data/README.md CHANGED
@@ -116,16 +116,12 @@ All errors inherit from `LockfileAudit::Errors::Error`.
116
116
 
117
117
  ## Development
118
118
 
119
+ cd lockfile_audit
119
120
  bundle install
120
- bundle exec rspec
121
- bundle exec standardrb
121
+ bundle exec rake
122
122
 
123
- To release a new version:
124
-
125
- 1. Bump `lib/lockfile_audit/version.rb`.
126
- 2. Update `CHANGELOG.md`.
127
- 3. `gem build lockfile_audit.gemspec`
128
- 4. `gem push lockfile_audit-<version>.gem`
123
+ To release, see the "Releasing a gem" section of the
124
+ [repo README](../README.md).
129
125
 
130
126
  ## License
131
127
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LockfileAudit
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.2"
5
5
  end
@@ -15,13 +15,9 @@ module LockfileAudit
15
15
  #
16
16
  # When invoking the CLI, the collector runs with a scrubbed environment so
17
17
  # the parent process's Bundler state (BUNDLE_*, RUBYOPT, etc.) does not leak
18
- # into the subprocess. Without this, running from inside a Rails console
19
- # causes Bundler to re-validate the Ruby version in the subprocess and abort
20
- # with Bundler::RubyVersionMismatch.
21
- #
22
- # The CLI is invoked directly (never via `bundle exec` or `gem exec`) so the
23
- # subprocess stays independent of the parent's Bundler context and does not
24
- # trigger dependency installation or RDoc generation as a side effect.
18
+ # into the subprocess. It also invokes bundler-audit using the *current*
19
+ # Ruby (RbConfig.ruby) and the exact installed binary path (Gem.bin_path),
20
+ # so the subprocess uses the same Ruby as the host application.
25
21
  class VulnerabilityCollector
26
22
  # Environment variables that must not leak into the bundler-audit
27
23
  # subprocess. These are set by Bundler when the parent process is a
@@ -76,28 +72,30 @@ module LockfileAudit
76
72
  private
77
73
 
78
74
  def run_bundler_audit
79
- stdout, stderr, status = invoke(["bundle-audit"])
75
+ stdout, stderr, status = invoke
80
76
  return stdout if usable?(stdout, status)
81
77
 
78
+ raise_not_installed(stderr)
79
+ rescue Gem::Exception
82
80
  raise Errors::BundlerAuditNotInstalled,
83
- "bundle-audit could not be invoked. " \
84
- "Ensure the `bundler-audit` gem is installed and on your PATH " \
85
- "(e.g. `gem install bundler-audit`). " \
86
- "stderr: #{stderr.to_s.strip}"
81
+ "bundler-audit is not installed for #{RbConfig.ruby} (#{RUBY_VERSION}). " \
82
+ "Install it for this Ruby: gem install bundler-audit"
87
83
  rescue Errno::ENOENT
88
- raise Errors::BundlerAuditNotInstalled,
89
- "bundle-audit is not installed or not on PATH. " \
90
- "Install it with `gem install bundler-audit`."
84
+ raise_not_installed(nil)
91
85
  end
92
86
 
93
- def invoke(command)
87
+ def invoke
94
88
  Open3.capture3(
95
89
  clean_env,
96
- *command, "check", "--format", "json",
90
+ RbConfig.ruby, bundle_audit_path, "check", "--format", "json",
97
91
  chdir: File.dirname(File.expand_path(@lockfile_path))
98
92
  )
99
93
  end
100
94
 
95
+ def bundle_audit_path
96
+ Gem.bin_path("bundler-audit", "bundle-audit")
97
+ end
98
+
101
99
  # Builds an environment hash that removes the inherited Bundler state.
102
100
  # Passing nil as the value to Open3 unsets the variable in the child.
103
101
  def clean_env
@@ -116,6 +114,18 @@ module LockfileAudit
116
114
  false
117
115
  end
118
116
 
117
+ # Raises BundlerAuditNotInstalled with an actionable message that
118
+ # includes stderr when available.
119
+ def raise_not_installed(stderr)
120
+ detail = stderr.to_s.strip
121
+ message = "bundler-audit could not be invoked. " \
122
+ "Ensure the `bundler-audit` gem is installed for this Ruby " \
123
+ "(#{RUBY_VERSION}) and run `bundle-audit update` to fetch the " \
124
+ "advisory database."
125
+ message += " stderr: #{detail}" unless detail.empty?
126
+ raise Errors::BundlerAuditNotInstalled, message
127
+ end
128
+
119
129
  # Maps a single bundler-audit finding onto the public schema.
120
130
  #
121
131
  # bundler-audit has used slightly different key names across versions, so
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lockfile_audit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - behnam1369
@@ -27,12 +27,13 @@ files:
27
27
  - lib/lockfile_audit/report.rb
28
28
  - lib/lockfile_audit/version.rb
29
29
  - lib/lockfile_audit/vulnerability_collector.rb
30
- homepage: https://github.com/Behnam1369/lockfile_audit
30
+ homepage: https://github.com/betterwebsites/ror_gems/tree/main/lockfile_audit
31
31
  licenses:
32
32
  - MIT
33
33
  metadata:
34
- homepage_uri: https://github.com/Behnam1369/lockfile_audit
35
- changelog_uri: https://github.com/Behnam1369/lockfile_audit/blob/main/CHANGELOG.md
34
+ homepage_uri: https://github.com/betterwebsites/ror_gems/tree/main/lockfile_audit
35
+ source_code_uri: https://github.com/betterwebsites/ror_gems/tree/main/lockfile_audit
36
+ changelog_uri: https://github.com/betterwebsites/ror_gems/blob/main/lockfile_audit/CHANGELOG.md
36
37
  rdoc_options: []
37
38
  require_paths:
38
39
  - lib