-
Notifications
You must be signed in to change notification settings - Fork 12
[NOCI] Update bot checking logic #347
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
esezen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
| isBot() { | ||
| if (this.getIsHumanFromSessionStorage()) { | ||
| return false; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
| const humanity = new HumanityCheck(); | ||
|
|
||
| expect(humanity.isHuman()).to.equal(false); | ||
| expect(humanity.hasPerformedHumanEvent).to.equal(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing the tests! Sorry I didn't do that earlier.
Updates:
Notes:
This PR was aiming to keep things mostly the same without changing too many things. There are a couple different ways we could go about updating the existing logic and here are a few (feel free to comment if you have other thoughts/ideas as well):
Current Solution:
The current state works well for the most part, but fails if the crawler/scraper is able to perform some "human-like" action due to the current logic we have in place. Once humanity is determined, it will always rely on the isHuman variable that's saved to storage and doesn't do any more checks. This makes it easy for crawlers/scrapers to bypass any additional checks.
Proposed Solution 1 (This PR):
Not a whole lot changed except for checking the User Agent every time before a request is queued in addition to making sure that the user has proven that they're human.
Proposed Solution 2:
Check the User Agent when the client is instantiated and set
sendTrackingEventsto false if it's a bot-like User Agent. This would disable tracking events entirely and no events can be queued.Proposed Solution 3:
The isHuman (
__cnstrc_is_human) variable is currently set after a human-like action has been performed on the page (i.e. scroll, click, mouseover, etc). We could add another condition where we check the User Agent before the isHuman variable ets set, so even if the “user” performs a human-like action, they would be required to have a non-bot-like user agent for events to get queued.