-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Title: app.py: Insufficient Output Sanitization
Body:
The Content-Security-Policy (CSP) in app.py includes 'unsafe-inline' for script-src and style-src. While the CSP is present, allowing 'unsafe-inline' significantly weakens its protection against XSS attacks. Attackers could inject malicious JavaScript or CSS directly into HTML attributes (e.g., onclick, style) or within <script> or <style> tags, bypassing the CSP. This is exacerbated by the presence of user provided or dynamically generated content which is used but not escaped or santized.
To address this, strive to remove 'unsafe-inline' and use nonces or hashes for inline scripts and styles. For user-generated content, implement proper output encoding/escaping to prevent the injection of malicious code. For example, if you're rendering HTML, use a template engine that automatically escapes HTML entities.