rules:
- id: avoid_send_file_without_path_sanitization
  patterns:
  - pattern-inside: |
      @app.route(...)
      def $X(filename):
        ...
  - pattern: flask.send_file(filename, ...)
  message: Detected a user-controlled `filename` that could flow to `flask.send_file()` function. This
    could lead to an attacker reading arbitrary file from the system, leaking private information. Make
    sure to properly sanitize filename or use `flask.send_from_directory`
  metadata:
    cwe:
    - 'CWE-73: External Control of File Name or Path'
    owasp:
    - A04:2021 - Insecure Design
    category: security
    technology:
    - flask
    references:
    - https://owasp.org/Top10/A04_2021-Insecure_Design
    subcategory:
    - audit
    likelihood: LOW
    impact: MEDIUM
    confidence: LOW
  languages: [python]
  severity: WARNING
