Fix SSRF and unsafe artifact path opening guards#9
Draft
cursor[bot] wants to merge 2 commits into
Draft
Conversation
Co-authored-by: g00sifer Development Lab <g00siferdev-py@users.noreply.github.com>
Co-authored-by: g00sifer Development Lab <g00siferdev-py@users.noreply.github.com>
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.
Bug and impact
fetch_url,http_request, and the new browser-fetch URL gate could allow private/local IP literals in bracketed IPv6 forms such as IPv4-mapped loopback, enabling agent tool SSRF against local services.open_path, which accepted absolute paths and could open files/apps outside the workspace when clicked.Root cause
host_str()text and reparsed it asIpAddr; bracketed IPv6 literals did not parse through that path, so IPv6-local and IPv4-mapped private addresses escaped the blocklist.open_pathtreated absolute paths as trusted instead of enforcing the artifact contract that paths are workspace-relative.Fix
url::Hostvalues directly and classify IPv4, IPv6, IPv4-mapped IPv6, carrier-grade NAT, link-local, loopback, unique-local, multicast, unspecified, documentation, and discard-only literals as blocked.fetch_urlandhttp_request.open_pathto workspace-relative paths and verify resolved paths remain inside the workspace.Validation
cargo +stable test --manifest-path src-tauri/Cargo.toml agent_tools::tests::cargo +stable test --manifest-path src-tauri/Cargo.toml