From 640aa99ebf15d4558002a58027614dd7acf0a1d6 Mon Sep 17 00:00:00 2001 From: Adambomb210 Date: Thu, 19 Nov 2026 16:38:01 -0500 Subject: [PATCH] Fix security alerts: bump vulnerable gems, least-privilege CI permissions, drop CSRF skip on health Co-Authored-By: Claude Sonnet 5.5 --- .github/workflows/ci.yml | 3 + Gemfile.lock | 138 ++++++++++---------- app/controllers/api/v1/health_controller.rb | 1 - spec/requests/api/v1/health_spec.rb | 12 ++ 4 files changed, 84 insertions(+), 70 deletions(-) create mode 100644 spec/requests/api/v1/health_spec.rb diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c432a08d..16912c8a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,6 +9,9 @@ on: - main workflow_dispatch: +permissions: + contents: read + jobs: scan_ruby: runs-on: ubuntu-latest diff --git a/Gemfile.lock b/Gemfile.lock index 72bcd23c..ed6a2a2a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -5,29 +5,29 @@ GEM concurrent-ruby (~> 1.0) action_text-trix (2.1.19) railties - actioncable (8.1.4) - actionpack (= 8.1.4) - activesupport (= 8.1.4) + actioncable (8.1.4.1) + actionpack (= 8.1.4.1) + activesupport (= 8.1.4.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) - actionmailbox (8.1.4) - actionpack (= 8.1.4) - activejob (= 8.1.4) - activerecord (= 8.1.4) - activestorage (= 8.1.4) - activesupport (= 8.1.4) + actionmailbox (8.1.4.1) + actionpack (= 8.1.4.1) + activejob (= 8.1.4.1) + activerecord (= 8.1.4.1) + activestorage (= 8.1.4.1) + activesupport (= 8.1.4.1) mail (>= 2.8.0) - actionmailer (8.1.4) - actionpack (= 8.1.4) - actionview (= 8.1.4) - activejob (= 8.1.4) - activesupport (= 8.1.4) + actionmailer (8.1.4.1) + actionpack (= 8.1.4.1) + actionview (= 8.1.4.1) + activejob (= 8.1.4.1) + activesupport (= 8.1.4.1) mail (>= 2.8.0) rails-dom-testing (~> 2.2) - actionpack (8.1.4) - actionview (= 8.1.4) - activesupport (= 8.1.4) + actionpack (8.1.4.1) + actionview (= 8.1.4.1) + activesupport (= 8.1.4.1) nokogiri (>= 1.8.5) rack (>= 2.2.4) rack-session (>= 1.0.1) @@ -35,42 +35,42 @@ GEM rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) useragent (~> 0.16) - actiontext (8.1.4) + actiontext (8.1.4.1) action_text-trix (~> 2.1.15) - actionpack (= 8.1.4) - activerecord (= 8.1.4) - activestorage (= 8.1.4) - activesupport (= 8.1.4) + actionpack (= 8.1.4.1) + activerecord (= 8.1.4.1) + activestorage (= 8.1.4.1) + activesupport (= 8.1.4.1) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (8.1.4) - activesupport (= 8.1.4) + actionview (8.1.4.1) + activesupport (= 8.1.4.1) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) - rails-html-sanitizer (~> 1.6) + rails-html-sanitizer (~> 1.6, >= 1.7.2) active_storage_validations (4.1.1) activejob (>= 7.0.1) activemodel (>= 7.0.1) activestorage (>= 7.0.1) activesupport (>= 7.0.1) marcel (>= 1.0.3) - activejob (8.1.4) - activesupport (= 8.1.4) + activejob (8.1.4.1) + activesupport (= 8.1.4.1) globalid (>= 0.3.6) - activemodel (8.1.4) - activesupport (= 8.1.4) - activerecord (8.1.4) - activemodel (= 8.1.4) - activesupport (= 8.1.4) + activemodel (8.1.4.1) + activesupport (= 8.1.4.1) + activerecord (8.1.4.1) + activemodel (= 8.1.4.1) + activesupport (= 8.1.4.1) timeout (>= 0.4.0) - activestorage (8.1.4) - actionpack (= 8.1.4) - activejob (= 8.1.4) - activerecord (= 8.1.4) - activesupport (= 8.1.4) + activestorage (8.1.4.1) + actionpack (= 8.1.4.1) + activejob (= 8.1.4.1) + activerecord (= 8.1.4.1) + activesupport (= 8.1.4.1) marcel (~> 1.0) - activesupport (8.1.4) + activesupport (8.1.4.1) base64 bigdecimal concurrent-ruby (~> 1.0, >= 1.3.1) @@ -91,7 +91,7 @@ GEM activesupport csv prism - addressable (2.9.0) + addressable (2.9.2) public_suffix (>= 2.0.2, < 8.0) ahoy_email (4.0.0) actionmailer (>= 7.2) @@ -167,7 +167,7 @@ GEM openssl-signature_algorithm (~> 1.0) countries (8.1.0) unaccent (~> 0.3) - crass (1.0.7) + crass (1.0.8) css_parser (3.3.0) addressable base64 @@ -290,9 +290,9 @@ GEM lint_roller (1.1.0) lockbox (2.2.0) logger (1.7.0) - loofah (2.25.2) + loofah (2.25.3) crass (~> 1.0.2) - nokogiri (>= 1.12.0) + nokogiri (>= 1.19.5) lucide-rails (0.7.4) railties (>= 4.1.0) mail (2.9.1) @@ -318,7 +318,7 @@ GEM railties (>= 7.1) stimulus-rails turbo-rails - msgpack (1.8.5) + msgpack (1.8.7) multi_xml (0.9.1) bigdecimal (>= 3.1, < 5) multipart-post (2.4.1) @@ -338,19 +338,19 @@ GEM net-smtp (0.5.2) net-protocol nio4r (2.7.5) - nokogiri (1.19.4-aarch64-linux-gnu) + nokogiri (1.19.7-aarch64-linux-gnu) racc (~> 1.4) - nokogiri (1.19.4-aarch64-linux-musl) + nokogiri (1.19.7-aarch64-linux-musl) racc (~> 1.4) - nokogiri (1.19.4-arm-linux-gnu) + nokogiri (1.19.7-arm-linux-gnu) racc (~> 1.4) - nokogiri (1.19.4-arm-linux-musl) + nokogiri (1.19.7-arm-linux-musl) racc (~> 1.4) - nokogiri (1.19.4-arm64-darwin) + nokogiri (1.19.7-arm64-darwin) racc (~> 1.4) - nokogiri (1.19.4-x86_64-linux-gnu) + nokogiri (1.19.7-x86_64-linux-gnu) racc (~> 1.4) - nokogiri (1.19.4-x86_64-linux-musl) + nokogiri (1.19.7-x86_64-linux-musl) racc (~> 1.4) oauth2 (2.0.25) anonymous_loader (~> 0.1, >= 0.1.3) @@ -419,7 +419,7 @@ GEM activesupport (>= 3.0.0) raabro (1.5.0) racc (1.8.1) - rack (3.2.7) + rack (3.2.8) rack-attack (6.8.0) rack (>= 1.0, < 4) rack-mini-profiler (5.0.0) @@ -435,20 +435,20 @@ GEM rack (>= 1.3) rackup (2.3.1) rack (>= 3) - rails (8.1.4) - actioncable (= 8.1.4) - actionmailbox (= 8.1.4) - actionmailer (= 8.1.4) - actionpack (= 8.1.4) - actiontext (= 8.1.4) - actionview (= 8.1.4) - activejob (= 8.1.4) - activemodel (= 8.1.4) - activerecord (= 8.1.4) - activestorage (= 8.1.4) - activesupport (= 8.1.4) + rails (8.1.4.1) + actioncable (= 8.1.4.1) + actionmailbox (= 8.1.4.1) + actionmailer (= 8.1.4.1) + actionpack (= 8.1.4.1) + actiontext (= 8.1.4.1) + actionview (= 8.1.4.1) + activejob (= 8.1.4.1) + activemodel (= 8.1.4.1) + activerecord (= 8.1.4.1) + activestorage (= 8.1.4.1) + activesupport (= 8.1.4.1) bundler (>= 1.15.0) - railties (= 8.1.4) + railties (= 8.1.4.1) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) actionview (>= 5.0.1.rc1) @@ -457,12 +457,12 @@ GEM activesupport (>= 5.0.0) minitest nokogiri (>= 1.6) - rails-html-sanitizer (1.7.1) - loofah (~> 2.25, >= 2.25.2) + rails-html-sanitizer (1.7.2) + loofah (~> 2.25, >= 2.25.3) nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) - railties (8.1.4) - actionpack (= 8.1.4) - activesupport (= 8.1.4) + railties (8.1.4.1) + actionpack (= 8.1.4.1) + activesupport (= 8.1.4.1) irb (~> 1.13) rackup (>= 1.0.0) rake (>= 12.2) diff --git a/app/controllers/api/v1/health_controller.rb b/app/controllers/api/v1/health_controller.rb index ec580ced..4a66d53c 100644 --- a/app/controllers/api/v1/health_controller.rb +++ b/app/controllers/api/v1/health_controller.rb @@ -4,7 +4,6 @@ module Api module V1 class HealthController < ApplicationController - skip_before_action :verify_authenticity_token skip_before_action :authenticate_user! def index diff --git a/spec/requests/api/v1/health_spec.rb b/spec/requests/api/v1/health_spec.rb new file mode 100644 index 00000000..75d92fc3 --- /dev/null +++ b/spec/requests/api/v1/health_spec.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +require "rails_helper" + +RSpec.describe "GET /api/v1/health", type: :request do + it "returns ok without authentication" do + get "/api/v1/health" + + expect(response).to have_http_status(:ok) + expect(response.parsed_body).to eq("status" => "ok") + end +end