How to fix: Ruby Gemfile or Gemfile.lock Exposed
A Gemfile or Gemfile.lock was found publicly accessible. Ruby gem dependency files reveal the exact gem versions used, enabling CVE-based vulnerability scanning against your dependencies.
Why it matters
Gemfile.lock contains the complete dependency tree with exact versions including all transitive gems. An attacker can use bundler-audit or CVE databases to find vulnerable gems in under a minute.
Gemfile.lock is similar to package-lock.json: it pins every gem to an exact version. This is necessary for reproducibility but should never be publicly accessible in production.
How to fix it
- 1Block access to Gemfile and Gemfile.lock in your web server configuration.
- 2In Rails: use config.public_file_server.enabled = false or configure Nginx to block these paths.
- 3Audit what files are in your Rails public/ directory.
Code examples
Rails public file server config
# config/environments/production.rb
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
# Nginx deny rule
# location ~* /(Gemfile(\.(lock))?) { deny all; }References
Detected automatically by VulnRadar. The check id is supply-chain-gemfile-exposed, stable across every scan so you can filter or diff on it.
More supply chain checks
- Mediumnpm/yarn Lock File Exposed
- MediumPython Requirements File Exposed
- MediumExternal CDN Script Without SRI Hash
- HighHTTP Script Loaded on HTTPS Page
- MediumPHP composer.json or composer.lock Exposed
- HighDockerfile or docker-compose.yml Exposed
- Critical.env File Exposed at Public URL
- MediumCDN Script With No Version Pin and No Integrity Hash
Questions
- How severe is Ruby Gemfile or Gemfile.lock Exposed?
- VulnRadar rates this medium severity in the supply chain category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
- Does VulnRadar check for this automatically?
- Yes. It runs as part of every scan under the check id supply-chain-gemfile-exposed, which stays the same between runs so you can filter, diff, or gate CI on it.
- Which standards does Ruby Gemfile or Gemfile.lock Exposed map to?
- It maps to CWE-200. In the OWASP Top 10 it falls under A05:2021.
Missing a check?
The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.