Self-hosted project management for devs and their clients: tickets, time tracking, docs and meetings, with an AI assistant that cites its sources. AGPL-3.0.
Ruby agplai-assistantdockerdsgvogdprhotwireissue-trackerjira-alternativeknowledge-basellmmcp-servermeeting-notesopen-sourceproject-managementredmine-alternativeruby-on-railsself-hostedticketingtime-tracking
chore: update ViewComponent to 4.14.0 for GHSA-8qw7-6phv-7q6p
Guido Boyke629cf29dc34a
diff --git a/Gemfile b/Gemfileindex 30a143f..fa278de 100644--- a/Gemfile+++ b/Gemfile@@ -23,10 +23,8 @@ gem 'lexxy', '~> 0.9' # Lexical-based ActionText editor (Wiki notes ongem 'redcarpet'gem 'reverse_markdown' # HTML → GFM-Markdown für die Wiki markdown_body-Projektiongem 'rouge' # Syntax highlighting for documentation code blocks-# Pinned to the 3.x line on 27.08.2026: GHSA-7f3r-gwc9-2995 and GHSA-hg3h-g7xc-f7vp are-# fixed in 3.25.0 as well as in 4.9.0, and without a constraint bundle update would take-# the 4.x major across every component in app/components. Lifting this pin is its own job.-gem 'view_component', '~> 3.25'+# Keep the remediation required by GHSA-8qw7-6phv-7q6p on the 4.14 patch line.+gem 'view_component', '~> 4.14.0'gem 'dotenv-rails' # Loads environment variables from .envgem 'pagy', '~> 9.0'diff --git a/Gemfile.lock b/Gemfile.lockindex ffbfb4b..0ea7aeb 100644--- a/Gemfile.lock+++ b/Gemfile.lock@@ -631,10 +631,10 @@ GEMuseragent (0.16.11)valvat (2.0.1)rexml (>= 3.3.6, < 4.0.0)- view_component (3.27.0)- activesupport (>= 5.2.0, < 8.2)+ view_component (4.14.0)+ actionview (>= 7.1.0)+ activesupport (>= 7.1.0)concurrent-ruby (~> 1)- method_source (~> 1.0)warden (1.2.9)rack (>= 2.0.9)web-console (4.2.1)@@ -738,7 +738,7 @@ DEPENDENCIEStailwindcss-rails (~> 3.3.1)turbo-railsvalvat- view_component (~> 3.25)+ view_component (~> 4.14.0)web-consolewhatlanguagediff --git a/config/application.rb b/config/application.rbindex fa56f51..a94b48f 100644--- a/config/application.rb+++ b/config/application.rb@@ -73,6 +73,6 @@ module Lalabaseconfig.autoload_paths += %W[#{config.root}/app/controllers]# ViewComponent configuration- config.view_component.preview_paths << "#{Rails.root.join('spec/components/previews')}"+ config.view_component.previews.paths << "#{Rails.root.join('spec/components/previews')}"endenddiff --git a/spec/architecture/view_component_previews_spec.rb b/spec/architecture/view_component_previews_spec.rbnew file mode 100644index 0000000..c680411--- /dev/null+++ b/spec/architecture/view_component_previews_spec.rb@@ -0,0 +1,34 @@+# frozen_string_literal: true++require 'rails_helper'++# The configured spec/components/previews path must remain discoverable after+# a ViewComponent upgrade, including the preview with a sidecar ERB template.+RSpec.describe 'ViewComponent previews', type: :request do+ before do+ # The app layout requires authenticated helpers and already breaks previews+ # on main. Check discovery and example rendering independently of that layout.+ allow(Neo::Buttons::ButtonComponentPreview).to receive(:render_args).and_wrap_original do |method, *args, **kwargs|+ method.call(*args, **kwargs).merge(layout: false)+ end+ end++ {+ 'default' => 'Button Text',+ 'all_variants' => 'Primary',+ 'with_icon' => 'Edit Item',+ 'loading_state' => 'Processing...',+ 'with_confirmation' => 'Delete',+ 'as_link' => 'New Item',+ 'disabled' => 'Disabled Button',+ 'form_delete' => 'Delete Item'+ }.each do |example, label|+ it "renders the #{example} button preview" do+ get "/rails/view_components/neo/buttons/button_component/#{example}"++ expect(response).to have_http_status(:ok)+ controls = Nokogiri::HTML5(response.body).css('button, a').map { |node| node.text.squish }+ expect(controls).to include(label)+ end+ end+enddiff --git a/spec/architecture/view_component_render_isolation_spec.rb b/spec/architecture/view_component_render_isolation_spec.rbnew file mode 100644index 0000000..b63fdda--- /dev/null+++ b/spec/architecture/view_component_render_isolation_spec.rb@@ -0,0 +1,49 @@+# frozen_string_literal: true++require 'rails_helper'++# GHSA-8qw7-6phv-7q6p: populated slots and with_content must never survive+# into another request through a reused component instance.+RSpec.describe 'ViewComponent render isolation', :ci_guard, type: :component do+ def populated_component(kind, text)+ case kind+ when :single_slot+ NeoTitleBoxComponent.new(title: 'Header').tap do |component|+ component.with_right_content { text }+ end+ when :multiple_slots+ Neo::OverflowMenuComponent.new.tap do |component|+ component.with_item(label: text, url: '/example')+ end+ when :with_content+ NeoTagComponent.new.with_content(text)+ end+ end++ %i[single_slot multiple_slots with_content].each do |kind|+ it "rejects a second render of an instance populated through #{kind}" do+ component = populated_component(kind, 'First user private content')+ with_request_url('/org/first') { render_inline(component) }+ expect(page).to have_text(:all, 'First user private content')++ with_request_url('/org/second') do+ expect { render_inline(component) }.to raise_error do |error|+ expect(error.class.name).to eq('ViewComponent::ReusedInstanceError')+ end+ end+ end++ it "keeps #{kind} content separate for fresh instances in successive requests" do+ with_request_url('/org/first') do+ render_inline(populated_component(kind, 'First user private content'))+ end+ expect(page).to have_text(:all, 'First user private content')++ with_request_url('/org/second') do+ render_inline(populated_component(kind, 'Second user private content'))+ end+ expect(page).to have_text(:all, 'Second user private content')+ expect(page).to have_no_text(:all, 'First user private content')+ end+ end+end