Skip to content

Commit f7f0564

Browse files
committed
added one more test
1 parent 0a0a6dd commit f7f0564

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

ruby/ql/test/query-tests/experimental/cwe-176/unicode_normalization.rb

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
require "erb"
2+
include ERB::Util
3+
require 'cgi'
4+
15
class UnicodeNormalizationOKController < ActionController::Base
26
def unicodeNormalize
37
unicode_input = params[:unicode_input]
@@ -15,11 +19,20 @@ def unicodeNormalize
1519
end
1620
end
1721

18-
class UnicodeNormalizationHtMLSafeController < ActionController::Base
22+
class UnicodeNormalizationHtMLEscapeController < ActionController::Base
1923
def unicodeNormalize
2024
unicode_input = params[:unicode_input]
21-
unicode_html_safe = CGI.escapeHTML(unicode_input).html_safe
25+
unicode_html_safe = html_escape(unicode_input)
2226
normalized_nfkc = unicode_html_safe.unicode_normalize(:nfkc) # $result=BAD
2327
normalized_nfc = unicode_html_safe.unicode_normalize(:nfc) # $result=BAD
2428
end
2529
end
30+
31+
class UnicodeNormalizationCGIHtMLEscapeController < ActionController::Base
32+
def unicodeNormalize
33+
unicode_input = params[:unicode_input]
34+
unicode_html_safe = CGI.escapeHTML(unicode_input).html_safe
35+
normalized_nfkc = unicode_html_safe.unicode_normalize(:nfkd) # $result=BAD
36+
normalized_nfc = unicode_html_safe.unicode_normalize(:nfd) # $result=BAD
37+
end
38+
end

0 commit comments

Comments
 (0)