mirror of
https://github.com/Drop-OSS/drop
synced 2026-08-27 14:23:05 -04:00
fix(server): prevent session fixation by always issuing new signin token
session/index.ts:73 reused getSessionToken(h3) ?? createSessionCookie(...) — pre-set cookies persisted across signin. Now always calls createSessionCookie and invalidates old session via removeSession. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
parent
508179176f
commit
3a762c2f7d
1 changed files with 7 additions and 2 deletions
|
|
@ -70,8 +70,13 @@ export class SessionHandler {
|
|||
|
||||
const expiresAt = this.createExipreAt(rememberMe);
|
||||
|
||||
const token =
|
||||
this.getSessionToken(h3) ?? this.createSessionCookie(h3, expiresAt);
|
||||
// Invalidate any pre-existing session token — prevents session fixation
|
||||
const oldToken = this.getSessionToken(h3);
|
||||
const token = this.createSessionCookie(h3, expiresAt);
|
||||
if (oldToken) {
|
||||
await this.sessionProvider.removeSession(oldToken);
|
||||
}
|
||||
|
||||
const defaultSession: Session = {
|
||||
expiresAt,
|
||||
data,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue