fix(bot-detection): respect trackOnlyCategories in generic isBot() fallback
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 88/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
- Domain
- security
Research direction
Start at detectBot() and the generic isBot() fallback, alongside ua-patterns.ts and isAIBot(), then compare its action handling with getAction(). Done means trackOnlyCategories applies to UNKNOWN_BOT detections, including the PowerShell example, with the expected track_only action; verify this with the relevant tests.
Written by the indexing model from the issue text.
Description
Description
In detectBot(), when a User-Agent is not matched by literal/regex patterns in ua-patterns.ts or by isAIBot(), it falls back to isBot() from ua-parser-js.
Currently, this generic fallback branch hardcodes action: BotAction.BLOCK instead of routing through getAction(BotCategory.UNKNOWN_BOT, config):
if (isBot(userAgent)) {
return {
isBot: true,
category: BotCategory.UNKNOWN_BOT,
name,
action: BotAction.BLOCK, // ignores config.trackOnlyCategories
confidence: 70,
reason: "general_bot_pattern",
};
}
As a result, configuring trackOnlyCategories: [BotCategory.UNKNOWN_BOT] does not apply to traffic detected via this fallback, and action: "block" is returned instead of "track_only".
Example:
A User-Agent like PowerShell/7.1.0 (which is recognized as a CLI tool by ua-parser-js's isBot() but is not present in ua-patterns.ts or isAIBot()):
detectBot("PowerShell/7.1.0", {
trackOnlyCategories: [BotCategory.UNKNOWN_BOT],
});
Expected: action: "track_only"
Actual: action: "block"
Proposed Fix
Route the generic isBot() fallback through getAction():
action: getAction(BotCategory.UNKNOWN_BOT, config),
I have verified the fix and tests locally and can open a PR once this issue is accepted.
- Dominant language
- TypeScript
- Stars
- 1.2k
- Forks
- 216
- Avg merge
- 14h 53m
- Merged PRs (30d)
- 154
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from databuddy-analytics/Databuddy
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
databuddy-analytics/Databuddy#694 ·
-
Flag list not refreshed after status toggle/archive when flag.websiteId doesn't match the query key Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
databuddy-analytics/Databuddy#664 · 1 comment ·
-
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
databuddy-analytics/Databuddy#649 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
databuddy-analytics/Databuddy#643 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
databuddy-analytics/Databuddy#638 · 2 comments ·
All issues in databuddy-analytics/Databuddy
Similar issues
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 91/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 95/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100