You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs(auth, avatar): fix misleading and stale docstrings around the security fix
Sweep over the docstrings touched (or adjacent to) PR #290's security work,
prompted by Copilot's post-merge review of withSecurityHeaders and an
adversarial pass from Codex on the rest of the same surface. All changes are
docstring/comment-only; no code, no behavior, no test churn.
* withSecurityHeaders CONSUMER NOTE (auth.go, v2/auth.go) — the previous
text told consumers HTML custom handlers could fix CSP blocking by
"moving scripts/styles to external files served from 'self'", but the
wrapper applies default-src 'none' and sandbox, so even self-hosted
resources are blocked. New text spells out what the wrapper actually
does and gives a concrete relaxed-CSP example. The example list also
drops "dev_provider's login page" — that page is served by
DevAuthServer on its own HTTP listener, not by handlers Service.Handlers
wraps. Replaced with "custom server login pages".
* Proxy.Put godoc — was "stores retrieved avatar to avatar.Store. Gets
image from user info. Returns proxied url", which omitted the identicon
fallback that fires on empty u.Picture, fetch failure, or non-image
upstream bytes. Doc now describes that the function silently substitutes
an identicon in those cases and returns its proxied URL — the caller
is not told the upstream was rejected.
* Proxy.Handler godoc — was "returns token routes for given provider",
a leftover from a much older shape of the code. Replaced with a
description of what Handler actually does today: serves stored avatar
bytes by id, sniffs against an allowlist, sets defense headers.
* Handler's inline serve-time validation comment — said "validate the
bytes really are an image", but Handler reads up to sniffLen bytes
and runs them through http.DetectContentType + an allowlist. That is
content-type sniffing, not proof of full decodability. Reworded to
match.
* Proxy.resize godoc — said "validates that the input is a real image",
but the no-resize path returns the original bytes after only
image.DecodeConfig and the dimension cap; no full decode runs. Split
into format/dimension checks (DecodeConfig only) vs full decode (resize
path only).
* maxAvatarFetchSize constant — mentioned only the remote-URL fetch
path; after #290 the cap also bounds PutContent's caller-supplied
reader and is the implicit size invariant resize trusts. Doc updated
to name both callers.
All changes mirrored across v1 and v2.
0 commit comments