class Foobar def create_user_description(name) "

#{name}

".html_safe # NOT OK - the parameter is not escaped # escape "

#{ERB::Util.html_escape(name)}

".html_safe # OK - the parameter is escaped end def string_like_literal name h = <<-HTML

#{name}

HTML h.html_safe # NOT OK - the parameter is not escaped end def sprintf_use name sprintf("

%s

", name).html_safe # NOT OK - the parameter is not escaped # escape sprintf("

%s

", ERB::Util.html_escape(name)).html_safe # OK - the parameter is escaped end def create_user_description2(name) "

#{name}

".html_safe # NOT OK - the value is not necessarily HTML safe if name.html_safe? "

#{name}

".html_safe # OK - value is marked as being HTML safe end end end