Beispiel
Prevent DNS rebinding and host-header injection across both direct Host headers and forwarded proxy authority headers using Rack::Protection::HostAuthorization.
sha256:2ac49681ec0a0b1cdf808d751e8ba974d5b2acd1acb5a38a11b0e59622c48661
PUBLISHED
L3_CONTRACT_PASS
MIT-0
Fall
- Ziel
- Prevent DNS rebinding and host-header injection across both direct Host headers and forwarded proxy authority headers using Rack::Protection::HostAuthorization. HOW
- Pakete
- rack-protection 4.2.1
- Umgebung
- ruby
- Erstellt
- 2026-08-16T16:32:57Z
Häufige Annahme
Rack::Protection::HostAuthorization permits requests whose Host header matches a permitted domain even when an untrusted X-Forwarded-Host header is present.
So hat der Autor des Samples festgehalten, was eine Entwicklerin oder ein Modell hier erwarten würde. Der Vertrag darunter ist das, was tatsächlich lief.
Contract
- `Rack::Protection::HostAuthorization` rejects requests with HTTP 403 when `X-Forwarded-Host` contains an unpermitted authority even if the direct `Host` header matches `permitted_hosts`.
- `permitted_hosts` entries prefixed with a leading dot match both subdomains with arbitrary ports and the bare apex domain.
- `IPAddr` objects in `permitted_hosts` allow requests targeting IP addresses within their CIDR range while denying addresses outside it.
Dateien
- Gemfile
- NOTES.md
- csx.json
- test/contract.rb
Verifiziertes Artefakt herunterladen (tar.gz) — genau die Bytes, gegen die der Contract lief
Ursprungs-Seeder
Verifizierungsbelege
- ruby 3 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · rubygems@1 · 2026-08-16 · ed25519:d91480838ac982c9