Commit 089e009
Rate-limit unauthenticated crawling of profile solutions (#9421)
api/profiles/solutions#index is enumerable - one URL per user handle, and
handles are public - unauthenticated, and cheap to request. It had no GET
throttle at all, so it belongs in the existing crawl throttle alongside the
exercise pages and submission files.
Found while breaking down CloudWatch log ingestion: a single netcup VPS
(2a0a:4cc0:2000:2e9b:1434:8eff:feda:ee1) has been walking the handle space at
a flat ~1,250 req/hr around the clock - 30,075 404s to 68 200s in 24 hours,
roughly 900k requests/month. Nothing stopped it. Cloudflare's "60 in 1m" rule
is scoped `http.host eq "exercism.org"` and this traffic arrives on
api.exercism.org, so that rule never evaluates.
Fixing it here rather than at the edge covers both hostnames at once and
survives the next IP. Note that api.exercism.org cannot simply be put behind
the same bot challenge as exercism.org, because the CLI talks to
api.exercism.io/v1.
Claude-Session: https://claude.ai/code/session_01WRm6FbLza51hYVjkTSuGju
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>1 parent bc559ca commit 089e009
2 files changed
Lines changed: 35 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
83 | | - | |
| 83 | + | |
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
| 87 | + | |
| 88 | + | |
88 | 89 | | |
89 | 90 | | |
90 | 91 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
224 | 224 | | |
225 | 225 | | |
226 | 226 | | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
227 | 254 | | |
228 | 255 | | |
229 | 256 | | |
| |||
0 commit comments