fix(skills): harden skill import against DNS rebinding and SSRF TOCTOU - #5986
fix(skills): harden skill import against DNS rebinding and SSRF TOCTOU#5986bitboody wants to merge 20 commits into
Conversation
… flexible private blocking
…URLs in path and netloc
… URLs in path and handle localhost/IP addresses
…esolved IP addresses and prevent TOCTOU vulnerabilities
… GitHub and skills.sh URLs
…ck_fetch_url test alias
|
Update: I pushed the reviewed four-commit fix directly onto this PR branch in Original review of head I checked the latest head and found four author-actionable issues in the skill-import pinning and host-dispatch paths. Findings
Related workThis is related to, but not duplicated or superseded by, #5261, #5474, #5727, #5893, or draft #5953. PR #5986 remains the only candidate implementing the skill-importer part of #5609. Validation
|
|
Reviewed head The pinning approach is right and I confirmed it end-to-end: a real import of Findings
Open Questions
Validation
PR Hygiene
|
Summary
Hardened the skill import fetch path (services/memory/skill_importer.py and outbound URL validation utilities) against multiple vectors of Server-Side Request Forgery (SSRF). This PR fixes a critical DNS rebinding time-of-check to time-of-use (TOCTOU) vulnerability where httpx performed an independent second DNS lookup on redirect hops, allowing attackers to swap validated public IPs for internal targets (e.g., loopback, cloud metadata, or RFC 6598 CGNAT ranges). It introduces atomic IP pinning per hop, and strict domain boundary checking to block substring spoofing.
Target branch
dev, notmain. All PRs land indev;mainis curated by the maintainer at each release. If your PR is onmainby accident, click "Edit" on this PR and change the base.Linked Issue
Fixes #5609
Type of Change
Checklist
devdocker compose uporuvicorn app:app) and verified the change works end-to-end. Type-checks and unit tests are not enough.How to Test
Visual / UI changes — REQUIRED if you touched anything that renders
No visual changes done.