mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #5588] [Feature]: Add optional outbound proxy support (MARINARA_PROXY) #3095
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#3095
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 @stbanana on GitHub (Aug 28, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5588
Originally assigned to: @SpicyMarinara on GitHub.
What problem does this solve?
On restricted networks (for example mainland China),
raw.githubusercontent.comis often unreachable, which breaks agent and capability-package installation:package-manager.service.ts'sfetchBytes()callssafeFetch(), which is backed by undici'sfetchplus a self-builtAgent— not Node's nativehttporaxios.raw.githubusercontent.com/Pasta-Devs/Marinara-Agents.undici ignores both the OS/system proxy and the
HTTP_PROXY/HTTPS_PROXYenvironment variables, so a direct connection to GitHub times out. Marinara Engine currently has no proxy path at all, and manually downloading Marinara-Agents does not import correctly either (there may be a correct manual-import workflow I have not found).It would be much more convenient if outbound requests could optionally route through a local proxy, so users on restricted networks can pull agents and artifacts — and, when needed, send model requests through the same proxy.
Proposed solution
Add an environment variable, tentatively named MARINARA_PROXY. When it is set,
safeFetchswaps its self-builtAgentfor undici'sSocks5ProxyAgent(SOCKS5) orProxyAgent(HTTP/HTTPS) as the dispatcher; when it is unset, behavior is identical to today.socks5://,socks5h://,http://,https://MARINARA_PROXY→HTTPS_PROXY→ALL_PROXYprocess.envis checked per request, so.envchanges take effect within ~2s without a restartpolicy.allowLocalrequests (Ollama / LM Studio / loopback) never go through the proxyAlternatives considered
I tried several alternative approaches with Claude's help — TUN proxying, injection/hooking, and so on — but each introduced additional side effects. A source-level change that adds one optional proxy branch is the only approach with no side effects and is user-friendly.
Additional context
resolveOutboundProxyUrl()returnsnull, so the existingnew Agent({...})direct path runs exactly as before.policy.allowLocalis true (Ollama / LM Studio / loopback), the original direct branch runs and never touches the proxy.validateOutboundUrl+validateResolvedAddresses) all run before the proxy branch.agentOptions.bodyTimeout/headersTimeout, but every caller already suppliessignal: AbortSignal.timeout(...).Unsupported outbound proxy protocol ...).Template check
Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:
@kolacheee commented on GitHub (Aug 28, 2026):
Thank you for the contribution @stbanana! Just giving you a heads up that Marinara is the only one with the power to merge PRs from non-Pasta Dev contributors and she is on vacation currently, so you will unfortunately have to wait some days before it gets reviewed.
@SpicyMarinara commented on GitHub (Aug 30, 2026):
Maintainer review: the user problem is valid, but the proposed acceptance criteria need tightening before implementation.
The Engine should support restricted-network agent/package downloads, but proxying must preserve the existing trust boundary:
safeFetch. The request must remain bound to the validated destination, or proxy support must be limited to exact trusted origins where equivalent egress validation is enforceable.policy.allowLocal. That property grants permission to use local URLs; it does not mean every request using that policy is local.agentOptions, header/body timeouts, redirect validation, and TCP keepalive behavior must be preserved or explicitly rejected when unsupported.MARINARA_PROXY, or whether ambientHTTPS_PROXY/ALL_PROXYvariables are also supported. If standard environment variables are honored,NO_PROXYsemantics and the resulting behavior change must be addressed and documented.The smallest safe first delivery would proxy only the official Marinara-Agents catalog and artifact downloads through explicit
MARINARA_PROXY, restricted to their exact trusted GitHub origins. Provider-wide proxying can follow once the broader SSRF and local-routing semantics are proven.PR #5602 is aligned with the feature direction, but its current implementation does not yet satisfy these requirements.
@SpicyMarinara commented on GitHub (Aug 30, 2026):
On hold until properly addressed.
@stbanana commented on GitHub (Aug 31, 2026):
Thank you, Collaborators, for the detailed explanation! I had originally assumed that routing all requests through the proxy—bypassing the existing trust boundary—was the expected behavior for users who employ a proxy, as this would make it more convenient to access resources within a VPN's internal network (e.g., a campus network).
Once again, thank you for your dedication and hard work!