0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-12 02:52:01 +08:00
discourse/app/models/browser_pageview_event_score.rb
Krzysztof Kotlarek 03a7c723a2
DEV: Score sessions that rotate IP addresses in CrawlerScorer (#42083)
This change adds a `session_stats` aggregate keyed on the session
instead, scoring +30 when a session changes address faster than one hop
per five minutes across three or more addresses - a rate two addresses
cannot trigger, so ordinary wifi/cellular handover stays unscored.

The +30 sits below `BOT_SCORE_THRESHOLD` on purpose: corporate
round-robin NAT egress is indistinguishable from a proxy pool on the IP
axis alone, so rotation is meant to combine with other signals rather
than convict on its own.

In addition, Baidu was added as a potential crawler ASN.
2026-07-28 18:05:04 +08:00

25 lines
912 B
Ruby
Vendored

# frozen_string_literal: true
class BrowserPageviewEventScore < ActiveRecord::Base
belongs_to :event, class_name: "BrowserPageviewEvent"
end
# == Schema Information
#
# Table name: browser_pageview_event_scores
#
# id :bigint not null, primary key
# automation_ua_score :integer default(0), not null
# churn_score :integer default(0), not null
# engagement_score :integer default(0), not null
# ip_rotation_score :integer default(0), not null
# known_asn_score :integer default(0), not null
# rapid_nav_score :integer default(0), not null
# referrer_score :integer default(0), not null
# velocity_score :integer default(0), not null
# event_id :bigint not null
#
# Indexes
#
# index_browser_pageview_event_scores_on_event_id (event_id) UNIQUE
#