Skip to content

馃悰 Escape dot in trusted referrer host regex - #40532

Merged
powerivq merged 2 commits into
ampproject:mainfrom
madib06ops:trusted-referrer-dot-escape
Aug 13, 2026
Merged

馃悰 Escape dot in trusted referrer host regex#40532
powerivq merged 2 commits into
ampproject:mainfrom
madib06ops:trusted-referrer-dot-escape

Conversation

@madib06ops

Copy link
Copy Markdown
Contributor

isTrustedReferrer in src/impression.js gates the credentialed click-tracking fetch and the history.replaceState in handleReplaceUrl on whether the document referrer host is in TRUSTED_REFERRER_HOSTS. The only entry is /^t.co$/, where the unescaped dot acts as a wildcard, so it also matches unrelated single-label hosts like taco or txco rather than just Twitter's t.co. Escaping the dot keeps t.co matching while dropping the lookalikes.

@powerivq
powerivq merged commit ddafb74 into ampproject:main Aug 13, 2026
51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants