mirror of
https://github.com/fosrl/pangolin.git
synced 2026-05-08 05:39:49 -05:00
[GH-ISSUE #2534] Session expiry deletes all resource sessions & HTTP cookie domain broken for non-SSL resources #6980
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Abhinav-kodes on GitHub (Feb 25, 2026).
Original GitHub issue: https://github.com/fosrl/pangolin/issues/2534
Describe the Bug
While investigating the session logic (which likely contributes to issues like #2488), I found two critical bugs in
server/auth/sessions/resource.tsthat break session persistence:Bug 1 — Session DELETE wipes entire resourceSessions table
File:
server/auth/sessions/resource.tsFunction:
validateResourceSessionTokenWhen a resource session is expired, the DELETE query uses a tautological WHERE clause: (Line - 90)
This compares the column to itself, generating WHERE session_id = session_id (always true), which deletes ALL rows in the resourceSessions table, not just the expired one.
Every active session for every user on every resource is wiped whenever any single session expires.
Bug 2 — HTTP resource cookie set with broken Domain
File:
server/auth/sessions/resource.tsFunction:
serializeResourceSessionCookieIn the HTTP (non-SSL) path, the cookie string has a broken template literal: (Line - 184)
The browser receives Domain=$domain} as a literal string, rejects it, and never sends the cookie back — leaving HTTP resources perpetually unauthenticated.
Environment
devbranch Docker build)To Reproduce
Bug 1: The Tautological Session Delete
validateResourceSessionTokenwith the stale token).resource_sessionsdatabase table.Bug 2: The HTTP Cookie Domain Typo
Set-Cookieresponse header.Domain=$domain}instead of the parsed hostname (e.g.,Domain=localhost). The browser subsequently rejects the cookie.Expected Behavior
1. Session Deletion: When a single resource session reaches its expiration time, only that specific session's row should be deleted from the
resourceSessionsdatabase table. All other valid user sessions across the platform should remain completely untouched and active.2. HTTP Cookie Domain: When a user authenticates to a resource over standard HTTP, the
Set-Cookieheader should correctly interpolate the domain string (e.g.,Domain=example.comorDomain=localhost). This ensures the browser properly accepts the cookie and maintains the user's authentication state for subsequent requests.@oschwartz10612 commented on GitHub (Feb 25, 2026):
Thanks for fixing this!