Unsafe output in page templates reviewed and fixed
Security
Why it matters: Text shown on the site can't be turned into code that runs in your browser.
We reviewed the places in our page templates that write out text without the usual protections. None could be misused, because no visitor’s input reaches them, and they’ve been rewritten so they can’t become unsafe later. One, built by our error-tracking library from its own IDs, was left as it is.
An automated check of every page template now runs on every change, so new pages are held to the same standard.
Commits (2)
-
0847c99Unescaped output: verdicts and fixes for every raw, html_safe and ERB-in-script/attribute spot -
cc3c456Herb's full rule set in CI and at commit time
Files Changed (15)
.github/workflows/ci.yml | 6 ++-- app/helpers/pages_helper.rb | 22 ++++++++++------ app/helpers/structured_data_helper.rb | 8 ++++++ app/views/admin/golfer_results/edit.html.erb | 7 ++---- app/views/help/pages/about_eyeonmajors.html.erb | 46 ++++++++++++------------------- app/views/layouts/application.html.erb | 3 ++- app/views/pages/_faqs.html.erb | 10 ++------ app/views/patron/leaderboards/index.html.erb | 4 ++-- app/views/subscriptions/new.html.erb | 19 ++++++------- bin/setup | 8 ++++++ lefthook.yml | 4 +++ package.json | 2 +- test/helpers/pages_helper_test.rb | 14 ++++++++++ test/helpers/structured_data_helper_test.rb | 15 ++++++++++ test/integration/structured_data_test.rb | 27 ++++++++++++++++++ 15 files changed, 128 insertions(+), 67 deletions(-)