Skip to content

fix(utils): harden web URL fetch against SSRF#1373

Open
EaEa0001 wants to merge 1 commit intoagentscope-ai:mainfrom
EaEa0001:fix/ssrf-guard-web-fetch
Open

fix(utils): harden web URL fetch against SSRF#1373
EaEa0001 wants to merge 1 commit intoagentscope-ai:mainfrom
EaEa0001:fix/ssrf-guard-web-fetch

Conversation

@EaEa0001
Copy link
Copy Markdown

Summary

  • add URL validation for web fetch utility to only allow http/https
  • block localhost, loopback, link-local, and private network IP targets
  • resolve hostnames and reject non-public resolved addresses
  • disable automatic redirects and validate each redirect hop before following
  • add SSRF-focused tests for literal IP, DNS-to-private, redirect-to-loopback, public allowlist path, and binary fallback

Security Impact

This reduces SSRF risk in _get_bytes_from_web_url by preventing access to internal/local network resources and unsafe redirects.

Tests

  • PYTHONPATH=src python3 -m unittest tests.common_utils_security_test -v

@cla-assistant
Copy link
Copy Markdown

cla-assistant bot commented Mar 27, 2026

CLA assistant check
All committers have signed the CLA.

@EaEa0001
Copy link
Copy Markdown
Author

Closed per author request.

@EaEa0001 EaEa0001 closed this Mar 27, 2026
@EaEa0001 EaEa0001 deleted the fix/ssrf-guard-web-fetch branch March 27, 2026 04:26
@EaEa0001 EaEa0001 restored the fix/ssrf-guard-web-fetch branch March 30, 2026 08:50
@EaEa0001 EaEa0001 reopened this Mar 30, 2026
@EaEa0001 EaEa0001 force-pushed the fix/ssrf-guard-web-fetch branch from de2a556 to 47e8353 Compare March 30, 2026 09:01
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