Skip to content

test(docker): cover the per-URL crawler_configs PDF SSRF guard - #2158

Merged
ntohidi merged 1 commit into
developfrom
test/per-url-pdf-ssrf-regression
Aug 20, 2026
Merged

test(docker): cover the per-URL crawler_configs PDF SSRF guard#2158
ntohidi merged 1 commit into
developfrom
test/per-url-pdf-ssrf-regression

Conversation

@ntohidi

@ntohidi ntohidi commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

Follow-up to #2150 (test only, no behaviour change).

Why

handle_crawl_request builds the per-URL config list on a separate branch from the top-level config, so the url_validator wiring has to be repeated there. #2150 fixed that gap, but nothing in the suite exercises it — the existing pairing tests only go through the top-level path. The guard could be dropped by a future refactor and no test would go red.

crawler_configs is a public per-URL field on /crawl, so an unvetted PDF strategy sent that way would do an unvalidated download of whatever the request names.

What

One test in tests/test_docker_pdf_crawler_pairing.py: sends a PDF strategy via crawler_configs (top-level config left clean, two URLs so the config-list branch engages) and asserts every per-URL PDF strategy reaching arun_many carries validate_url_destination.

It also asserts exactly one PDF strategy survives deserialization — without that, a future change that drops the strategy would make the loop pass vacuously and the test would protect nothing.

pool_mock gains an arun_many stub, which the config-list path needs.

Testing

  • tests/test_docker_pdf_crawler_pairing.py + tests/test_issue_2127_docker_pdf.py: 9 passed.
  • Mutation check: removing the guard from deploy/docker/api.py fails this test and nothing else, so it is genuinely load-bearing.

cc @SohamKukreti

handle_crawl_request builds the per-URL config list on a separate branch
from the top-level config, so the url_validator wiring has to be repeated
there. #2150 fixed that, but nothing exercised it — the existing pairing
tests only go through the top-level path, leaving the guard free to be
dropped by a future refactor without a red test.

Verified by mutation: removing the guard from api.py fails this test and
nothing else.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@ntohidi
ntohidi merged commit 8319275 into develop Aug 20, 2026
1 check passed
@ntohidi
ntohidi deleted the test/per-url-pdf-ssrf-regression branch August 20, 2026 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant