Skip to content

Commit 0a0a6dd

Browse files
committed
Replaced CGI.escapeHTML() with the html_escape()
1 parent ad754f1 commit 0a0a6dd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

ruby/ql/src/experimental/cwe-176/examples/unicode_normalization.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
require "erb"
2+
13
class UnicodeNormalizationHtMLSafeController < ActionController::Base
24
def unicodeNormalize
35
unicode_input = params[:unicode_input]
4-
unicode_html_safe = CGI.escapeHTML(unicode_input).html_safe
6+
unicode_html_safe = ERB::Util.html_escape(unicode_input)
57
normalized_nfkc = unicode_html_safe.unicode_normalize(:nfkc) # $result=BAD
68
normalized_nfc = unicode_html_safe.unicode_normalize(:nfc) # $result=BAD
79
end

0 commit comments

Comments
 (0)