-
Notifications
You must be signed in to change notification settings - Fork 1k
fix: Safari mobile auth - change sameSite to none for cross-site OAuth #116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -40,7 +40,7 @@ export const signIn = async ({ email, password }: signInProps) => { | |||||||||||||||||||||||||||
| cookies().set("appwrite-session", session.secret, { | ||||||||||||||||||||||||||||
| path: "/", | ||||||||||||||||||||||||||||
| httpOnly: true, | ||||||||||||||||||||||||||||
| sameSite: "strict", | ||||||||||||||||||||||||||||
| sameSite: "none", | ||||||||||||||||||||||||||||
| secure: true, | ||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
|
|
@@ -95,7 +95,7 @@ export const signUp = async ({ password, ...userData }: SignUpParams) => { | |||||||||||||||||||||||||||
| cookies().set("appwrite-session", session.secret, { | ||||||||||||||||||||||||||||
| path: "/", | ||||||||||||||||||||||||||||
| httpOnly: true, | ||||||||||||||||||||||||||||
| sameSite: "strict", | ||||||||||||||||||||||||||||
| sameSite: "none", | ||||||||||||||||||||||||||||
| secure: true, | ||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||
|
Comment on lines
95
to
100
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same Apply the same change as suggested for Proposed fix cookies().set("appwrite-session", session.secret, {
path: "/",
httpOnly: true,
- sameSite: "none",
+ sameSite: "lax",
secure: true,
});📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer
sameSite: "lax"over"none"— it fixes Safari OAuth redirects without opening up CSRF surface.sameSite: "none"causes the browser to attach the session cookie to every cross-site request (iframes,fetch, form POSTs from third-party pages, etc.), which is unnecessary exposure for a banking app. OAuth redirect flows are top-level navigations, andsameSite: "lax"already allows cookies on those while still blocking cross-origin subrequests."lax"is the recommended setting for exactly this scenario — surviving OAuth/SSO redirects without degrading CSRF protection.Proposed fix
cookies().set("appwrite-session", session.secret, { path: "/", httpOnly: true, - sameSite: "none", + sameSite: "lax", secure: true, });📝 Committable suggestion
🤖 Prompt for AI Agents