HEADER-001PASS
Gültiger Content-Type Header
Beispielanfrage
curl -X POST -H "Content-Type: application/json" -d '{"name": "test"}' http://localhost:8080/api/usersAnfragen mit korrektem Content-Type werden normal verarbeitet.
12 Tests demonstrieren Content-Type-Prüfung, Header-Filterung und Injection-Prävention.
Header-Validierungsregeln in policy.yaml:
# policy.yaml
headers:
request:
blocked:
- "X-Forwarded-For" # IP-Spoofing verhindern
- "X-Real-IP" # IP-Spoofing verhindern
required:
- name: "Content-Type"
pattern: "^application/(json|x-www-form-urlencoded)$"
max_size: 8192curl -X POST -H "Content-Type: application/json" -d '{"name": "test"}' http://localhost:8080/api/usersAnfragen mit korrektem Content-Type werden normal verarbeitet.
curl -X POST -H "Content-Type: text/xml" http://localhost:8080/api/usersHTTP/1.1 415 Unsupported Media TypeAnfragen mit nicht erlaubtem Content-Type werden mit 415 abgelehnt.
curl -H "X-Forwarded-For: 1.2.3.4" http://localhost:8080/api/usersHeaders, die für IP-Spoofing oder Umgehung von Sicherheitskontrollen verwendet werden könnten, werden blockiert.
curl -H $'X-Custom: value\r\nX-Injected: malicious' http://localhost:8080/CRLF-Sequenzen (\r\n) in Header-Werten werden erkannt und blockiert, um HTTP Response Splitting-Angriffe zu verhindern.
curl -H "X-Large: $(python3 -c 'print("A"*10000)')" http://localhost:8080/HTTP/1.1 431 Request Header Fields Too LargeHeaders, die die konfigurierte Maximalgröße überschreiten, werden abgelehnt.