Commit 83d3128
fix(programs): stop stale/empty scope for searched programs (rate-limit cache poisoning)
A HackerOne program (ryan-bbp) updated its scope, but the Programs page kept showing
TARGETS="—" because:
- fetchH1ScopeSummary never checked the HTTP status, so a 429 (the background warmer
enriching ~800 H1 programs hammers the API) or 403 became an empty summary that was
then cached for 15 minutes — hiding the program's real scope.
- the warm program list marks every program _scope_loaded without ever re-fetching, so
a program that got an empty/rate-limited enrichment never recovered.
Fixes:
- fetchH1ScopeSummary returns (summary, ok); ok=false on request error or non-200, and
callers no longer cache a failed fetch (so a transient 429/403 can't stick for the TTL).
- /api/scope/program-summaries accepts force=true to bypass the 15-min scope cache.
- Programs search now live-fetches scope (force=true) for the matched programs that have
no scope loaded — so searching "ryan-bbp" pulls its CURRENT scope (10 targets, latest
update) instead of the stale warm-cache "—". Bounded to ≤25 matches, debounced 350ms,
gated by a _scope_fresh flag so it never re-hammers; Refresh now resets it.
Verified: go build/vet, node --check, focused review (caching, force path, debounce,
loadSeq guard, no re-hammer loop, no XSS) — no issues.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent 8b8c6d6 commit 83d3128
3 files changed
Lines changed: 85 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
| |||
270 | 271 | | |
271 | 272 | | |
272 | 273 | | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
278 | 281 | | |
279 | 282 | | |
280 | 283 | | |
| |||
288 | 291 | | |
289 | 292 | | |
290 | 293 | | |
291 | | - | |
292 | | - | |
| 294 | + | |
293 | 295 | | |
294 | 296 | | |
295 | 297 | | |
| |||
300 | 302 | | |
301 | 303 | | |
302 | 304 | | |
| 305 | + | |
| 306 | + | |
303 | 307 | | |
304 | 308 | | |
305 | 309 | | |
| |||
476 | 480 | | |
477 | 481 | | |
478 | 482 | | |
479 | | - | |
480 | | - | |
481 | | - | |
482 | | - | |
483 | | - | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
484 | 490 | | |
485 | 491 | | |
486 | 492 | | |
487 | 493 | | |
488 | 494 | | |
489 | | - | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
490 | 500 | | |
491 | 501 | | |
492 | 502 | | |
493 | | - | |
| 503 | + | |
494 | 504 | | |
495 | 505 | | |
496 | 506 | | |
497 | 507 | | |
498 | 508 | | |
499 | 509 | | |
500 | 510 | | |
501 | | - | |
| 511 | + | |
502 | 512 | | |
503 | 513 | | |
504 | 514 | | |
505 | 515 | | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
506 | 522 | | |
507 | 523 | | |
508 | 524 | | |
| |||
518 | 534 | | |
519 | 535 | | |
520 | 536 | | |
521 | | - | |
| 537 | + | |
522 | 538 | | |
523 | 539 | | |
524 | 540 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
424 | 424 | | |
425 | 425 | | |
426 | 426 | | |
427 | | - | |
| 427 | + | |
428 | 428 | | |
429 | 429 | | |
430 | 430 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
187 | 236 | | |
188 | 237 | | |
189 | 238 | | |
| |||
230 | 279 | | |
231 | 280 | | |
232 | 281 | | |
| 282 | + | |
| 283 | + | |
233 | 284 | | |
234 | 285 | | |
235 | 286 | | |
| |||
354 | 405 | | |
355 | 406 | | |
356 | 407 | | |
357 | | - | |
| 408 | + | |
358 | 409 | | |
0 commit comments