rules:
- id: avoid-html-safe
  metadata:
    owasp: 'A7: Cross-Site Scripting (XSS)'
    cwe: "CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')"
    references:
    - https://github.com/presidentbeef/brakeman/blob/main/docs/warning_types/cross_site_scripting/index.markdown
    - https://www.netsparker.com/blog/web-security/preventing-xss-ruby-on-rails-web-applications/
    category: security
    technology:
    - rails
  message: >-
    'html_safe()' does not make the supplied string safe. 'html_safe()' bypasses
    HTML escaping. If external data can reach here, this exposes your application
    to cross-site scripting (XSS) attacks. Ensure no external data reaches here.
  languages: [ruby]
  severity: WARNING
  pattern-either:
  - pattern: $STR.html_safe
  - pattern: $STR.html_safe.$MORE
