[PR #495] [MERGED] Fix .local provider endpoint validation #4642

Closed
opened 2026-10-22 04:09:25 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/495
Author: @cha1latte
Created: 5/6/2026
Status: ✅ Merged
Merged: 5/7/2026
Merged by: @cha1latte

Base: main ← Head: fix/issue-492-local-hostname


📝 Commits (6)

  • 7558245 Allow .local provider endpoints
  • 6642984 Record PR metadata for issue 492 proof
  • 2ee9b4d Guard empty mDNS resolution results
  • 9df97a1 Improve live mDNS visual proof
  • 564d803 Fix proof page failure styling
  • e71a96a Merge upstream main into .local provider endpoint fix

📊 Changes

4 files changed (+73 additions, -1 deletions)

View changed files

📝 packages/server/src/routes/connections.routes.ts (+3 -0)
📝 packages/server/src/services/llm/base-provider.ts (+1 -0)
📝 packages/server/src/utils/security.ts (+23 -1)
📝 packages/server/test/security-utils.test.ts (+46 -0)

📄 Description

Linked issue

Closes #492

Why this change

  • OAI-compatible endpoints hosted at .local mDNS names, such as http://name.local:5001/v1, were rejected with Outbound URL hostname is local or reserved before Marinara could reach the local provider.
  • The reporter noted this worked before 1.5.7 and works in SillyTavern; local model servers commonly advertise .local hostnames on macOS and LAN setups.

What changed

  • Added an explicit allowMdns outbound URL policy for .local hostnames.
  • Enabled that policy only for user-configured provider paths: LLM generation, connection tests, and provider model fetching.
  • Kept generic outbound URL handling locked down so .local remains rejected unless the caller opts into mDNS provider behavior.
  • Preferred IPv4 records for allowed .local hostnames to avoid Windows resolving IPv6 link-local addresses first when an IPv4 local service is reachable.
  • Added focused security regression coverage for the new mDNS provider policy.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

Machine verification performed by Codex:

  • pnpm --dir packages/server exec tsx ../../scratch/issue-492-local-hostname-repro.ts
    • Proved default/generic outbound policy still rejects .local.
    • Proved explicit provider mDNS policy accepts http://name.local:5001/v1.
  • pnpm --dir packages/server exec tsx ../../scratch/issue-492-real-mdns-provider-check.ts
    • Started a throwaway OpenAI-compatible /v1/models mock endpoint.
    • Resolved this machine's real mDNS hostname, VENGEANCE.local, through the OS resolver.
    • Fetched http://VENGEANCE.local:<port>/v1/models through Marinara's real safeFetch path and received HTTP 200 with model JSON.
  • pnpm --dir packages/server exec tsx --test test/security-utils.test.ts passed, 14/14 tests.
  • pnpm check passed.

Visual proof:

Live .local provider proof showing HTTP 200 from /v1/models

scratch/issue-492-live-mdns-proof-page.png is a real browser screenshot of the live http://VENGEANCE.local:<port>/proof page. The page displays its own .local URL, fetches http://VENGEANCE.local:<port>/v1/models, shows HTTP 200 OK, and renders the raw model JSON returned by the throwaway provider server.

No manual-only blocker remains for the core claim; the .local behavior was tested locally with an actual OS-resolved .local hostname and a real HTTP response.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Version/release files updated (only if this PR includes a version bump)

Docs/release notes:

  • No docs or version files changed.
  • This is a narrow provider URL compatibility fix.

UI evidence (if applicable)

Backend/provider URL fix; no app UI changed.

Visual proof is committed at scratch/issue-492-live-mdns-proof-page.png and shows the proof page URL, fetched .local models endpoint, HTTP 200 result, and raw model JSON from the live .local provider verification.

Summary by CodeRabbit

  • New Features

    • Added multicast DNS (mDNS) support to enhance local network discovery and connectivity for image generation and model providers.
    • Improved URL validation with enhanced hostname resolution and IPv4 address preference handling.
  • Tests

    • Added comprehensive test coverage for mDNS hostname resolution and validation edge cases.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/495 **Author:** [@cha1latte](https://github.com/cha1latte) **Created:** 5/6/2026 **Status:** ✅ Merged **Merged:** 5/7/2026 **Merged by:** [@cha1latte](https://github.com/cha1latte) **Base:** `main` ← **Head:** `fix/issue-492-local-hostname` --- ### 📝 Commits (6) - [`7558245`](https://github.com/Pasta-Devs/Marinara-Engine/commit/7558245e3a388d80117bed5a35e0f901632d1756) Allow .local provider endpoints - [`6642984`](https://github.com/Pasta-Devs/Marinara-Engine/commit/66429846e59b3056ead83ba5f7433bfc57afdc10) Record PR metadata for issue 492 proof - [`2ee9b4d`](https://github.com/Pasta-Devs/Marinara-Engine/commit/2ee9b4dcea9e8fdbe685dabdf02fa3fde43ebf0f) Guard empty mDNS resolution results - [`9df97a1`](https://github.com/Pasta-Devs/Marinara-Engine/commit/9df97a1d18019416930ccf21f6a0bea802046f23) Improve live mDNS visual proof - [`564d803`](https://github.com/Pasta-Devs/Marinara-Engine/commit/564d803b66e58b8a39aa02bea8242c2efe512ca3) Fix proof page failure styling - [`e71a96a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e71a96adf9a86a034c10e9e86ccb10fefde6dc6f) Merge upstream main into .local provider endpoint fix ### 📊 Changes **4 files changed** (+73 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `packages/server/src/routes/connections.routes.ts` (+3 -0) 📝 `packages/server/src/services/llm/base-provider.ts` (+1 -0) 📝 `packages/server/src/utils/security.ts` (+23 -1) 📝 `packages/server/test/security-utils.test.ts` (+46 -0) </details> ### 📄 Description ## Linked issue <!-- Every PR should reference a feature request or issue report. If there isn't one yet, open one first to gather opinions: --> <!-- https://github.com/Pasta-Devs/Marinara-Engine/issues/new/choose --> Closes #492 ## Why this change <!-- What user problem, bug, or goal does this solve? --> - OAI-compatible endpoints hosted at `.local` mDNS names, such as `http://name.local:5001/v1`, were rejected with `Outbound URL hostname is local or reserved` before Marinara could reach the local provider. - The reporter noted this worked before 1.5.7 and works in SillyTavern; local model servers commonly advertise `.local` hostnames on macOS and LAN setups. ## What changed <!-- List the key changes in this PR --> - Added an explicit `allowMdns` outbound URL policy for `.local` hostnames. - Enabled that policy only for user-configured provider paths: LLM generation, connection tests, and provider model fetching. - Kept generic outbound URL handling locked down so `.local` remains rejected unless the caller opts into mDNS provider behavior. - Preferred IPv4 records for allowed `.local` hostnames to avoid Windows resolving IPv6 link-local addresses first when an IPv4 local service is reachable. - Added focused security regression coverage for the new mDNS provider policy. ## Validation <!-- Required: include commands run and/or manual checks performed --> - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` ### Manual verification notes <!-- Describe exactly what you tested in a real browser/app, step by step. --> <!-- ?? If an AI agent filled out or ticked these boxes for you, treat them --> <!-- as a TO-DO LIST, not as proof the work is done. Verify each item yourself --> <!-- before submitting. If you haven't verified it, untick the box. --> Machine verification performed by Codex: - `pnpm --dir packages/server exec tsx ../../scratch/issue-492-local-hostname-repro.ts` - Proved default/generic outbound policy still rejects `.local`. - Proved explicit provider mDNS policy accepts `http://name.local:5001/v1`. - `pnpm --dir packages/server exec tsx ../../scratch/issue-492-real-mdns-provider-check.ts` - Started a throwaway OpenAI-compatible `/v1/models` mock endpoint. - Resolved this machine's real mDNS hostname, `VENGEANCE.local`, through the OS resolver. - Fetched `http://VENGEANCE.local:<port>/v1/models` through Marinara's real `safeFetch` path and received HTTP 200 with model JSON. - `pnpm --dir packages/server exec tsx --test test/security-utils.test.ts` passed, 14/14 tests. - `pnpm check` passed. Visual proof: ![Live .local provider proof showing HTTP 200 from /v1/models](https://raw.githubusercontent.com/cha1latte/Marinara-Engine/564d803b66e58b8a39aa02bea8242c2efe512ca3/scratch/issue-492-live-mdns-proof-page.png) `scratch/issue-492-live-mdns-proof-page.png` is a real browser screenshot of the live `http://VENGEANCE.local:<port>/proof` page. The page displays its own `.local` URL, fetches `http://VENGEANCE.local:<port>/v1/models`, shows `HTTP 200 OK`, and renders the raw model JSON returned by the throwaway provider server. No manual-only blocker remains for the core claim; the `.local` behavior was tested locally with an actual OS-resolved `.local` hostname and a real HTTP response. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Version/release files updated (only if this PR includes a version bump) Docs/release notes: - No docs or version files changed. - This is a narrow provider URL compatibility fix. ## UI evidence (if applicable) Backend/provider URL fix; no app UI changed. Visual proof is committed at `scratch/issue-492-live-mdns-proof-page.png` and shows the proof page URL, fetched `.local` models endpoint, HTTP 200 result, and raw model JSON from the live `.local` provider verification. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added multicast DNS (mDNS) support to enhance local network discovery and connectivity for image generation and model providers. * Improved URL validation with enhanced hostname resolution and IPv4 address preference handling. * **Tests** * Added comprehensive test coverage for mDNS hostname resolution and validation edge cases. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:09:25 +07:00
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#4642
No description provided.