mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #2374] [MERGED] Enforce the SSRF guard in http_binary #5561
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#5561
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/2374
Author: @Romuromylus
Created: 6/5/2026
Status: ✅ Merged
Merged: 6/6/2026
Merged by: @Romuromylus
Base:
refactor← Head:fix/ssrf-http-binary-guard📝 Commits (3)
5c091edEnforce the SSRF guard in http_binaryf5ac1ddRe-validate redirects and pin DNS in http_binary against SSRF6a9faf3Add tests for the http_binary DNS resolve/pin guard📊 Changes
1 file changed (+187 additions, -7 deletions)
View changed files
📝
src-tauri/src/commands/storage/http.rs(+187 -7)📄 Description
Linked issue
Closes #2300
Why this change
http_binaryresolves content-supplied URLs (avatar/background/image references from imported character cards and lorebooks viaload_url_binary), so it is an SSRF sink. It passedallow_local=truetois_allowed_outbound_url, disabling the internal-host guard entirely — and even with the guard enabled, the original one-line flip left two bypasses the issue calls out: redirect-following (a public host can302into169.254.169.254) and DNS rebinding (a public-looking host resolving to a reserved IP).What changed
is_allowed_outbound_url(url, false)so local/reserved hosts (IMDS, localhost, private ranges) are blocked.redirect::Policy::none(max 5) and re-validate everyLocationthrough the same SSRF guard, instead of blindly chasing reqwest's default redirect policy into an internal address.resolve_to_addrsso DNS rebinding can't slip a reserved address past the host check. IP-literal hosts are already screened by the URL guard and skip pinning.custom_tools.rswebhook hardening (redirected_custom_tool_webhook_url/custom_tool_webhook_resolved_addresses).Refactor impact
Primary owner: Rust storage (
src-tauri/src/commands/storage/http.rs)Impact areas reviewed:
load_url_binary_for_stateresolvesasset://localhostviaload_local_asset_binarybeforehttp_binary, so managed local-asset loading is unaffected.bot_browser.rsfetches public card hosts; CDN redirects to public hosts are still followed (now re-validated and pinned).Boundary notes:
marinara_security::{is_allowed_outbound_url, is_local_or_reserved_ip}; no new layer boundary crossed.Pressure points touched:
Validation
pnpm checkpasses before PR push/handoffManual verification notes
cargo clippy --workspace --all-targets -- -D warnings— cleancargo test --workspace— green, including:http_binary_blocks_local_and_reserved_hosts(IMDS / localhost / 127.0.0.1 / 10.x / 172.16.x / 192.168.x /[::1]rejected before any network call),redirect_revalidation_blocks_reserved_locations(a302to a reserved host is rejected),redirect_revalidation_allows_public_relative_locations(a public relative redirect still resolves).Feature Discoverability
Reason:
Docs and release impact
Summary by CodeRabbit
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.