Details
The precise consequence depends on which goroutine runs the panic and whether a recover() covers it:
| Wiring | Recovered by net/http? | Result |
|---|---|---|
| Synchronous middleware / handler on net/http (incl. openapi3filter.ValidationHandler) | Yes | Process survives; the one request is aborted. A remote unauthenticated party can still drive connection churn + unbounded http: panic serving log growth. |
| ValidateRequest on an app-spawned goroutine (fan-out, errgroup, async pre-check) | No | Whole process crashes on a single unauthenticated request unless the app added its own recover(). |
| Non-net/http host (fasthttp adaptor, gRPC-gateway shim, CLI, offline/batch spec validator) | No | Whole process crashes. |
This is why the suggested CVSS uses A:L (Base 5.3): under the recommended synchronous net/http wiring the panic is recovered per-connection. Reviewers may reasonably raise it to A:H (Base 7.5) for the spawned-goroutine and non-net/http integrations, where a single request kills the process.
---
Remediation (suggested)
Add a mt.Schema == nil guard mirroring the existing mt == nil guard, so a schema-less content parameter yields a clean validation error instead of a panic:
mt := content.Get("application/json")
if mt == nil {
err = fmt.Errorf("parameter %q has no content schema", param.Name)
return
}
if mt.Schema == nil {
err = fmt.Errorf("parameter %q content media type has no schema", param.Name)
return
}
outSchema = mt.Schema.Value
The unmarshal closure immediately below already tolerates a nil schema (it checks paramSchema != nil), so returning early on nil mt.Schema is consistent with surrounding intent.
Workarounds for consumers, pending a patch:
- Ensure every
contentparameter in served specs declares aschema, or reject such specs at load time. - Supply a custom
ParamDecoderthat guardsmt.Schema == nil. - Run request validation inside a handler with an explicit
recover()— especially if validation runs off the request goroutine or on a non-net/httphost.