deps/locked-install/ruby
Installs use the lockfile strictly
Implements deps/locked-install for ruby.
| Severity | warning |
| Tiers | 1, 2 |
| Stacks | ruby |
| Scope | each |
| Kind | expr |
| Source | library v0.7.0 |
| Selected by | fleetlint-recommended@v0.7.0 |
Requirement
Bundler runs frozen: bundle config set frozen true (or deployment) in a recipe or CI step, BUNDLE_FROZEN/BUNDLE_DEPLOYMENT in a workflow or a tracked .bundle/config, or ruby/setup-ruby with bundler-cache: true (which installs in deployment mode).
Why
An install that quietly re-resolves builds and tests something other than what the lockfile in git says, and the drift shows up only in production.
Check
(taskrunner.recipes.filter(t, !t.matches(r'(?i)update|upgrade|lock|bump|renovate')).map(t, taskrunner.recipes[t]).flatten()
+ params.runners.filter(f, file(f)).map(f, lines(f)).flatten()
+ workflows().map(w, steps(w).map(s, s.run.split("\n")).flatten()).flatten())
.filter(l, !l.matches(params.noise)).exists(l, l.matches(r'\bbundle\s+config\s+(set\s+)?(--local\s+)?(frozen|deployment)\s+(true|1)\b|\bbundle\s+install\b[^;&|]*--(frozen|deployment)\b'))
|| workflows().exists(w, text(w).matches(r'\bBUNDLE_(FROZEN|DEPLOYMENT):\s*["\x27]?(true|1)')
|| steps(w).exists(s, s.uses.startsWith("ruby/setup-ruby") && "bundler-cache" in s.with && s.with["bundler-cache"] in [true, "true"]))
|| (file(".bundle/config") && text(".bundle/config").matches(r'BUNDLE_(FROZEN|DEPLOYMENT):\s*["\x27]?(true|1)'))Parameters
noise:^\s*[@+-]*\s*(\{\{[^}]*\}\}\s*|\$[({][A-Za-z_]+[)}]\s*)?(#|//|echo\b|printf\b)runners:[../Makefile ../justfile ../Justfile ../Taskfile.yml ../Taskfile.yaml ../../Makefile ../../justfile ../../Justfile ../../Taskfile.yml ../../Taskfile.yaml ../../../Makefile ../../../justfile ../../../Justfile ../../../Taskfile.yml ../../../Taskfile.yaml]
Fix
Set BUNDLE_FROZEN: "true" in the CI environment, or use ruby/setup-ruby with bundler-cache.
Agent instruction: Switch the CI and task-runner installs to the package manager’s locked mode; if that fails, regenerate the lockfile in a separate commit rather than relaxing the install.
Sources
- https://github.com/ossf/scorecard/blob/main/docs/checks.md (standard, Pinned-Dependencies)
- https://fleetlint.org/baseline/#dependencies (convention)
- https://guides.rubygems.org/command-reference/bundle-config/ (spec)
- https://fleetlint.org/stacks/#ruby
Generated by fleetlint docs from catalog v0.7.0.