docs(handler): document cookie attributes and MaxAge behaviour#576
Draft
github-actions[bot] wants to merge 1 commit into
Draft
docs(handler): document cookie attributes and MaxAge behaviour#576github-actions[bot] wants to merge 1 commit into
github-actions[bot] wants to merge 1 commit into
Conversation
The setCookie helper (extracted in #570) centralises Path, HttpOnly, SameSite, and Secure for all four public cookie functions. cookies.md previously omitted these shared attributes and did not explain the session-cookie semantics of SetAuthCookie (MaxAge: 0) or the deletion semantics of the Clear* helpers (MaxAge: -1). - Add a shared-attributes table covering Path, HttpOnly, SameSite, and the caller-controlled Secure flag. - Document SetAuthCookie as a session cookie and explain when to use it. - Document that Clear* helpers set MaxAge: -1 to delete the cookie. - Document that SetRefreshCookie accepts an explicit maxAge so the cookie persists across browser sessions. - Remove inline comments that restated only a subset of attributes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
cookies.mdpreviously described the four public cookie helpers but omitted the shared attributes applied to every cookie (Path: "/",HttpOnly: true,SameSite: Strict) and gave no explanation of theMaxAgesemantics used by each function.This was brought into focus by #570, which extracted a private
setCookiehelper that centralises those static attributes in one place. The documentation now accurately reflects the implementation.Changes
Path,HttpOnly,SameSite, andSecurefor all helpers in one place, removing the need to read the source to know the full cookie shape.SetAuthCookie— session cookie semantics — explicitly documentsMaxAge: 0(session cookie; browser discards on close) and explains why this is the right default for short-lived JWT access tokens.ClearAuthCookie/ClearRefreshCookie— deletion semantics — documentsMaxAge: -1(instructs the browser to delete the cookie immediately).SetRefreshCookie— persistence note — explains that the explicitmaxAgeparameter allows the refresh cookie to survive browser restarts, and recommends passingRefreshTokenTTLfor consistent expiry.Verification
All existing cookie function signatures are unchanged; no code was modified. The documentation was cross-checked against
handler/helpers.golines 316–348.Add this agentic workflows to your repo
To install this agentic workflow, run