Set Cache-Control: no-store on authenticated pages #61
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Part of the road to 1.0 (see #33).
SecurityHeaders()(internal/middleware/middleware.go) sets HSTS, CSP,X-Frame-Options,X-Content-Type-Options,Referrer-Policy, andPermissions-Policy, but no cache directives. Authenticated pages (source list/detail/logs, profile) can therefore be cached by browsers and intermediary proxies, potentially exposing webhook configuration and captured event data.Definition of done:
Cache-Control: no-store(andPragma: no-cachefor older intermediaries)/sare unaffected (they are safe to cache)Implementation instructions
Confine to
internal/middleware/middleware.go(plus its test) andinternal/server/routes.goonly.NoCache()middleware tomiddleware.gothat setsCache-Control: no-storeandPragma: no-cacheon every response it wraps, following the same constructor style asSecurityHeaders()/MaxBodySize()(returns afunc(http.Handler) http.Handler).s.mw.NoCache()onto the dynamic app route groups inroutes.go— the/pages,/user/{username},/sources, and/source/{sourceID}groups (the same groups that already useCSRF()), placed adjacent to the existingCSRF()call for readability./s),/metrics,/webhook/{uuid}, or/.well-known/healthcheck— those are not authenticated pages and static assets are safe to cache.Definition of done:
Cache-Control: no-store/smount is not givenno-storeNoCache()sets both headersGates and process:
make fmt; validate withdocker build .(must exit 0; host Go 1.25 vs go.mod 1.26)mainnamedissue-61-no-store; commit subject ends with(closes #61)main) and comment on it with the diff summary and thedocker build .result