# 🛡️ CSP-Fehler Analyse & Lösungen

## 📊 Deine CSP-Fehler im Detail

### ✅ WP Swift Contact - KEIN Problem
Das Plugin selbst verursacht **KEINE** CSP-Fehler! 

### ❌ Andere Plugins/Quellen

#### 1. **Base64-Font-Fehler**
```
Loading the font 'data:application/x-font-woff...' violates CSP
```
**Quelle:** WordPress Dashicons ODER dein Theme
**Nicht von WP Swift Contact!**

**Lösung:** Füge zu deiner CSP hinzu:
```nginx
font-src 'self' data:;
```

---

#### 2. **Air Datepicker (jsdelivr CDN)**
```
Loading stylesheet/script 'cdn.jsdelivr.net/npm/air-datepicker'
```
**Quelle:** Ein anderes Plugin das Air Datepicker nutzt (vermutlich Buchungs-Plugin oder Formular-Plugin)

**Lösung:** Füge zu deiner CSP hinzu:
```nginx
script-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net;
style-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net;
```

---

#### 3. **Borlabs Cookie Widget**
```
Unsafe attempt to load URL borlabs-cookie-widget-a.svg
```
**Quelle:** Borlabs Cookie Plugin

**Lösung:** Borlabs Cookie hat eigene CSP-Einstellungen

---

#### 4. **Feature-Policy / Permissions-Policy**
```
Invalid allowlist item(none) for feature camera/geolocation/microphone
```
**Quelle:** Deine nginx/Server-Konfiguration

**Problem:** `(none)` ist falsche Syntax. Richtig: `'none'` (mit Anführungszeichen)

**Lösung:**
```nginx
# FALSCH:
Permissions-Policy: camera=(none), geolocation=(none)

# RICHTIG:
Permissions-Policy: camera=(), geolocation=(), microphone=()
```

---

## ✅ Komplette CSP für deine Website

### nginx-Konfiguration (empfohlen)

```nginx
# Komplette CSP für 4kfilmliste.de
add_header Content-Security-Policy "
    default-src 'self';
    script-src 'self' 'unsafe-inline' https://www.google.com https://www.gstatic.com https://cdn.jsdelivr.net;
    style-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net;
    font-src 'self' data:;
    frame-src 'self' https://www.google.com;
    img-src 'self' data: https:;
    connect-src 'self';
" always;

# Permissions-Policy korrigieren
add_header Permissions-Policy "
    camera=(),
    geolocation=(),
    microphone=(),
    autoplay=(self)
" always;
```

### Minimal (nur für WP Swift Contact)

```nginx
add_header Content-Security-Policy "
    script-src 'self' 'unsafe-inline' https://www.google.com https://www.gstatic.com;
    frame-src 'self' https://www.google.com;
    font-src 'self' data:;
" always;
```

---

## 🔍 Welche Plugins verursachen welche CSP-Fehler?

| Fehler | Plugin | Lösung |
|--------|--------|--------|
| Base64-Font | WordPress Dashicons / Theme | `font-src 'self' data:` |
| air-datepicker | Anderes Plugin | `cdn.jsdelivr.net` erlauben |
| Borlabs SVG | Borlabs Cookie | Borlabs Cookie Einstellungen |
| reCAPTCHA | **WP Swift Contact** | `google.com` + `gstatic.com` |
| Permissions-Policy | Server-Config | Syntax korrigieren |

---

## 🎯 Schnelle Lösung

### Option 1: Nur reCAPTCHA (minimal)

```nginx
add_header Content-Security-Policy "
    script-src 'self' 'unsafe-inline' https://www.google.com https://www.gstatic.com;
    frame-src 'self' https://www.google.com;
" always;
```

### Option 2: Alle Fehler beheben (komplett)

```nginx
add_header Content-Security-Policy "
    default-src 'self';
    script-src 'self' 'unsafe-inline' https://www.google.com https://www.gstatic.com https://cdn.jsdelivr.net 'unsafe-eval';
    style-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net;
    font-src 'self' data:;
    frame-src 'self' https://www.google.com;
    img-src 'self' data: https:;
    connect-src 'self';
    worker-src 'self' blob:;
" always;

add_header Permissions-Policy "camera=(), geolocation=(), microphone=(), autoplay=(self)" always;
```

---

## 📝 Wo CSP konfigurieren?

### nginx

Öffne deine Site-Config:
```bash
sudo nano /etc/nginx/sites-available/4kfilmliste.de
```

Füge im `server {}` Block hinzu (siehe oben).

Test & Reload:
```bash
sudo nginx -t
sudo systemctl reload nginx
```

### Apache (.htaccess)

```apache
<IfModule mod_headers.c>
    Header set Content-Security-Policy "script-src 'self' 'unsafe-inline' https://www.google.com https://www.gstatic.com https://cdn.jsdelivr.net; style-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net; font-src 'self' data:; frame-src 'self' https://www.google.com;"
    
    Header set Permissions-Policy "camera=(), geolocation=(), microphone=(), autoplay=(self)"
</IfModule>
```

---

## ✅ Nach Änderung testen

1. Browser-Cache leeren (Strg+Shift+R)
2. Seite neu laden
3. F12 → Console öffnen
4. Keine CSP-Fehler mehr? ✅ Fertig!

---

## 🆘 Weitere Hilfe

**Browser-Konsole (F12) zeigt immer noch Fehler?**
→ Screenshot machen und an uns senden: https://proleads.online

**Welches Plugin verursacht was?**
→ Plugins nacheinander deaktivieren und testen

---

**Wichtig:** WP Swift Contact selbst verursacht KEINE CSP-Probleme außer reCAPTCHA (das ist gewollt und nötig)!
