Files
89caf73173 Add bundler-audit to Ruby CI security checks (#5921)
## Summary
- Add locked `bundler-audit` tooling and run `bundle exec bundler-audit
check --update` in the Ruby security CI job.
- Keep Brakeman application analysis, correct its label, and document
the dependency audit.
- Remediate all 14 baseline advisory matches with targeted lockfile
upgrades:
  - css_parser 3.0.0 → 3.3.0
  - puma 7.2.1 → 7.2.3
  - rack-protection 4.2.1 → 4.2.2
  - view_component 4.12.0 → 4.14.0
- No advisory ignores, warning-only bypasses, new runtime gems, or
unrelated version upgrades. css_parser now declares the already-locked
base64 dependency.

## Test stabilization
The existing credit-card due-date assertion matched the entire page,
including unrelated fixture transaction dates. On November 29 it failed
against the original dependency versions too. Scope its checks to the
credit-card summary; application code is unchanged.

## Audit results
Baseline main `746ed7eca`: 14 advisory matches across four gems, exit 1.
After remediation: **No vulnerabilities found**, exit 0, against
refreshed ruby-advisory-db `c87703e7f2c64f8745ce032711308a17d10cda55`.
The CI command refreshes advisories on every run and fails on matches or
refresh failures. This is advisory-based detection, not a guarantee that
no unknown vulnerabilities exist.

<details>
<summary>Original dry-run findings</summary>

```text
Download ruby-advisory-db ...
Cloning into '/data/.local/share/ruby-advisory-db'...
ruby-advisory-db:
  advisories:	1411 advisories
  last updated:	2026-11-22 09:40:03 -0500
  commit:	c87703e7f2c64f8745ce032711308a17d10cda55
Name: css_parser
Version: 3.0.0
GHSA: GHSA-84w7-hpvm-rxx2
Criticality: Unknown
URL: https://github.com/premailer/css_parser/security/advisories/GHSA-84w7-hpvm-rxx2
Title: ReDoS - expand_shorthand! regex (RE_FUNCTIONS) backtracks exponentially on an unclosed CSS function value
Solution: update to '>= 3.2.0'

Name: css_parser
Version: 3.0.0
GHSA: GHSA-w3mx-4vv9-hjpg
Criticality: Medium
URL: https://github.com/premailer/css_parser/security/advisories/GHSA-w3mx-4vv9-hjpg
Title: Arbitrary local-file read via attacker-controlled `@import` into `load_file!` (the `base_dir` branch of `add_block!`) - incomplete fix of GHSA-9pmc-p236-855h
Solution: update to '>= 3.3.0'

Name: puma
Version: 7.2.1
GHSA: GHSA-4v6q-hvv7-49h9
Criticality: Unknown
URL: https://github.com/puma/puma/security/advisories/GHSA-4v6q-hvv7-49h9
Title: Memory exhaustion with SSL connections
Solution: update to '~> 7.2.3', '~> 8.0.4', '>= 8.1.2'

Name: puma
Version: 7.2.1
GHSA: GHSA-86xc-wrr9-xmmq
Criticality: Unknown
URL: https://github.com/puma/puma/security/advisories/GHSA-86xc-wrr9-xmmq
Title: pumactl does not verify the TLS identity of SSL control servers
Solution: update to '~> 7.2.2', '>= 8.0.3'

Name: puma
Version: 7.2.1
GHSA: GHSA-jm4r-w4xx-qxw7
Criticality: Unknown
URL: https://github.com/puma/puma/security/advisories/GHSA-jm4r-w4xx-qxw7
Title: Graceful shutdown waits indefinitely on trickled request bodies
Solution: update to '~> 7.2.2', '>= 8.0.3'

Name: puma
Version: 7.2.1
GHSA: GHSA-m5xw-3hrw-qcmf
Criticality: Unknown
URL: https://github.com/puma/puma/security/advisories/GHSA-m5xw-3hrw-qcmf
Title: Reactor timeout queue loses order, letting a slow client keep other connections open past their timeout
Solution: update to '~> 7.2.2', '>= 8.0.3'

Name: puma
Version: 7.2.1
GHSA: GHSA-r885-m39c-939g
Criticality: Unknown
URL: https://github.com/puma/puma/security/advisories/GHSA-r885-m39c-939g
Title: ssl_cipher_filter values containing `+` are decoded to a wider cipher list
Solution: update to '~> 7.2.2', '>= 8.0.3'

Name: puma
Version: 7.2.1
GHSA: GHSA-rf6g-xhmp-gm7v
Criticality: Unknown
URL: https://github.com/puma/puma/security/advisories/GHSA-rf6g-xhmp-gm7v
Title: Accept loop retries without pausing when out of file descriptors, flooding the log
Solution: update to '~> 7.2.2', '>= 8.0.3'

Name: puma
Version: 7.2.1
GHSA: GHSA-x646-wp7c-h9mg
Criticality: Unknown
URL: https://github.com/puma/puma/security/advisories/GHSA-x646-wp7c-h9mg
Title: Client that stops reading a TLS or file response holds a worker thread indefinitely
Solution: update to '~> 7.2.2', '>= 8.0.3'

Name: puma
Version: 7.2.1
GHSA: GHSA-xw3h-pgr9-3vg7
Criticality: Unknown
URL: https://github.com/puma/puma/security/advisories/GHSA-xw3h-pgr9-3vg7
Title: Reactor blocks on `100 Continue` writes to clients that stop reading, stalling other connections
Solution: update to '~> 7.2.2', '>= 8.0.3'

Name: rack-protection
Version: 4.2.1
GHSA: GHSA-pf75-2v58-7mxg
Criticality: High
URL: https://github.com/sinatra/sinatra/security/advisories/GHSA-pf75-2v58-7mxg
Title: rack-protection - one request makes CookieTossing reject, or drop the session of, every later request
Solution: update to '>= 4.2.2'

Name: rack-protection
Version: 4.2.1
GHSA: GHSA-r29j-38x9-qr26
Criticality: Medium
URL: https://github.com/sinatra/sinatra/security/advisories/GHSA-r29j-38x9-qr26
Title: rack-protection - HostAuthorization permits unrelated hosts that end with a leading-dot permitted host
Solution: update to '>= 4.2.2'

Name: rack-protection
Version: 4.2.1
GHSA: GHSA-vvhm-j6m8-64cw
Criticality: Low
URL: https://github.com/sinatra/sinatra/security/advisories/GHSA-vvhm-j6m8-64cw
Title: rack-protection - a missing Referer is treated as same-origin, allowing a bypass of JsonCsrf, RemoteToken and RemoteReferrer
Solution: update to '>= 4.2.2'

Name: view_component
Version: 4.12.0
GHSA: GHSA-8qw7-6phv-7q6p
Criticality: Medium
URL: https://github.com/ViewComponent/view_component/security/advisories/GHSA-8qw7-6phv-7q6p
Title: ViewComponent - Incomplete fix for CVE-2026-54497 — slot and with_content state still leak across reused component instances
Solution: update to '>= 4.14.0'

Vulnerabilities found!
```
</details>

## Validation
- Fresh dependency audit: exit 0, no vulnerabilities found (no ignores).
- Full Rails suite, seed 2791: **19,519 runs, 117,504 assertions, 0
failures/errors, 9 skips**.
- Browser smoke (`test/system/transaction_category_select_test.rb`):
**12 runs, 46 assertions, 0 failures/errors**, using Puma 7.2.3 and
Chrome 158.
- Transfer-controller regression suite: 77 runs, 325 assertions, 0
failures/errors.
- Ruby lint, full-tree ERB lint, Biome, Brakeman, and `git diff --check`
pass.
- Earlier failed runs were preserved: one crossed UTC midnight and
triggered login auto-sync before the transfer lock assertion; another
exposed the baseline date assertion described above. Neither is counted
as a passing run. Final full run is fresh, non-overlapping, and passing.
- GitHub's full CI (including full browser suites) remains the final
review gate.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Chores**
* CI now audits Ruby dependencies and refreshes its advisory database as
part of security checks.
  * Added a command for running the dependency audit locally.
* **Documentation**
* Updated development guidance with the audit command and details on CI
checks and dependency triage.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Juan José Mata <juanjo.mata@gmail.com>
Co-authored-by: SureBot <sure-bot@we-promise.com>
Co-authored-by: Juan José Mata <juanjo.mata@gmail.com>
2026-11-29 15:10:46 -08:00

165 lines
3.5 KiB
Ruby

source "https://rubygems.org"
ruby file: ".ruby-version"
# Rails
gem "rails", "~> 8.1.0"
# Drivers
gem "pg", "~> 1.5"
gem "redis", "~> 5.4"
# Bech32/Bech32m encoding for watch-only Bitcoin addresses.
gem "bech32", "1.5.1"
# Deployment
gem "puma", ">= 7.2.1"
gem "bootsnap", require: false
# Assets
gem "importmap-rails"
gem "propshaft"
gem "tailwindcss-rails"
gem "lucide-rails"
# Hotwire + UI
gem "stimulus-rails"
gem "turbo-rails"
gem "view_component"
# https://github.com/lookbook-hq/lookbook/issues/712
# TODO: Remove max version constraint when fixed
gem "lookbook", "2.3.11"
gem "hotwire_combobox"
# Standards-based browser push encryption and VAPID signing
gem "web-push", "~> 3.1", require: "web_push"
# Background Jobs
gem "connection_pool", "~> 2.5" # pin to 2.x; 3.0 breaks sidekiq 8.x
gem "sidekiq"
gem "sidekiq-cron"
gem "sidekiq-unique-jobs"
# Monitoring
gem "vernier"
gem "rack-mini-profiler"
gem "sentry-ruby"
gem "sentry-rails"
gem "sentry-sidekiq"
gem "posthog-rails", "~> 3.26.0", require: false
gem "logtail-rails"
if ENV["SKYLIGHT_ENABLED"] == "true"
gem "skylight", group: :development, require: false
else
gem "skylight", group: :production
end
# Active Storage
gem "aws-sdk-s3", "~> 1.208.0", require: false
gem "google-cloud-storage", "~> 1.59", require: false
gem "image_processing", ">= 1.2"
# Other
gem "ostruct"
gem "bcrypt", "~> 3.1"
gem "jwt"
gem "apnotic", "~> 1.8"
gem "jbuilder"
gem "countries"
# OAuth & API Security
gem "doorkeeper"
gem "rack-attack", "~> 6.6"
gem "rack-cors"
gem "pundit"
gem "faraday"
gem "faraday-retry"
gem "faraday-multipart"
gem "inline_svg"
gem "octokit"
gem "pagy"
gem "rails-i18n"
gem "rails-settings-cached"
gem "tzinfo-data", platforms: %i[mswin mswin64 mingw x64_mingw jruby]
gem "csv"
gem "rchardet" # Character encoding detection
gem "redcarpet"
gem "stripe"
gem "plaid"
gem "httparty"
gem "rotp", "~> 6.3"
gem "rqrcode", "~> 3.0"
gem "webauthn", "~> 3.4"
gem "websocket-driver", "~> 0.8"
gem "activerecord-import"
gem "rubyzip", "~> 3.4"
gem "pdf-reader", "~> 2.12"
# OpenID Connect, OAuth & SAML authentication
gem "omniauth", "~> 2.2"
gem "omniauth-rails_csrf_protection", ">= 2.0"
gem "omniauth_openid_connect"
gem "omniauth-google-oauth2"
gem "omniauth-github"
gem "omniauth-saml", "~> 2.1"
# State machines
gem "aasm"
gem "after_commit_everywhere", "~> 1.0"
# AI
gem "ruby-openai"
gem "anthropic", "~> 1.0"
# AI transports (app/models/ai/transport). RubyLLM's API changes between minor releases, so
# Gemfile.lock holds the version the AI tests run against; a contract test checks the API Sure uses.
gem "ruby_llm", "~> 2.1"
gem "opentelemetry-sdk", "~> 1.13"
gem "opentelemetry-exporter-otlp", "~> 0.36"
group :development, :test do
gem "debug", platforms: %i[mri mswin mswin64 mingw x64_mingw]
gem "brakeman", require: false
gem "bundler-audit", "~> 0.9", require: false
gem "rubocop-rails-omakase", require: false
gem "i18n-tasks"
gem "erb_lint"
gem "dotenv-rails"
end
if ENV["BENCHMARKING_ENABLED"]
gem "dotenv-rails", groups: [ :production ]
end
group :development do
gem "hotwire-livereload"
gem "letter_opener"
gem "ruby-lsp-rails"
gem "web-console"
gem "faker"
gem "benchmark-ips"
gem "stackprof"
gem "derailed_benchmarks"
gem "foreman"
end
group :development, :test do
gem "rspec-rails"
gem "rswag-api"
gem "rswag-specs"
gem "rswag-ui"
end
group :test do
gem "capybara"
gem "selenium-webdriver"
gem "minitest", "~> 6.1"
gem "minitest-mock"
gem "mocha"
gem "vcr"
gem "webmock"
gem "climate_control"
gem "simplecov", require: false
end