Skip to content

Commit f2ad398

Browse files
committed
fix: use http-only cookies
1 parent 8f9ebf3 commit f2ad398

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

server/utils/atproto/storage.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@ export class OAuthStateStore implements NodeSavedStateStore {
2626
}
2727

2828
async set(key: string, val: NodeSavedState) {
29-
setCookie(this.event, this.cookieKey, key)
29+
setCookie(this.event, this.cookieKey, key, {
30+
httpOnly: true,
31+
secure: !import.meta.dev,
32+
sameSite: 'lax',
33+
})
3034
await this.storage.setItem<NodeSavedState>(key, val)
3135
}
3236

@@ -60,7 +64,11 @@ export class OAuthSessionStore implements NodeSavedSessionStore {
6064
}
6165

6266
async set(key: string, val: NodeSavedSession) {
63-
setCookie(this.event, this.cookieKey, key)
67+
setCookie(this.event, this.cookieKey, key, {
68+
httpOnly: true,
69+
secure: !import.meta.dev,
70+
sameSite: 'lax',
71+
})
6472
await this.storage.setItem<NodeSavedSession>(key, val)
6573
}
6674

0 commit comments

Comments
 (0)