fix(skills-hub): cover remaining SSRF fetch paths (salvage #22804) - #22843
Merged
Merged
Conversation
🔎 Lint report:
|
| Rule | Count |
|---|---|
invalid-argument-type |
3 |
First entries
run_agent.py:12944: [invalid-argument-type] invalid-argument-type: Argument to function `len` is incorrect: Expected `Sized`, found `(str & ~AlwaysFalsy) | (dict[Unknown | str, Unknown | str | dict[str, str]] & ~AlwaysFalsy) | (Any & ~AlwaysFalsy) | ... omitted 3 union elements`
run_agent.py:6872: [invalid-argument-type] invalid-argument-type: Argument to function `build_anthropic_client` is incorrect: Expected `str`, found `str | dict[Unknown | str, Unknown | str | dict[str, str]] | Any | ... omitted 3 union elements`
run_agent.py:12941: [invalid-argument-type] invalid-argument-type: Argument to function `_is_oauth_token` is incorrect: Expected `str`, found `str | dict[Unknown | str, Unknown | str | dict[str, str]] | Any | ... omitted 3 union elements`
✅ Fixed issues (3):
| Rule | Count |
|---|---|
invalid-argument-type |
3 |
First entries
run_agent.py:12944: [invalid-argument-type] invalid-argument-type: Argument to function `len` is incorrect: Expected `Sized`, found `(str & ~AlwaysFalsy) | (dict[Unknown, Unknown] & ~AlwaysFalsy) | (Any & ~AlwaysFalsy) | ... omitted 3 union elements`
run_agent.py:12941: [invalid-argument-type] invalid-argument-type: Argument to function `_is_oauth_token` is incorrect: Expected `str`, found `str | dict[Unknown, Unknown] | Any | ... omitted 3 union elements`
run_agent.py:6872: [invalid-argument-type] invalid-argument-type: Argument to function `build_anthropic_client` is incorrect: Expected `str`, found `str | dict[Unknown, Unknown] | Any | ... omitted 3 union elements`
Unchanged: 4198 pre-existing issues carried over.
Diagnostics are surfaced as warnings — this check never fails the build.
This was referenced May 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Salvage of #22804 —
tools/skills_hub.pynow does manual redirect re-validation across all attacker-controlled fetch paths (UrlSource,WellKnownSkillSource,ClawHubSourcerawUrl fallback), closing the redirect-bypass gap that #10029's preflightis_safe_urldoesn't cover.Threat model
Three fetch paths take URLs the attacker controls:
UrlSource._fetch_text()— user runshermes skills install <attacker-URL>WellKnownSkillSource._parse_index() / _fetch_text()— attacker-controlled.well-known/skills/server lists arbitrary URLsClawHubSource._fetch_text()—rawUrl/downloadUrlfrom version metadata fallback path#10029 (still open) preflights
is_safe_url(url)but keepsfollow_redirects=True. A public-looking URL that 302s to127.0.0.1:6379or169.254.169.254/...(cloud metadata) bypasses the preflight entirely. That's the gap this PR closes for the skills hub.Changes (contributor commit)
tools/skills_hub.py: new_guarded_http_gethelper. Disables auto-redirects, re-runsis_safe_url+check_website_accessper hop (5-hop cap), usesurljoinfor relativeLocationheaders. Wires it into the four attacker-controlled fetch sites listed above.rawUrlprivate path.Other fetch sites in the file (clawhub.ai download, skills.sh, api.github.com, lobehub, hermes docs) target hard-coded trusted hosts and aren't SSRF surface.
Validation
Closes #13583 (covers the remaining SSRF fetch paths). Supersedes #10029.