Skip to content

Commit

Permalink
Bump ViewComponent to v3.9.0 (#492)
Browse files Browse the repository at this point in the history
This addresses an XSS vector
ViewComponent/view_component#1950
  • Loading branch information
peteryates authored Jan 5, 2024
2 parents a9e260d + eef1e42 commit 1d7c7b6
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/components/govuk_component/tab_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Tab < GovukComponent::Base

def initialize(label:, text: nil, classes: [], html_attributes: {})
@label = label
@text = text
@text = h(text)

super(classes: classes, html_attributes: html_attributes)
end
Expand Down
2 changes: 1 addition & 1 deletion govuk-components.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Gem::Specification.new do |spec|

spec.add_dependency("html-attributes-utils", "~> 1.0.0", ">= 1.0.0")
spec.add_dependency("pagy", "~> 6.0")
spec.add_dependency("view_component", ">= 3.3", "< 3.9")
spec.add_dependency("view_component", ">= 3.9", "< 3.10")

spec.add_development_dependency "deep_merge"
spec.add_development_dependency "pry-byebug"
Expand Down
2 changes: 1 addition & 1 deletion guide/lib/examples/pagination_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# links expect a Rack request.
module Pagy::UrlHelpers
def request
OpenStruct.new(GET: {}, session: nil, host: "https://somesite/")
OpenStruct.new(GET: {}, session: nil, host: "https://somesite/", format: OpenStruct.new(html?: true))
end
end

Expand Down
4 changes: 3 additions & 1 deletion spec/components/govuk_component/header_component_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
RSpec.describe(GovukComponent::HeaderComponent, type: :component) do
before do
allow_any_instance_of(GovukComponent::HeaderComponent::NavigationItem).to(
receive(:request).and_return(double(ActionDispatch::Request, get?: true, path: current_page))
receive(:current_page?).and_wrap_original do |_original_method, path|
path == current_page
end
)
end

Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

module Pagy::UrlHelpers
def request
OpenStruct.new(GET: {}, session: nil, host: "https://somesite/")
OpenStruct.new(GET: {}, session: nil, host: "https://somesite/", format: OpenStruct.new(html?: true))
end
end

Expand Down

0 comments on commit 1d7c7b6

Please sign in to comment.