rules:
- id: template-unescaped-with-safe
  message: >-
    Detected a segment of a Flask template where autoescaping is explicitly
    disabled with '| safe' filter. This allows rendering of raw HTML
    in this segment. Ensure no user data is rendered here, otherwise this
    is a cross-site scripting (XSS) vulnerability.
  metadata:
    cwe: "CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')"
    owasp: 'A7: Cross-Site Scripting (XSS)'
    references:
    - https://flask.palletsprojects.com/en/1.1.x/security/#cross-site-scripting-xss
    category: security
    technology:
    - flask
  languages:
  - regex
  paths:
    include:
    - '*.html'
  severity: WARNING
  pattern-regex: '{{.*?\|\s*safe(\s*}})?'
