File tree Expand file tree Collapse file tree
ruby/ql/test/query-tests/experimental/cwe-176 Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ require "erb"
2+ include ERB ::Util
3+ require 'cgi'
4+
15class UnicodeNormalizationOKController < ActionController ::Base
26 def unicodeNormalize
37 unicode_input = params [ :unicode_input ]
@@ -15,11 +19,20 @@ def unicodeNormalize
1519 end
1620end
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
2529end
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
You can’t perform that action at this time.
0 commit comments