Commit 25deefbb authored by Shahzeb K's avatar Shahzeb K Committed by Joe Haddad

Avoid "ad" anywhere in the buildId (#6854)

* Added a check for ad_ in the buildId

* ad_ > ad
Co-Authored-By: 's avatarlfades <luis@zeit.co>

* Update the `ad` comment
Co-Authored-By: 's avatarlfades <luis@zeit.co>

* Avoid all buildId's that contain "ad"

Looking through the uBlock Origin filter list, it uses regex wildcards to avoid various things with "ad" anywhere in the string. It's a safe bet to just avoid "ad" all together (as opposed to just at the start).

* Use regex (case incensitive) to check for "ad" 

The following cases will set this regex to true:

```
/ad/i.test("somead")
/ad/i.test("someADlksdjf")
/ad/i.test("adlksdjf")
/ad/i.test("ADlksdjf")
```
parent 742f29fb
......@@ -4,7 +4,7 @@ export async function generateBuildId (generate: () => string|null, fallback: ()
if (buildId === null) {
// We also create a new buildId if it starts with `ad` to avoid false
// positives with ad blockers
while (!buildId || buildId.startsWith('ad')) {
while (!buildId || /ad/i.test(buildId)) {
buildId = fallback()
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment