Repository navigation
fix: ignore CSRF on all apple provider callback URLs (#4291) - #17
Merged
dmakarenko merged 1 commit intoOct 5, 2026
Merged
Conversation
Port of upstream ory/kratos b60edba with the same diff. The CSRF exemption was hard-coded to /callback/apple, so the Apple form_post to the callback of a provider with a custom ID (apple-goodsystems) got 403. Claude-Session: https://claude.ai/code/session_01CuTQ2L2cqbNQ6a87z9UJe4
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.
Ports upstream
ory/kratosb60edba1f4(ory#4291) with the same diff: the OIDC strategy callsIgnoreGlob(RouteBase + "/callback/*")instead ofIgnorePath(RouteBase + "/callback/apple"), andTestPostEndpointRedirectcovers the IDsappleandapple-asd123.Apple sends its callback as a
form_postPOST without cookies, so the product Kratos (provider IDapple-goodsystems) got a CSRF 403. The exemption stays safe: the POST route of every provider ID isredirectToGET, which only redirects to the same URL as a GET with the cookies, and nosurf does not check GET. A test that a non-Apple callback keeps the CSRF check is not possible with this shape, and the upstream comment stays verbatim, so a later rebase on upstream drops this commit cleanly.Tested:
TestPostEndpointRedirectfails with 403 forapple-asd123before the fix and passes after it (2 pass). The fulloidcpackage gives 340 pass and the same 7TestStrategyfailures (id_token message,ory.shURL) as the base without this change.https://claude.ai/code/session_01CuTQ2L2cqbNQ6a87z9UJe4