mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #2478] [Issue]: sidecar embeddings endpoint performs request-controlled outbound fetches without SSRF screen or admin gate (server mode) #1222
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#1222
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?
Originally created by @Romuromylus on GitHub (Jun 6, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2478
Originally assigned to: @SpicyMarinara on GitHub.
Summary
Severity: Low — security (SSRF), server runtime only. The
sidecar_embeddingsHTTP endpoint accepts a fully request-supplied connection/provider object (includingbaseUrl) and performs server-side embedding fetches with no admin-secret gate and no SSRF/private-IP screen, so a request can drive an outbound fetch to an internal/metadata host (e.g.169.254.169.254).Expected behavior
Request-supplied embedding connections should be treated like other privileged provider operations: require admin access (as the privileged remote commands do), and/or run the resolved base URL through the same private-IP/SSRF screen the LLM and
load_url_binarypaths use.Actual behavior
sidecar_embeddingsis not inis_privileged_remote_command(:1023-1042) and never callsrequire_admin_access_for_command.embed_text→ batch embedders callensure_embedding_url_allowed(prompts.rs:858), which delegates tois_allowed_outbound_url(url, /*allow_local=*/true). Incrates/security/src/lib.rs:90-92,allow_localshort-circuits totrueafter only a scheme check — it blocksfile://but not private/link-local/metadata hosts. The crate has the proper screen (is_local_or_reserved_ipv4) and the LLM path uses the strictis_allowed_provider_url(false), but the embedding path opts intoallow_local = true.So a request with
baseUrl: http://169.254.169.254/...reaches the outbound client. Reachable on desktop loopback (by-design no-auth) and, in opt-in server mode, by any caller that passes the existing CSRF/basic-auth/IP-allowlist middleware.Steps to reproduce
POST /api/sidecar/v1/embeddingswith{"input":"x","connection":{"provider":"openai","baseUrl":"http://169.254.169.254/..."}}from a context that passes the middleware.Impact area
Environment
1fae2c42Logs, screenshots, or video
Static trace:
http_server.rs:1084/1111(handler/inner, no admin gate, not inis_privileged_remote_command:1023-1042);prompts.rs:858ensure_embedding_url_allowed→is_allowed_outbound_url(url, true);crates/security/src/lib.rs:90-92(allow_local short-circuit). Contrast strict screen used byllm.rs:1539andhttp.rs.Regression notes
Not a regression —
http_server.rs/ the Rust embedding transport are refactor-only surfaces with no main (web) equivalent. Filing as a refactorbug. Server-mode-only and behind the existing middleware for remote callers, so Low. Distinct from the previously-filed SSRF onload_url_binary/ the provider-transport cluster (different sink).Additional context
Fix: pass
allow_local = falsefor embedding base URLs (use the strictis_allowed_provider_url), and/or require admin access for request-supplied embedding connections like the other privileged provider operations. Strongest-class fix-pattern-already-in-repo inconsistency — the siblingload_url_binary/LLM paths already screen private hosts.Template check
Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked:
@SpicyMarinara commented on GitHub (Jun 6, 2026):
Fixed on refactor in
038b7220.Embedding endpoints now use the provider URL SSRF allow-list instead of the broad outbound sidecar allowance, so request-controlled local/admin targets are rejected.
Verification: pnpm typecheck; pnpm build; pnpm check:architecture; cargo check --manifest-path src-tauri/Cargo.toml --workspace; focused Rust backup/profile tests; git diff --check; no .test.ts/.test.tsx files present.