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
Audit prompted by review feedback on PR #290's docstrings — the security PR
landed several long, rationale-heavy doc comments and a couple of them turned
out factually wrong. A combined Codex + Explore-agent sweep over the rest of
the v1 package surfaced ~20 more drift items in pre-existing comments. This
commit fixes both classes in one pass and trims the rationale prose from the
security-fix docs down to API-contract sized statements.
Net 28 files changed across v1 and v2; the line count drops by ~30 because
most of the change is shortening, not adding. Build green, lint clean, go fix
clean on both modules.
Drift fixes (pre-existing wrong/misleading comments):
* avatar/gridfs.go — ID doc claimed MD5 sourced from gridfs; in reality
metadata.hash is the sha1 written at Put time.
* avatar/bolt.go, avatar/gridfs.go — Put docs and BoltDB type doc claimed
these layers "resize" the image; they only copy bytes verbatim, resize
happens in Proxy.resize upstream.
* avatar/store.go — Migrate doc didn't mention that per-avatar Get/Put/Close
errors are logged and skipped, and that the returned count is "ids
attempted", not "ids stored".
* provider/oauth1.go — initOauth1Handler doc and DEBUG log both said
"oauth2"; the function and the protocol are OAuth 1.
* provider/service.go — Handler doc said it "returns auth routes"; it
dispatches login/callback/logout.
* provider/telegram.go — processUpdates claimed to return an offset (no
return value); checkToken doc described an "address or empty string"
return shape but the signature is (*token.User, error).
* provider/verify.go — Sender interface doc locked the contract to "send
emails", contradicting the broader "email, IM, or anything else"
promise on VerifyHandler at line 23. AuthHandler comment was copy-pasted
from the direct provider.
* provider/dev_provider.go — NewDev doc said "for admin user"; it makes
the dev oauth2 provider; admin role is separate.
* middleware/user_updater.go — UserUpdFunc adapter doc said the result
"is a Handler"; it implements UserUpdater.
* logger/interface.go — Func adapter doc said "Logf calls f(id)"; calls
f(format, args...).
* token/jwt.go — SendJWTHeader option said "instead of cookie"; Set sends
header and cookie. Set doc referenced a "permanent flag" that doesn't
exist in the signature (controlled by claims.SessionOnly/Handshake). Get
doc oversimplified the XSRF gate (skipped when DisableXSRF, method in
XSRFIgnoreMethods, or claims have no user). Update/Validate adapter docs
said "calls f(id)"; actually f(claims) and f(token, claims).
* token/user.go — HashID inline "or empty" was wrong; an empty val never
matches reValidSha.
* auth.go — BasicAuthChecker doc grammar was broken and understated
behavior; AdminPasswd is bypassed entirely when a checker is set, not
"ignored". "peak dev provider" typo for "peek". AvatarProxy doc was a
sentence fragment.
Trims (rationale prose I wrote in #290; reduced to API contract):
* avatar/avatar.go — maxAvatarFetchSize, maxAvatarPixels, Proxy.Put,
Proxy.Handler godoc, Handler inline sniff comment, Proxy.resize,
safeImgContentType — each cut to what callers/maintainers need to know
about behavior, with rationale moved to the commit history.
* auth.go — withSecurityHeaders dropped its bullet-list explanation of
standard HTTP headers; the CONSUMER NOTE is preserved (real footgun)
but tightened.
All changes mirrored across v1 and v2.
0 commit comments