Repository navigation
Description
Context & Rationale
Filed from the unchecked P0 entry at docs/ROADMAP.md:878 (at 308a71f), which had no issue, so #739's migration would have dropped it (decision D9 of the 2026-10-01 agentic quality assessment).
This is a security defect: a public → link-local → public redirect chain reached the link-local hop (the entry's repro_wf.py). As a P0 security fix it qualifies as a critical fix for the current release if a person admits it; until then it is in the backlog. The entry splits the work into four PRs; only PR1 (the per-hop veto) is the P0, so this item is PR1, and PR2-PR4 are recorded below for refinement into their own items.
The Researcher harness (src/devops_cli/ai/harness/agents.py:130) calls fetch_web_page (src/devops_cli/ai/common_tools.py:360-387), which validates the URL once (:368), then follows redirects (:372); _validate_response_egress (:338-347) checks only the final resp.url, after all hops. The except Exception arm (:386-387) returns every failure, SSRF block included, as page text. resp.text (:378-380) skips the WHATWG BOM and <meta charset> steps. _html_to_markdown (:295-313) strips only <script>/<style>, escapes nothing and cuts at a raw offset (:384); _HTMLContentExtractor (src/devops_cli/ai/library/docs_ingester.py:39, :268) keeps dialogs, and _HEADING_PATTERN (:22) re-parses its unescaped text. PromptInjectionDefender's opt-in hook takes 3 arguments (src/devops_cli/ai/agents/guardrails.py:233); src/devops_cli/ai/agents/runner.py:72 passes 4 (TypeError, logged). The tool description (common_tools.py:394) and Core Vision principle 3 claim SSRF protection; tests/test_common_tools.py:109-125 sends no redirect and accepts any failure string. HttpClientBroker (src/devops_cli/http/broker.py:52-69) vetoes every hop in a request hook. vibes hit the same defects (docs/RETROSPECTIVE.md:163,164,169; examples/adaptive-web-crawler/markdown_extract.py:68-70).
Scope & Deliverables
- Deliverable: PR1: route
fetch_web_pagethroughget_broker()(broker.py:170-172) so the hop walk, amax_redirectsbelow httpx2's 20 (httpx2/_config.py:220) and the veto are the library's;_validate_requestreads the tool's policy (validate_url_egress(allow_private=False),_validate_fetch_domain,common_tools.py:321-335) fromrequest.extensions(broker.py:54-57,109-110). Add a 3xx-chain test (tests/test_http_broker.py). PR2: replace theexceptarm; raiseToolFailed(src/devops_cli/exceptions/ai.py:200) for non-2xx and connection failures (tool_failed,runner.py:156-158); letSSRFBlockedErrorreacherror(:164-171). PR3: adefault_encodingcallable (httpx2/_models.py:539,672-680) prescans 1024 bytes for<meta charset>, thencharset_normalizer, pinned inpyproject.toml; checkresp.contentfor a BOM and setresp.encodingfirst. Port vibestest_crawler.py:306-351,396-475ontohttpx2.MockTransport. PR4:render_untrusted_page(html, url, budget)onmarkdownify>=1.2MarkdownConverter(escape_misc=True, heading_style='ATX')andbeautifulsoup4as direct dependencies, notWebFetchLocalTool(escaping off,pydantic_ai/common_tools/web_fetch.py:121). Hand-roll only aconvert_prefence longer than any backtick run, adecompose()pass over chrome and[role=dialog], and a blank-line cut appending unusedDEFAULT_TRUNCATION_SUFFIX(config/defaults.py:331). Return markdown,truncated,token_estimate, removed regions and a provenance line from the response URL, never<base>; wrapsanitize_prompt_boundary_tagsoutput in<untrusted_web_page>; flaginjection_suspectedon ascan_texthit, without blocking. Delete_html_to_markdownand the fallback stub (common_tools.py:263-271). PR5: routeingest_remote_docsthrough it; delete_HTMLContentExtractor. - Acceptance criteria: each deliverable lands with a test that fails before it; tests never touch the network;
uv run devops cipasses. Measured in the roadmap entry:.venv/bin/python -m pytest tests/test_common_tools.py tests/test_runtime_security_and_ssrf_hardening.py tests/test_http_broker.py -k 'web_fetch or broker': 13 passed.python repro_wf.py(web_fetchoverhttpx2.MockTransport): a public, link-local, public chain returned# Finalafter the transport received the link-local hop; an error status, a<meta charset>page and a BOM page came back as error text, mojibake and a kept BOM.python repro_broker2.py: the broker raisedSSRFBlockedErrorbefore sending the second hop.python probe_html.py:_html_to_markdownemitted 3 of 3 chrome regions and an injected heading.mdvenv/bin/python md_probe2.py(markdownifyescape_misc=Trueplusdecompose()): 0 injected headings. - Key questions:
- Is the Researcher harness used today? If nothing calls
fetch_web_page, the fix still lands, because the MCP and agent tool surfaces expose it.
- Is the Researcher harness used today? If nothing calls
- Constraint: PR1 ships the P0 alone. Veto each redirect request, not in a
responsehook. Keep the per-hop policy env-independent (DNS-rebinding test,tests/test_common_tools.py:128-133):validate_url(src/devops_cli/core/validation.py:186-243) admits private targets underDEVOPS_CLI_AI_ALLOW_PRIVATE_NETWORK(:219-225);validate_url_egress(:101-149) does not.build_headers(broker.py:46-50) injectstraceparent(src/devops_cli/telemetry/context.py:86-92), soweb_fetchbuilds its own headers.httpx2==2.13.0is pinned (pyproject.toml:19); 302 tests never skip. Escape text nodes once, never inside code; a removed<main>must show in removed regions. SPA detection, headless escalation and strategy memory (vibespatterns/adaptive-headless-web-crawling.md:8) belong to v0.3.0.
Strategic Alignment
- Milestone: Backlog (no release)
- Depends on: none. Source:
docs/ROADMAP.md:878(308a71f).
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
dan-petty commentedon Oct 1, 2026
Admitted to v0.2.24 as a critical fix, by the owner's decision (2026-10-01): a P0 security defect fix, delivered before the cut.
dan-petty commentedon Oct 1, 2026
Closed by #902, merged into
release/v0.2.24.GitHub only acts on closing keywords when a pull request merges into the default branch, so this was closed by
devops gh issues close-merged.feat(release): v0.2.24 (#905)