mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #7698] [MERGED] fix(server): localhost provider URLs reach 127.0.0.1 when the resolver only answers ::1 #7885
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#7885
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/7698
Author: @Gunterlie
Created: 10/15/2026
Status: ✅ Merged
Merged: 10/15/2026
Merged by: @Gunterlie
Base:
staging← Head:fix/localhost-loopback-ipv4-k7q📝 Commits (2)
9364586fix(server): localhost provider URLs reach 127.0.0.1 when the resolver only answers ::1e5b50c5test(server): localhost regression also stubs the callback resolver, so the local-URLs path is proven📊 Changes
2 files changed (+90 additions, -4 deletions)
View changed files
📝
packages/server/src/utils/security.ts(+24 -4)➕
scripts/regressions/localhost-loopback-fetch.regression.ts(+66 -0)📄 Description
Linked issue
Closes #7513
Why this change
http://localhost:8080failed withconnect ECONNREFUSED ::1:8080, while llama.cpp listened on127.0.0.1. On that host the resolver mapslocalhostto::1only, so Node's happy-eyeballs has no IPv4 address to fall back to.PROVIDER_LOCAL_URLS_ENABLED,validateOutboundUrlForFetchskipped the pinned lookup and let undici resolve the name itself, so the same failure hit that path too.What changed
packages/server/src/utils/security.ts:isLocalhostName();normalizeLoopbackUrluses it.resolveHostnameanswerslocalhostnames with127.0.0.1and::1without DNS (RFC 6761:localhostis always loopback).allowLocalpath keeps the pinned lookup forlocalhostnames, and the pinned lookup returns both loopback addresses foralllookups, so the connector can try IPv4 and IPv6.scripts/regressions/localhost-loopback-fetch.regression.ts: stubs both DNS lookup forms solocalhostresolves to::1only, then fetcheshttp://localhost:<port>from servers on127.0.0.1and::1, with local URLs off and on. It fails onstagingwith the reporter's error and passes with this change.Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
Agent-run checks (not a human verification):
localhost-loopback-fetchpasses; without the fix it fails withECONNREFUSED ::1(both policies).pnpm run lint(tsc) and Prettier pass.pnpm check, container build, a real llama.cpp on an IPv6-onlylocalhosthost.Security note: this touches the outbound URL guard. Only the literal
localhostnames change; they always map to loopback, which the existing loopback/local policy checks still gate. Other hostnames keep the DNS path and the pinned single address.Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)Summary by CodeRabbit
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.