Skip to content

Commit 2880238

Browse files
vovikhangcdvKhang. Võ VĩLinusU
authored
fix: ReDoS referrer (#1611)
* fix ReDoS referrer * Update src/utils/referrer.js Eliminate regex and use string matcher Co-authored-by: Linus Unnebäck <linus@folkdatorn.se> Co-authored-by: Khang. Võ Vĩ <khangvv@vng.com.vn> Co-authored-by: Linus Unnebäck <linus@folkdatorn.se>
1 parent e87b093 commit 2880238

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/utils/referrer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export function isOriginPotentiallyTrustworthy(url) {
119119
// 5. If origin's host component is "localhost" or falls within ".localhost", and the user agent conforms to the name resolution rules in [let-localhost-be-localhost], return "Potentially Trustworthy".
120120
// We are returning FALSE here because we cannot ensure conformance to
121121
// let-localhost-be-loalhost (https://tools.ietf.org/html/draft-west-let-localhost-be-localhost)
122-
if (/^(.+\.)*localhost$/.test(url.host)) {
122+
if (url.host === 'localhost' || url.host.endsWith('.localhost')) {
123123
return false;
124124
}
125125

0 commit comments

Comments
 (0)