admin: Redact sensitive request headers in API logs#7578
admin: Redact sensitive request headers in API logs#7578steadytao wants to merge 1 commit intocaddyserver:masterfrom
Conversation
|
We could possibly move But I'm okay with this too. |
da6fd61 to
0aff561
Compare
@francislavoie Much better. Much appreciated. |
@themavik Thanks. |
|
Ignore that. It was a shitty AI bot spamming hundreds of repos. We blocked it and reported it. |
Ah, much appreciated |
Fixes the admin API request logging path so sensitive request headers are redacted instead of being logged verbatim.
Before this change,
adminHandler.ServeHTTPlogged headers withzap.Reflect("headers", r.Header), which bypassed the normal header redaction behavior used elsewhere in the codebase. This could expose values from headers such asAuthorization,Proxy-Authorization,Cookie, andSet-Cookiein admin API logs.This change replaces that raw header logging with a structured marshaler that redacts those sensitive headers while leaving ordinary headers visible.
Why
adminLoggableHTTPHeaderinstead of reusingloggableHTTPHeader?modules/caddyhttp, butadmin.gois in the rootcaddypackage. Importingmodules/caddyhttpfromadmin.gocreates an import cycle (caddy -> modules/caddyhttp -> caddy) so the admin handler cannot directly reuse that type. For this fix, the smallest clean option is to keep an admin-specific private marshaler inadmin.gowith the same redaction behavior.This change:
Authorization,Proxy-Authorization,Cookie, andSet-Cookiein admin API request logsShould fix #7566.
Assistance Disclosure
No AI was used.