mozilla/affiliates — pull request #227 by Osmose (2014-07-28 14:29:35+00:00)
Title: Bug 983717: Fraud detection

Adds very basic fraud detection for link clicks (and the other, unused metrics too).

There's two levels:
- Suspicious user agents, like wget or curl. The list of suspicious user agents is small, but then again circumventing this is super-easy so maybe it doesn't matter. We've seen users using these tools without special user agents so we might as well do it.
- IP address rate-limiting. Essentially, if a single IP sends too many link clicks to a specific link in a single day, all but one of their clicks gets removed. We also check larger IP groups for larger amounts of clicks: For ipv4, we check the C block, and for ipv6, we check the /48 prefix.

If fraudulent clicks are detected, they are removed and we log the removal, along with the reason for removal. There's an admin action for reversing these removals if the admins decide a removal was wrong.

There's no documentation of the feature yet because I want to get this in and see what kind've fraud it detects on production before we finish it up for admin use.