diff --git a/config/routes.rb b/config/routes.rb index ff693c7..6c78841 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -30,7 +30,7 @@ Rails.application.routes.draw do end direct :fresh_custom_styles do |options| - route_for :account_custom_styles, v: Current.account&.updated_at&.to_fs(:number) + route_for :account_custom_styles, v: Current.account&.updated_at&.to_fs(:epoch) end get "join/:join_code", to: "users#new", as: :join diff --git a/test/system/custom_styles_xss_test.rb b/test/system/custom_styles_xss_test.rb new file mode 100644 index 0000000..2a70875 --- /dev/null +++ b/test/system/custom_styles_xss_test.rb @@ -0,0 +1,39 @@ +require "application_system_test_case" + +class CustomStylesXssTest < ApplicationSystemTestCase + # A stored payload that breaks out of an inline ) + + setup do + accounts(:signal).update!(custom_styles: PAYLOAD) + sign_in "jz@37signals.com" + end + + test "custom styles payload loads as a stylesheet and never executes" do + # (a) custom styles arrive via an external stylesheet link, not inline markup + assert_selector "link[rel='stylesheet'][href*='custom_styles']", visible: false + + # (b) the payload's