mirror of
https://github.com/1dot13/source.git
synced 2026-07-29 13:52:17 +02:00
The other half of the feature, and the half that decides whether a player's report survives: the endpoint CRASH_TELEMETRY_URL points at. It takes the POST from processCrashTelemetry and forwards the report to a Discord webhook as a file attachment. It stores nothing -- a report is only worth reading next to the PDB it was built against, and that never leaves a developer's machine, so there is nothing for a bucket to do here that the channel we already read bug reports in does not do better. That also keeps the whole thing inside the Workers free tier, where the 10 ms budget is CPU, not wall clock, and waiting on Discord is not metered. In the repo rather than in someone's home directory because the status codes are a contract with the client and the two have to be changed together. reportIsSettled() in sgp/crash_telemetry.cpp deletes the player's copy on 2xx and on 400/413/415 and keeps it on everything else, so a settling 4xx returned for a failure on our side silently destroys the report. Every failure path here is therefore a 503, each naming its own cause in wrangler's console, and the one 4xx that is safe -- 429, which the client does not settle -- is the one the rate limiter returns. That rate limiter is a binding with a .limit() call, not a dashboard rule: WAF rate limiting rules need a zone and a workers.dev subdomain is not one. Per-IP, 50 a minute, which has to clear kMaxUploadsPerRun (20) in the client or a player draining a backlog throttles themselves. It is checked before the body is read. A report is attacker-controlled text arriving at a public, unauthenticated endpoint whose URL ships in every player's Ja2.ini, so the summary line strips markdown from the player handle and the payload sets allowed_mentions to nothing. The size cap and the "*** CRASH" check keep drive-by scanners out; anything determined gets through, and the blast radius is a message we delete. test.mjs covers the whole contract against a stubbed fetch, no network and no webhook needed. DISCORD_WEBHOOK is a secret and lives nowhere in this tree; .dev.vars, which holds a live one for local development, is gitignored. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
10 lines
156 B
JSON
10 lines
156 B
JSON
{
|
|
"name": "ja2-crash-telemetry",
|
|
"private": true,
|
|
"type": "module",
|
|
"scripts": {
|
|
"test": "node test.mjs",
|
|
"deploy": "wrangler deploy"
|
|
}
|
|
}
|