Skip to content

fix: ignore CSRF on all apple provider callback URLs (#4291) - #17

Merged
dmakarenko merged 1 commit into
goodnotesfrom
apple-callback-csrf-custom-provider-20261005
Oct 5, 2026
Merged

dmakarenko merged 1 commit into
goodnotesfrom
apple-callback-csrf-custom-provider-20261005

Conversation

@dmakarenko

Copy link
Copy Markdown

Ports upstream ory/kratos b60edba1f4 (ory#4291) with the same diff: the OIDC strategy calls IgnoreGlob(RouteBase + "/callback/*") instead of IgnorePath(RouteBase + "/callback/apple"), and TestPostEndpointRedirect covers the IDs apple and apple-asd123.

Apple sends its callback as a form_post POST without cookies, so the product Kratos (provider ID apple-goodsystems) got a CSRF 403. The exemption stays safe: the POST route of every provider ID is redirectToGET, 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: TestPostEndpointRedirect fails with 403 for apple-asd123 before the fix and passes after it (2 pass). The full oidc package gives 340 pass and the same 7 TestStrategy failures (id_token message, ory.sh URL) as the base without this change.

https://claude.ai/code/session_01CuTQ2L2cqbNQ6a87z9UJe4

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
@dmakarenko
dmakarenko merged commit 05bc154 into goodnotes Oct 5, 2026
13 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant