Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Fixed storefront brakeman issues

Damian Legawiec468091b96100
diff --git a/storefront/app/controllers/spree/products_controller.rb b/storefront/app/controllers/spree/products_controller.rb
index ed05e6a00c..575ce6a0f8 100644
--- a/storefront/app/controllers/spree/products_controller.rb
+++ b/storefront/app/controllers/spree/products_controller.rb
@@ -77,9 +77,7 @@ module Spree
# If an old id or a numeric id was used to find the record,
# we should do a 301 redirect that uses the current friendly id.
if params[:id] != @product.friendly_id
- params[:id] = @product.friendly_id
- params.permit!
- redirect_to url_for(params), status: :moved_permanently
+ redirect_to spree.product_path(@product), status: :moved_permanently
end
end
diff --git a/storefront/app/controllers/spree/taxons_controller.rb b/storefront/app/controllers/spree/taxons_controller.rb
index 0fbe370694..cad78e3de6 100644
--- a/storefront/app/controllers/spree/taxons_controller.rb
+++ b/storefront/app/controllers/spree/taxons_controller.rb
@@ -33,9 +33,7 @@ module Spree
# If an old id or a numeric id was used to find the record,
# we should do a 301 redirect that uses the current friendly id.
if params[:id] != @taxon.friendly_id
- params[:id] = @taxon.friendly_id
- params.permit!
- redirect_to url_for(params), status: :moved_permanently
+ redirect_to spree.nested_taxons_path(@taxon), status: :moved_permanently
end
end
diff --git a/storefront/app/views/spree/checkout/edit.html.erb b/storefront/app/views/spree/checkout/edit.html.erb
index a2726cf3c1..7a943b4187 100644
--- a/storefront/app/views/spree/checkout/edit.html.erb
+++ b/storefront/app/views/spree/checkout/edit.html.erb
@@ -39,7 +39,7 @@
<%= Spree.t(:ship_address) %>
</div>
<div class="px-5 word-break">
- <%= @order.ship_address.to_s.gsub('<br/>', ', ').html_safe %>
+ <%= sanitize(@order.ship_address.to_s.gsub('<br/>', ', ')) %>
</div>
</div>
<div class="text-xs">
@@ -86,7 +86,7 @@
<%= form_for @order, url: spree.update_checkout_path(@order.token, @order.state), html: { id: "checkout_form_#{@order.state}" } do |form| %>
<div>
<%= form.hidden_field :state_lock_version unless @order.errors.any? %>
- <%= render @order.state, form: form %>
+ <%= render partial: "spree/checkout/#{@order.state}", locals: { form: form } %>
</div>
<div>
<%= button_tag Spree.t(:save_and_continue),