Repository navigation
Conversation
The GitHub login now always sets a short lived state cookie, also when there is no from path. The callback rejects requests without a matching state cookie before exchanging the code, and clears the cookie on success. The GitHub App install popup (state=close) no longer exchanges the code. After the popup closes, the fork dialog refreshes the token best effort and continues with the existing token if that fails. Refs Thinkmill#1669
🦋 Changeset detectedLatest commit: 7b3a376 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This branch has not been deployed
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.
Refs #1669 (the OAuth state part).
Tracked as CVE-2026-129945.
What changed:
stateand sets a short lived (10 minutes) httpOnly cookie for it, also when there is nofrompath.stateis missing or has no matching cookie, and clears the cookie on success.state=close) no longer exchanges the code or sets cookies. When the popup closes, the fork dialog refreshes the token best effort through the existingrefresh-tokenroute and continues with the existing token if that fails.Behavior note: anyone in the middle of signing in during the upgrade will need to start sign-in again.
Testing: added
packages/keystatic/src/api/generic.test.ts(handler level: missing state, missing cookie, mismatched cookie, valid sign-in with the state cookie cleared, thestate=closepopup, login withoutfrom),packages/keystatic/src/api/generic.integration.test.ts(the real login and callback handlers behind a Node http server, with the GitHub token endpoint stubbed: normal login, deep linkfrom, a forged callback with another browser's state, andstate=close) andpackages/keystatic/src/app/fork-repo.test.tsx(refresh before refetch, and the flow continuing when the refresh fails or returns 401). Ran vitest for the keystatic project,tsc, eslint and prettier.Notes: The state=close path no longer exchanges the code. After the install popup closes, the client refreshes the token best-effort, so the flow keeps a fresh token without accepting an unbound code.