Skip to content

Commit b5c208f

Browse files
authored
fix[auth]: #2181 Sanitize URL in cookie key to make it RFC 6265 sec 4.1.1 compliant (#2183)
1 parent 8e8797b commit b5c208f

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

.changeset/huge-walls-raise.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@faustwp/core': patch
3+
---
4+
5+
#2181 - Sanitize URL in cookie key to make it RFC 6265 sec 4.1.1 compliant.

packages/faustwp-core/src/server/auth/token.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ export class OAuth {
2525

2626
constructor(cookies: Cookies) {
2727
this.cookies = cookies;
28-
this.tokenKey = `${getWpUrl()}-rt`;
28+
this.tokenKey = `${getWpUrl().replace(
29+
/[^!#$%&'*+\-.^_`|~0-9A-Za-z]/g,
30+
'',
31+
)}-rt`; // Sanitize URL to make cookie key RFC 6265 sec 4.1.1 compliant.
2932
}
3033

3134
public getRefreshToken(): string | undefined {

0 commit comments

Comments
 (0)