Astro Info
Astro v7.2.2
Node v26.7.0
System macOS (arm64)
Package Manager pnpm
Output static
Adapter none
Integrations
If this issue only occurs in one browser, which browser is a problem?
NA
Describe the Bug
While going through the sessions module (runtime.ts), full disclosure, I was using Claude to help dig through the code, so flagging that upfront rather than presenting it as pure manual review — I found that #ensureSessionID() takes the session cookie value directly from the client and uses it as the storage key, with no format validation. This is inconsistent with the cookie name, which is checked against VALID_COOKIE_REGEX.
If the client-supplied session ID happens to collide with an existing key in the storage backend whose value isn't a valid session Map, it triggers destroy(). The request pipeline's finally block still flushes this as a real storage.removeItem() call, even though the request itself throws/500s.
Severity note: I checked the Node, Cloudflare, and Netlify adapter defaults — all give sessions their own isolated store out of the box, so this isn't exploitable under default config. It only matters if someone points the session driver at a storage backend shared with other data, without a key prefix.
Confirmed by a maintainer as low severity, filing per their request.
Suggested fix: Add a validation check on the session ID (mirroring VALID_COOKIE_REGEX used for the cookie name) as a safety net, so malformed/colliding values are rejected before being used as a storage key.
What's the expected result?
Session IDs supplied by the client should be validated against an expected format before being used as a storage key, so they can't collide with unrelated keys in a shared storage backend.
Link to Minimal Reproducible Example
NA
Participation
Astro Info
If this issue only occurs in one browser, which browser is a problem?
NA
Describe the Bug
While going through the sessions module (runtime.ts), full disclosure, I was using Claude to help dig through the code, so flagging that upfront rather than presenting it as pure manual review — I found that #ensureSessionID() takes the session cookie value directly from the client and uses it as the storage key, with no format validation. This is inconsistent with the cookie name, which is checked against VALID_COOKIE_REGEX.
If the client-supplied session ID happens to collide with an existing key in the storage backend whose value isn't a valid session Map, it triggers destroy(). The request pipeline's finally block still flushes this as a real storage.removeItem() call, even though the request itself throws/500s.
Severity note: I checked the Node, Cloudflare, and Netlify adapter defaults — all give sessions their own isolated store out of the box, so this isn't exploitable under default config. It only matters if someone points the session driver at a storage backend shared with other data, without a key prefix.
Confirmed by a maintainer as low severity, filing per their request.
Suggested fix: Add a validation check on the session ID (mirroring VALID_COOKIE_REGEX used for the cookie name) as a safety net, so malformed/colliding values are rejected before being used as a storage key.
What's the expected result?
Session IDs supplied by the client should be validated against an expected format before being used as a storage key, so they can't collide with unrelated keys in a shared storage backend.
Link to Minimal Reproducible Example
NA
Participation