Repository navigation
Description
Split from #3894.
Problem The live check of #3894 must show that Crawl4AI refuses a redirect from a public host to a private address. The project owns no safe public test host, and the body of #3894 makes the check conditional on one. ## Why it is deferred The check waits on a public test host that the project controls. No such host exists today, and only a person can provide it. ## Acceptance criteria - A public test host that the project controls returns a redirect to a private address. - The live check follows the redirect and records a refusal with an empty body. - The host name comes from the test configuration and not from the committed file. - The check skips with a reason when the configuration names no host.
Proposed design
Problem statement
The live check devops k8s crawl4ai-check does not test a redirect from a public host to a private address. This item adds the redirect row to the command. The host comes from settings, and the case skips when the setting is unset. The public host and the live proof are deferred to a separate issue.
Acceptance criteria
Requirement: Redirect rows
When a redirect host is configured, the check SHALL send each route of ROUTES to that host with the bearer token and SHALL record one row for each route with the role <redirect-host>.
Scenario: Each route sends the redirect host
- WHEN A test calls
send_redirectwith a fakehttpx2client, a token and the hosthttps://redirect.example/ - THEN The test gets one row for each of the five routes, each with the route name, the role
<redirect-host>and the status of the fake reply, and the fake saw the bearer token on each request
Requirement: Refusal of the redirect target
The check SHALL mark a redirect row as refused only when is_refusal accepts the reply, and the row SHALL record the length of that reply.
Scenario: Crawl4AI refuses the redirect target
- WHEN The fake client answers the redirect request with status 400 and the body
{"detail": "URL blocked (SSRF protection): URL blocked"} - THEN The row has
refusedtrue andbody_bytesequal to the length of that refusal body
Requirement: Served private target fails
The command SHALL count an unrefused redirect row among the failed checks and SHALL exit 1.
Scenario: Crawl4AI serves the redirect target
- WHEN A test runs the command with a host configured and the fake service answers one redirect row with status 200 and a page body while every other row is refused
- THEN The command raises
ServiceProbeError, the report shows the row asNOT refused, and the process exits 1
Requirement: Host from settings
The check SHALL take the redirect host from get_crawl4ai_redirect_test_host and MUST NOT hold a host name of its own.
Scenario: Settings supply the host
- WHEN A test patches
get_crawl4ai_redirect_test_hostto returnhttps://redirect.example/and runs the command - THEN Each redirect request goes to that host and the printed report shows
<redirect-host>instead of the host name
Requirement: Skip without host
The command SHALL print a skip reason that names crawl4ai.redirect_test_host and SHALL NOT change the exit code when the setting is unset.
Scenario: No host configured
- WHEN A test runs the command with
crawl4ai.redirect_test_hostunset and each other check passing - THEN The output holds the skip message that names
crawl4ai.redirect_test_host, no redirect request is sent, and the command exits 0
Requirement: Dry-run plan
The request plan SHALL hold one redirect request for each route with the role <redirect-host> when a host is set and MUST NOT hold the host name.
Scenario: Plan names the role only
- WHEN A test patches
get_crawl4ai_redirect_test_hostto returnhttps://redirect.example/and runs the command with--dry-run - THEN The plan holds five redirect requests whose target ends with
<redirect-host>and noredirect.examplestring
Existing Tool Considered
No alternatives check has run. go-httpbin (https://github.com/mccutchen/go-httpbin) is an open, maintained HTTP test server with a /redirect-to endpoint and an operator-set target allowlist. It covers the redirect endpoint for the deferred host. It lacks a public deployment that the project controls, and only a person can provide that host. The change builds one optional probe row, one settings field and getter, and one skip message. The cost is about 80 lines and an estimated 15k tokens to write. Each later fix costs an estimated 5k tokens. Keeping it costs an estimated 2k tokens a year. The elapsed time is half a day.
Key questions
- Where does the check read the redirect host?: From a new field
redirect_test_hostonCrawl4AIConfiginsrc/devops_cli/config/settings.py. The field is typed likeurlasHttpUrlStr | Nonewith the defaultNone. A newget_crawl4ai_redirect_test_hostreads it next toget_crawl4ai_api_token. It is not a constant insrc/devops_cli/config/defaults.py. The generateddocs/CONFIGURATION.mdanddocs/ENV_VARS.mdare regenerated for the new key. (best practice) [sources: src/devops_cli/config/settings.py, src/devops_cli/config/defaults.py, docs/CONFIGURATION.md, docs/ENV_VARS.md]- Chosen: Settings field read by a getter. It follows
crawl4ai.urlandget_crawl4ai_api_token, keeps the value out of git, and aNonedefault gives the skip. - Rejected: CLI option
--redirect-host. The issue asks for the test configuration, and a person would pass the host at each run. - Rejected: Committed file in the repository. The issue forbids a committed host name.
- Chosen: Settings field read by a getter. It follows
- Does the redirect host join the existing target matrix of
internal_targets?: No. A separatesend_redirectfunction and the role<redirect-host>add the case.internal_targetsandsend_with_tokenkeep their five targets, so the existing rows and their tests do not change. (best practice) [sources: src/devops_cli/k8s/crawl4ai_check.py]- Chosen: Separate
send_redirectfunction and<redirect-host>role. It keeps the five-target matrix, the request counts ofplan_checkand the existing tests unchanged. - Rejected: Add the host to
internal_targets. It changes the existing matrix, the request counts of the plan and the existing tests.
- Chosen: Separate
- Does a skipped redirect case change the exit code?: No. The command collects a failure only from an unrefused internal row, an unrefused request without the token, or a pod that reached a blocked destination. It raises only when that list is non-empty. A skip adds no failure, so the command exits 0. (best practice) [sources: src/devops_cli/commands/k8s/crawl4ai_check.py, openspec/changes/archive/2026-11-08-3894-crawl4ai-check-command/proposal.md]
- Chosen: The skip does not fail the command. The issue requires the skip to keep the exit code, and a missing optional host is no defect of the service.
- Rejected: The skip fails the command. Every run without the setting would fail, and a person could not use the check.
- Does an unrefused redirect row fail the check?: Yes.
is_refusalaccepts only a 400 or 403 with a JSON object that holds the one keydetail. A served page, a fault or a redirect is no refusal. The redirect rows join the internal rows that the command tests withnot r.refused, so a private page that Crawl4AI serves exits 1. (best practice) [sources: src/devops_cli/k8s/crawl4ai_check.py, src/devops_cli/commands/k8s/crawl4ai_check.py]- Chosen: An unrefused redirect row fails the command. A served private page is the vulnerability that the check exists to catch, and the command already fails an unrefused internal target.
- Rejected: Record the row without failing. The report would show a served private page while the command exits 0, which hides the defect.
- How does the dry run name the redirect requests without printing the host?: The command reads
get_crawl4ai_redirect_test_host()once before the dry-run branch. It passes the host toplan_check(local_port, context, redirect_host)and tosend_redirect. The plan adds one request for each route with the role<redirect-host>and never the host string.plan_checkkeeps no settings read of its own, and the dry-run branch stays in the command. (best practice) [sources: src/devops_cli/k8s/crawl4ai_check.py, src/devops_cli/commands/k8s/crawl4ai_check.py]- Chosen: Pass the host into
plan_check. The plan function stays free of settings reads, and the plan shows the redirect requests only when a host is set. - Rejected: Read the getter inside
plan_check. It hides a settings read in a function that the tests call with plain arguments, and it reads the setting twice in a real run.
- Chosen: Pass the host into
- Is test(k8s): live check that Crawl4AI refuses internal URLs #3894 a dependency of this item?: No. The command of test(k8s): live check that Crawl4AI refuses internal URLs #3894 is merged:
src/devops_cli/commands/k8s/crawl4ai_check.pyandsrc/devops_cli/k8s/crawl4ai_check.pyexist. The archived proposal of test(k8s): live check that Crawl4AI refuses internal URLs #3894 names test(k8s): check that Crawl4AI refuses a redirect to a private address #4019 as the tracker of the redirect case. [sources: src/devops_cli/commands/k8s/crawl4ai_check.py, src/devops_cli/k8s/crawl4ai_check.py, openspec/changes/archive/2026-11-08-3894-crawl4ai-check-command/proposal.md] - What does a refusal of the redirect target look like?: The service answers 400 or 403 with a JSON object that holds the one key
detail, a text. The pinned image gives 400 with{"detail":"URL blocked (SSRF protection): URL blocked"}.is_refusalaccepts only that shape, so a page, a fault or a redirect is no refusal. [sources: src/devops_cli/k8s/crawl4ai_check.py, docs/CLUSTER.md]
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
devops-cli-service commentedon Nov 7, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
testprefix of the title gives the type.(k8s)scope of the title gives the scope.The check waits on a public test host that only a person can provide, so the team cannot start it now.The check shows that the SSRF protection holds when a public host redirects to a private address.The work needs a controlled public host, new test configuration and a skip path.Both items check that Crawl4AI refuses internal destinations; #3894 tests direct internal URLs and this item tests a redirect from a public host to a private address.devops-cli-service commentedon Nov 9, 2026
Refine cannot set this item to Ready at 6121d09 until a person answers the questions below. Reply in a comment or edit the body, and the next refine round looks at the item again.
devops-cli-service commentedon Nov 23, 2026
Owner question: See the first point of Open questions in the section Proposed design of the body.
Options
Recommendation: Decide the question: only a person can answer it.
Evidence
devops-cli-service commentedon Nov 28, 2026
Next step: the alternatives check records a verdict. See the section Proposed design of the body.