Repository navigation
Block the game's Aliyun telemetry in Chromium capture mode - #291
Merged
Merged
Conversation
Chromium capture let the game's analytics beacons (*.log.aliyuncs.com) out unchanged; only the MITM proxy dropped them. Arm request-stage Fetch patterns for the SLS domain on every attached page and fail matching requests as BlockedByClient, alongside the existing Tenhou client rewrite in the same Fetch.enable call. Page-scoped interception also pauses CORS preflights and dedicated-worker requests. New setting [capture.chromium] block_telemetry (default on) with a Settings toggle. Blocked requests keep their sls_beacon annotation on the timeline plus an akagi_blocked marker. The SLS host check moves to capture::telemetry and is shared with the MITM CONNECT refusal. tests/chromium_telemetry_block.rs drives the real CDP loop against a headless browser (ignored by default: needs a browser).
clippy 1.99 flags clippy::double_must_use on every #[async_trait] trait method, because async-trait 0.1.89 adds #[must_use] to a method whose Pin<Box<dyn Future>> return type is already must_use. 0.1.92 no longer emits the attribute, so cargo clippy --all-targets -D warnings passes on the latest stable toolchain again.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
In Chromium (CDP) capture mode the game's Aliyun SLS web-tracking beacons (
*.log.aliyuncs.com) leave the machine unchanged. Only the MITM proxy blocked them ([proxy] block_telemetry), and that block is not in the path in Chromium mode: the launched browser connects directly, and only one capture backend runs at a time. Past Chromium-mode sessions showlogin_stats,game_status,certificate_info,mj_connect_success,emo_statsandgame_network_statsbeacons going out. The web client sends a CORS preflight before each one, and that preflight's URL already carries the full query-string payload.Change
[capture.chromium] block_telemetry(default on), with a toggle in the Chromium section of Settings → Capture and a hint in all four locales. A config written before the field existed gets the default.cdp.rs:Fetchpatterns for the SLS domain (*log.aliyuncs.com/*,*log.aliyuncs.com:*). They go in the sameFetch.enablecall as the existing Tenhou client rewrite, because each call replaces the previous patterns.BlockedByClient, which gives the pagenet::ERR_BLOCKED_BY_CLIENT, the same error an ad blocker produces. Anything else the globs catch is continued untouched.responseStatusCode/responseErrorReasonfields.sls_beaconannotation and also gets anakagi_blockedmarker, as on the MITM leg. Each block is also logged underakagi::capture::http, without the query string.capture::telemetry::is_sls_host: the SLS domain check moves out of the MITMCONNECTrefusal so both backends share it. MITM behavior is unchanged.async-trait0.1.89 → 0.1.92: clippy 1.99 reportsclippy::double_must_useon every#[async_trait]method because 0.1.89 adds#[must_use]to an already-must_usereturn type. 0.1.92 no longer does, soclippy -D warningspasses on current stable again.Coverage and limits
A page-scoped
Fetch.enablealso pauses the beacon XHR's CORS preflight and requests from the page's dedicated workers, so all of those are blocked. Worker requests are blocked but are not recorded on the timeline: page-scopedNetworkevents do not report them.Requests a tab makes before the page poll attaches to it are not covered. That window is up to about a second. In recorded sessions the game sends its first beacon at login, several seconds after attach.
Testing
Unit tests:
tests/chromium_telemetry_block.rsruns the realcdp::runloop against headless Chromium. Host-resolver rules send*.log.aliyuncs.comto a local sink, and the test page fires an XHR (with preflight), an<img>,sendBeaconand a workerfetch:sls_beacon+akagi_blockedIt needs a browser, so it is
#[ignore]d. Run it withcargo test --test chromium_telemetry_block -- --ignored. It passes locally on Chrome 155.Locally on the latest stable toolchain:
cargo fmt --check,cargo clippy --all-targets -- -D warnings,cargo test --lib,cargo test --tests,cargo test --no-run --all-targets --locked,npm run lint,tsc -b.