feat: Enhance session cookie domain handling for IP addresses and single-label hostnames
This commit is contained in:
@@ -58,8 +58,10 @@ export const actions: Actions = {
|
||||
|
||||
// Check if hostname is an IP address
|
||||
const isIPAddress = /^\d{1,3}(\.\d{1,3}){3}$/.test(hostname);
|
||||
const isLocalhost = hostname === 'localhost';
|
||||
const isSingleLabel = hostname.split('.').length === 1;
|
||||
|
||||
if (!isIPAddress) {
|
||||
if (!isIPAddress && !isSingleLabel && !isLocalhost) {
|
||||
const parsed = psl.parse(hostname);
|
||||
|
||||
if (parsed && parsed.domain) {
|
||||
|
||||
@@ -120,8 +120,10 @@ function handleSuccessfulLogin(event: RequestEvent<RouteParams, '/login'>, respo
|
||||
|
||||
// Check if hostname is an IP address
|
||||
const isIPAddress = /^\d{1,3}(\.\d{1,3}){3}$/.test(hostname);
|
||||
const isLocalhost = hostname === 'localhost';
|
||||
const isSingleLabel = hostname.split('.').length === 1;
|
||||
|
||||
if (!isIPAddress) {
|
||||
if (!isIPAddress && !isSingleLabel && !isLocalhost) {
|
||||
const parsed = psl.parse(hostname);
|
||||
|
||||
if (parsed && parsed.domain) {
|
||||
|
||||
Reference in New Issue
Block a user