[GH-ISSUE #21] MARINARA_ALLOW_PRIVATE_CONNECTION_BASE_URL defaut value results in non functional local/self-hosted environment #1

Closed
opened 2026-10-20 17:23:55 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @FriedCaper on GitHub (Mar 24, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/21

Originally assigned to: @SpicyMarinara on GitHub.

This "address Copilot PR review comments" commit includes:

SSRF: gate allowPrivate behind MARINARA_ALLOW_PRIVATE_CONNECTION_BASE_URL env var

the implemented solution blocks API URLs for which this returns true:

/**
 * Check whether a hostname resolves to a private/reserved IP range.
 * Blocks RFC 1918, loopback, link-local, and cloud metadata addresses.
 */
export function isPrivateOrReservedHost(hostname: string): boolean {
  // Block obvious private hostnames
  if (hostname === "localhost" || hostname === "[::1]" || hostname === "metadata.google.internal") {
    return true;
  }

  // Check IP address patterns
  const ip = hostname.replace(/^\[|\]$/g, ""); // strip IPv6 brackets
  return isPrivateIP(ip);
}

Several problems here:

  • this does not actually "check whether a hostname resolves to a private IP" (no actual DNS resolution), so someone could use localtest.me or any other public DNS record that points to any IP address including private
  • separately, this default behavior currently means that 99% of users attempting an entirely local+self hosted installation (likely with no local DNS server so resorting to localhost for their inference engine URL) will need to figure out how to work around this via the (undocumented) env var, which goes against the local-first spirit in the README.
  • and if the first problem is resolved, then it will ONLY be possible to use inference APIs on the public internet (making this project no longer fully local)

I think this is an overzealous suggestion from Copilot that hurts the vast majority of your userbase. It would only help people putting Marinara Engine on a publicly accessible server, but then again this project is single user (no auth/accounts) so no sane person will do that.

SSRF is not a concern for an app intended to be self hosted privately, so I think this check should be removed altogether; it doesn't even make sense to default to false.

Originally created by @FriedCaper on GitHub (Mar 24, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/21 Originally assigned to: @SpicyMarinara on GitHub. This ["address Copilot PR review comments"](https://github.com/SpicyMarinara/Marinara-Engine/pull/16/commits) commit includes: > SSRF: gate allowPrivate behind MARINARA_ALLOW_PRIVATE_CONNECTION_BASE_URL env var the implemented solution blocks API URLs for which this returns true: ``` javascript /** * Check whether a hostname resolves to a private/reserved IP range. * Blocks RFC 1918, loopback, link-local, and cloud metadata addresses. */ export function isPrivateOrReservedHost(hostname: string): boolean { // Block obvious private hostnames if (hostname === "localhost" || hostname === "[::1]" || hostname === "metadata.google.internal") { return true; } // Check IP address patterns const ip = hostname.replace(/^\[|\]$/g, ""); // strip IPv6 brackets return isPrivateIP(ip); } ``` Several problems here: - this does not actually "check whether a hostname resolves to a private IP" (no actual DNS resolution), so someone could use `localtest.me` or any other public DNS record that points to any IP address including private - separately, this default behavior currently means that 99% of users attempting an entirely local+self hosted installation (likely with no local DNS server so resorting to localhost for their inference engine URL) will need to figure out how to work around this via the (undocumented) env var, which goes against the local-first spirit in the README. - and if the first problem is resolved, then it will ONLY be possible to use inference APIs on the public internet (making this project no longer fully local) I think this is an overzealous suggestion from Copilot that hurts the vast majority of your userbase. It would only help people putting Marinara Engine on a publicly accessible server, but then again this project is single user (no auth/accounts) so no sane person will do that. SSRF is not a concern for an app intended to be self hosted privately, so I think this check should be removed altogether; it doesn't even make sense to default to false.
Author
Owner

@SpicyMarinara commented on GitHub (Mar 24, 2026):

Fixed.

<!-- gh-comment-id:4116693635 --> @SpicyMarinara commented on GitHub (Mar 24, 2026): Fixed.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#1
No description provided.