-
-
Notifications
You must be signed in to change notification settings - Fork 468
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update specs to match on translations
In Rails 7.13.1 and 7.0.8.1, a XSS vulnerability was closed that updated how translated strings are dealth with. GHSA-9822-6m93-xqf4 This change to specs updates how we verify acceptance (using the translation instead of a regex) and also adds in a helper to conditionally html escape the string based on the Rails version.
- Loading branch information
Showing
4 changed files
with
21 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module HTMLEscapeHelper | ||
def translated_string(key) | ||
if Rails.version >= "7.0" | ||
ERB::Util.html_escape_once(I18n.t(key)) | ||
else | ||
I18n.t(key) | ||
end | ||
end | ||
end | ||
|
||
RSpec.configure do |config| | ||
config.include HTMLEscapeHelper | ||
end |