From c8396f96abdd9ddd1a58e90d57ce0115dcd0bdaf Mon Sep 17 00:00:00 2001 From: kirillgroshkov Date: Tue, 15 Oct 2024 19:34:15 +0200 Subject: [PATCH] fix: stop treating ZeroPlugins users as bots, as it's false positive --- src/bot.test.ts | 14 +++++++------- src/bot.ts | 8 +++++--- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/bot.test.ts b/src/bot.test.ts index f047448..e8aac59 100644 --- a/src/bot.test.ts +++ b/src/bot.test.ts @@ -76,13 +76,13 @@ test('navigator.webdriver means bot', () => { expect(botDetectionService.isBot()).toBe(BotReason.WebDriver) }) -test('0 plugins means bot', () => { - globalThis.navigator = { - userAgent: userAgentSafari, - plugins: [] as any, - } as Navigator - expect(botDetectionService.isBot()).toBe(BotReason.ZeroPlugins) -}) +// test('0 plugins means bot', () => { +// globalThis.navigator = { +// userAgent: userAgentSafari, +// plugins: [] as any, +// } as Navigator +// expect(botDetectionService.isBot()).toBe(BotReason.ZeroPlugins) +// }) test('"" languages means bot', () => { globalThis.navigator = { diff --git a/src/bot.ts b/src/bot.ts index 89a5f02..4462331 100644 --- a/src/bot.ts +++ b/src/bot.ts @@ -34,9 +34,11 @@ class BotDetectionService { return BotReason.WebDriver } - if (navigator.plugins?.length === 0) { - return BotReason.ZeroPlugins // Headless Chrome - } + // Kirill: commented out, as it's no longer seems reliable, + // e.g generates false positives with latest Android clients (e.g. Chrome 129) + // if (navigator.plugins?.length === 0) { + // return BotReason.ZeroPlugins // Headless Chrome + // } if ((navigator.languages as any) === '') { return BotReason.EmptyLanguages // Headless Chrome