ITSM/docs/adr/ADR-007-csp-ohne-inline-js.md

21 lines
905 B
Markdown
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# ADR-007: CSP ohne Inline-JavaScript
**Datum:** 2026-07-15 · **Status:** Akzeptiert
## Kontext
Die Flask-Version renderte onclick-Handler und <script>-Blöcke inline;
eine wirksame Content-Security-Policy war so unmöglich.
## Entscheidung
`script-src 'self'`: alles JavaScript liegt in static/app.js (Event-
Delegation, data-Attribute); zustandsändernde fetches senden X-CSRF-Token.
`style-src 'self' 'unsafe-inline'`: Inline-STYLE-ATTRIBUTE bleiben erlaubt
(dynamische Balkenbreiten etc.) — bewusste, dokumentierte Ausnahme; Inline-
<script> bleibt verboten. Zusätzlich: X-Frame-Options DENY, nosniff,
Referrer-Policy same-origin, HSTS bei ITSM_HTTPS=1.
## Konsequenzen
+ XSS-Einschlag drastisch reduziert (kein Skript außerhalb /static ausführbar).
style-src-Ausnahme ist ein Rest-Risiko (CSS-Injection); akzeptiert, da
alle Ausgaben escaped werden (Askama-Autoescape + esc() im JS).