MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / securityHeaders

Function securityHeaders

internal/httpapi/middleware.go:142–147  ·  view source on GitHub ↗

securityHeaders applies the baseline security headers the audit found missing (api-v1-redesign "HTTP header conventions"). It deliberately sets only the universally-safe `X-Content-Type-Options: nosniff` at this layer; HSTS is an edge (Caddy) concern and the stricter CSP/frame headers belong on the

(next http.Handler)

Source from the content-addressed store, hash-verified

140// on the HTML confirmation pages, which set their own. Applying nosniff
141// globally is additive and never breaks a JSON or HTML response.
142func securityHeaders(next http.Handler) http.Handler {
143 return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
144 w.Header().Set("X-Content-Type-Options", "nosniff")
145 next.ServeHTTP(w, r)
146 })
147}

Callers

nothing calls this directly

Calls 1

ServeHTTPMethod · 0.45

Tested by

no test coverage detected