Skip to content

fix: correct session DELETE tautology and HTTP cookie domain interpolation#2535

Merged
oschwartz10612 merged 1 commit intofosrl:devfrom
Abhinav-kodes:fix-resource-session-delete-cookie
Feb 25, 2026
Merged

fix: correct session DELETE tautology and HTTP cookie domain interpolation#2535
oschwartz10612 merged 1 commit intofosrl:devfrom
Abhinav-kodes:fix-resource-session-delete-cookie

Conversation

@Abhinav-kodes
Copy link
Copy Markdown
Contributor

@Abhinav-kodes Abhinav-kodes commented Feb 25, 2026

Community Contribution License Agreement

By creating this pull request, I grant the project maintainers an unlimited,
perpetual license to use, modify, and redistribute these contributions under any terms they
choose, including both the AGPLv3 and the Fossorial Commercial license terms. I
represent that I have the right to grant this license for all contributed content.

Description

Two bugs in server/auth/sessions/resource.ts with minimal, surgical fixes.
Changes are limited to two single-line corrections — no architecture changes, no new abstractions.

Closes #2534

Fix 1 — Session DELETE tautology

validateResourceSessionToken was deleting all rows in resourceSessions on any expiry because the WHERE clause compared the column to itself:

// Before — tautology, deletes everything
.where(eq(resourceSessions.sessionId, resourceSessions.sessionId)

// After — targets only the expired session
.where(eq(resourceSessions.sessionId, sessionId)

Fix 2 — HTTP cookie Domain broken template literal

serializeResourceSessionCookie had a missing { in the HTTP path:

// Before — sends literal string "$domain}" to browser
`... Domain=$domain}`

// After — correctly interpolates the domain variable
`... Domain=${domain}`

Testing

  • Verified expired session only deletes itself, not others
  • Verified HTTP resource cookie is correctly scoped to domain

@Abhinav-kodes Abhinav-kodes changed the base branch from main to dev February 25, 2026 11:51
@Abhinav-kodes Abhinav-kodes force-pushed the fix-resource-session-delete-cookie branch from a15cbde to c64dd14 Compare February 25, 2026 11:55
@oschwartz10612
Copy link
Copy Markdown
Member

Thanks!

@oschwartz10612 oschwartz10612 merged commit 0ea38ea into fosrl:dev Feb 25, 2026
2 of 4 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.

Session expiry deletes all resource sessions & HTTP cookie domain broken for non-SSL resources

2 participants