httputil is v1.x (API frozen as of v1.0). Only the latest release receives security fixes.
| Version | Supported |
|---|---|
| latest | ✅ |
| < latest | ❌ |
Within the current major version, the latest minor/patch release is supported.
Email git@lars.software with a description of the issue, reproduction steps, and impact assessment.
- Do not open a public GitHub issue for security vulnerabilities.
- You will receive an acknowledgment within 48 hours.
- A fix or mitigation will be prioritized based on severity:
- Critical (RCE, auth bypass): patch within 24 hours of confirmation.
- High (data leak, DoS): patch within 72 hours.
- Medium/Low: next release cycle.
- Once a fix is released, the vulnerability will be documented in the GitHub Release notes and CHANGELOG.
- Coordinated disclosure is preferred — please allow time for a fix before public disclosure.
- Credit will be given to reporters unless they prefer to remain anonymous.
This policy covers the httputil package and its httpspec subpackage.
Out of scope:
- Vulnerabilities in dependencies (
go-error-family,golang.org/x/time) — report to the respective upstream maintainers. - Social engineering attacks against the maintainer.
- Issues requiring access to an already-compromised system.
httputil handles untrusted HTTP input. Security-relevant behaviors:
- CORS:
ClientIPtrusts proxy headers without validation. Only safe behind a reverse proxy that strips or overwritesX-Forwarded-ForandX-Real-IP. - Rate limiting:
KeyedRateLimiteris in-memory per-instance. For distributed deployments, frontKeyedRateLimiterMiddlewarewith a proxy-level limiter (e.g., at your reverse proxy or gateway). - CORS wildcard fallback:
DefaultCORSConfig()setsDenyUnmatched: true(unmatched origins get noAccess-Control-Allow-Origin). A bareCORSConfig{}literal carries the zero value, which falls back to"*"— start fromDefaultCORSConfig()or setDenyUnmatchedexplicitly for hardened deployments. - CORS private-network access:
AllowPrivateNetworkis opt-in and off by default. Enabling it answers Chrome's Local Network Access preflights, granting cross-origin pages from a less-private address space permission to fetch this origin's LAN/localhost subresources — an explicit decision, never a default. - CSRF:
SameSite=NonewithoutSecureis remediated toSecure=trueat construction (rfc6265bis-compliant browsers refuse to store the combination, so the cookie would silently never persist);AllowInsecureSameSiteNoneopts out for legacy-client deployments only. The fallback logs with thecsrf_samesite_insecurecode — configs never weaken silently. - CSRF origin-attestation defense: the middleware cross-checks client-supplied
Sec-Fetch-Site: same-originattestations against theOriginheader on unsafe methods — an attestation contradicted by a cross-origin, untrusted, or unparseableOriginis rejected with 403 (csrf.origin_attestation_conflict), closing the gap where a non-browser client could assert same-origin without a valid token path.X-Forwarded-Protois honored for this check only from configured trusted proxies. - Dependencies:
go-error-family(same author, zero transitive deps),golang.org/x/time(canonical Go rate-limit extension),github.com/justinas/nosurf(CSRF double-submit cookie — security-critical and complex to hand-roll), andgo-etag(same author; error-code registration). No other third-party attack surface.
How the codebase is engineered against untrusted input:
- Config validation at construction — every middleware config runs
Validate(); invalid values are logged with a classified error code and the constructor falls back to safe defaults where one exists (validate-and-log, never panic). - Fail-loud trust boundaries — misconfigured trust (CSRF
TrustedOrigins, trusted-proxy CIDR sets) is rejected at construction with aRejection-family error instead of silently narrowing who the middleware believes. - Never-panic API surface — panics are not used as error handling; wiring and configuration errors return classified errors.
- Fuzz oracles on wire-format parsers — the Accept-Encoding q-value, Accept-Language, and CSRF attestation paths carry fuzz targets with round-trip/parity invariants; committed crashers stay as regression corpus.
- Bomb protection — request decompression enforces a size cap;
MaxBodySizebounds request bodies before handlers run. - CI gates — every push runs the test suite under
-race -shuffle=on, a coverage threshold, andgolangci-lint(~70 linters, 0-issue policy).