Skip to content

Commit

Permalink
fix(options/use_browser_cookies): disable encoding cookie value
Browse files Browse the repository at this point in the history
  • Loading branch information
khaterdev committed Sep 3, 2024
1 parent 1c9e4de commit 9554bb0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/sessions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ async function getUserSessionData(request: Request) {

const getCookieValue = (name: string) => {
const match = cookieHeader.match(new RegExp(`(^| )${name}=([^;]+)`))

Check warning on line 57 in app/sessions/index.ts

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

app/sessions/index.ts#L57

Found RegExp with non literal argument

Check warning on line 57 in app/sessions/index.ts

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

app/sessions/index.ts#L57

Found non-literal argument to RegExp Constructor
return match ? match[2] : undefined
return match ? decodeURIComponent(match[2]) : undefined
}

const getFF14Data = () => {
Expand All @@ -77,7 +77,7 @@ async function getUserSessionData(request: Request) {
if (regionCookie && realmIdCookie && realmNameCookie) {
return validateServerAndRegion(
regionCookie as WoWServerRegion,
realmIdCookie,
Number(realmIdCookie),
realmNameCookie
)
}
Expand Down
2 changes: 1 addition & 1 deletion app/utils/cookies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ export function setCookie(
options: { maxAge?: number; path?: string } = {}
) {
const { maxAge = defaultMaxAge, path = '/' } = options

Check failure on line 8 in app/utils/cookies.ts

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

app/utils/cookies.ts#L8

Unsafe assignment of an error typed value.
return `${name}=${encodeURIComponent(value)}; Max-Age=${maxAge}; Path=${path}; HttpOnly; Secure; SameSite=Lax`
return `${name}=${value}; Max-Age=${maxAge}; Path=${path}; HttpOnly; Secure; SameSite=Lax`
}

0 comments on commit 9554bb0

Please sign in to comment.