Commit 76a679f
fix(adagents): disable follow_redirects on ads.txt MANAGERDOMAIN fetch (#754)
Mirrors the adagents.json streaming-fetch posture (`_stream_capped` uses
`follow_redirects=False`): ads.txt is a publisher-controlled URL and a
transparent 30x by httpx would bypass `_check_safe_host` on the
resolved Location, re-opening the same SSRF surface the main path
already closed.
Surfaced as a defense-in-depth follow-up by the round-2 security
review on PR #753 — was pre-existing behavior, not regressed by that
PR, but worth closing.
ads.txt fetch is best-effort by construction (any non-200 returns an
empty MANAGERDOMAIN list); publishers who 30x their ads.txt now fall
through to "no managerdomain found", and the SDK surfaces the
publisher's original 404 — the same outcome as if the publisher had
no ads.txt at all. Acceptable for a fallback path.
Adds `test_ads_txt_30x_is_not_followed` covering the new behavior.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 352d1bb commit 76a679f
2 files changed
Lines changed: 40 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
625 | 625 | | |
626 | 626 | | |
627 | 627 | | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
628 | 636 | | |
629 | 637 | | |
630 | 638 | | |
631 | 639 | | |
632 | 640 | | |
633 | 641 | | |
634 | | - | |
| 642 | + | |
635 | 643 | | |
636 | 644 | | |
637 | 645 | | |
638 | 646 | | |
639 | | - | |
| 647 | + | |
640 | 648 | | |
641 | 649 | | |
642 | 650 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2300 | 2300 | | |
2301 | 2301 | | |
2302 | 2302 | | |
| 2303 | + | |
| 2304 | + | |
| 2305 | + | |
| 2306 | + | |
| 2307 | + | |
| 2308 | + | |
| 2309 | + | |
| 2310 | + | |
| 2311 | + | |
| 2312 | + | |
| 2313 | + | |
| 2314 | + | |
| 2315 | + | |
| 2316 | + | |
| 2317 | + | |
| 2318 | + | |
| 2319 | + | |
| 2320 | + | |
| 2321 | + | |
| 2322 | + | |
| 2323 | + | |
| 2324 | + | |
| 2325 | + | |
| 2326 | + | |
| 2327 | + | |
| 2328 | + | |
| 2329 | + | |
| 2330 | + | |
| 2331 | + | |
| 2332 | + | |
2303 | 2333 | | |
2304 | 2334 | | |
2305 | 2335 | | |
| |||
0 commit comments