Repository navigation
fix(loaders): SSRF-harden the #889 data loaders (integrates #1019) - #1031
Merged
Merged
Conversation
The new issue-889 loaders (graphql, figma, linear, monday, asana, clickup, shopify, box, zoom) fetched developer-configured endpoints via a shared httpx client created with follow_redirects=True and no SSRF validation — the exact fail-open pattern hardened away in #1027 for agents/tools. A trusted-looking endpoint could 302 to http://169.254.169.254/ (cloud metadata) or 127.0.0.1 and the client would follow it silently. http_client now yields a _GuardedHTTPClient wrapper that: - disables auto-redirects (owned client uses follow_redirects=False) and follows redirects manually, re-validating every hop via assert_response_url_public; - validates the initial URL on the library's own client. An injected client keeps its caller-owned request policy, but its redirect hops (server-supplied, attacker-influenced) are still validated. Adds hermetic SSRF regression tests (IP literals, no network) covering private/ metadata/loopback/IPv6 endpoints, non-http schemes, redirect-to-private on an injected client, allowed public redirects, and the redirect cap. Co-authored-by: Dhruv Garg <[email protected]>
BoxLoader spread **file_data after setting source/row/file_id, so a Box file whose own fields include "source", "row", or "file_id" would overwrite the loader's provenance metadata. Spread the entry first, then set the reserved keys. Co-authored-by: Dhruv Garg <[email protected]>
Co-authored-by: Dhruv Garg <[email protected]>
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.
Integrates the #889 data-loader expansion (PR #1019, by @DhruvGarg111) with a security fix applied on top.
What
httpx.Client(follow_redirects=True)with no URL validation — the same fail-open pattern hardened away for the agent HTTP tools in SSRF in agent HTTP tools + RSS loader (missing/fail-open URL guard) #1022/security: harden file tools, SSRF, A2A auth, CAG KV-cache, deps (#1021–#1026) #1027._http_utils.http_clientnow yields a_GuardedHTTPClientthat disables auto-redirects and re-validates every hop via the shared_url_guard; the library-owned client also validates the initial URL. Injected clients keep their caller-owned request policy but still have server-supplied redirect hops validated.tests/loaders/test_issue_889_ssrf.py) — private/metadata/loopback/IPv6/file://endpoints + redirect-to-private, IP literals, no network.BoxLoadermetadata (Box fields can no longer clobbersource/row/file_id).Review notes
Full adversarial review found the loaders otherwise solid: async offloading correct, Kafka is a real CI-wired testcontainer, pagination complete on every list endpoint,
uv.lockconsistent, noMagicMock. Box binary-file decoding deferred to #1030.Closes #1019. Closes #1029.
Co-authored-by: Dhruv Garg [email protected]