Skip to content

armgit / mso

Public Imported from GitHub
0

Browser-based graphical shell and control plane for a Linux server you own — real terminal, file manager, live metrics and BYOK AI in one mobile-first workspace. Next.js 16 · React 19 · node-pty · Tailwind v4 · shadcn/ui. Public alpha, self-hosted.

fix(infra): support modern pinned DNS lookups

Rahman7e802746d0c8
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index 91bdc4ba..3552a959 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -4,6 +4,12 @@
Newest first. `docs/PROGRESS.md` is the source of truth for *why* a change was made;
this is the *what*, and it is what Settings → About shows as “What's new”.
+## 2026-09-06
+
+**Fixed**
+
+- `infra` support modern pinned DNS lookups
+
## 2026-09-05
**Added**
diff --git a/docs/PROGRESS.md b/docs/PROGRESS.md
index 59860a76..925eb42a 100644
--- a/docs/PROGRESS.md
+++ b/docs/PROGRESS.md
@@ -1,3 +1,7 @@
+## 2026-09-06 — Pinned provider DNS supports modern Node all-address lookup
+
+Dokploy credentials already used by Rahman Resources were valid, but MSO's SSRF-safe transport failed before opening the socket with `Invalid IP address: undefined`. Modern Node http/https may invoke a custom `lookup` with `options.all=true`; the pinned callback still returned the legacy `(address, family)` shape, so Node tried to consume a missing address from the wrong callback contract. The shared pinned lookup now returns a one-element `LookupAddress[]` in all-address mode and preserves the legacy shape otherwise. Dokploy's live `project.all` probe now succeeds through the DNS-pinned transport, and the same helper replaces the duplicate A2A loopback pinning callback. No SSRF policy, DNS-rebinding rejection, redirect rule, or credential boundary was weakened.
+
## 2026-09-06 — Local SI-Coder migration discovery
Integrations now detects an installed `~/.local/bin/sc` through its public metadata-only Integration Bundle v1 and surfaces a create-only **Import from SI-Coder** action. This is optional migration plumbing, not an MSO runtime dependency: no SC store internals are read, no secret values are auto-copied, existing MSO identities are preserved, and encrypted direct-credential transfer remains an explicit private flow.
diff --git a/lib/a2a/network.ts b/lib/a2a/network.ts
index 4ea90f74..eebb6a33 100644
--- a/lib/a2a/network.ts
+++ b/lib/a2a/network.ts
@@ -7,6 +7,7 @@ import {
assertSafeUrl,
resolveSafeProviderEndpoint,
safeProviderFetch,
+ pinnedProviderLookup,
} from "@/lib/host/ssrf";
export const A2A_ALLOW_LOOPBACK_ENV = "OS_A2A_ALLOW_LOOPBACK";
@@ -148,8 +149,7 @@ async function pinnedLoopbackFetch(
path: `${endpoint.url.pathname}${endpoint.url.search}`,
method: request.method,
headers: Object.fromEntries(request.headers.entries()),
- lookup: (_hostname, _options, callback) =>
- callback(null, endpoint.address, endpoint.family),
+ lookup: pinnedProviderLookup(endpoint.address, endpoint.family),
},
(response) => {
resolve(
diff --git a/lib/host/ssrf.test.ts b/lib/host/ssrf.test.ts
index dca30366..8ed1bbc0 100644
--- a/lib/host/ssrf.test.ts
+++ b/lib/host/ssrf.test.ts
@@ -1,5 +1,5 @@
import { afterEach, describe, expect, it } from "vitest";
-import { assertSafeUrl, isForbiddenProviderAddress, resolveSafeProviderEndpoint } from "./ssrf";
+import { assertSafeUrl, isForbiddenProviderAddress, pinnedProviderLookup, resolveSafeProviderEndpoint } from "./ssrf";
const originalHttp = process.env.OS_CUSTOM_PROVIDER_ALLOW_INSECURE_HTTP;
afterEach(() => {
@@ -39,6 +39,23 @@ describe("custom-provider network boundary", () => {
expect(isForbiddenProviderAddress(address), address).toBe(false);
});
+ it("returns the pinned address in both modern all-address and legacy lookup callback shapes", async () => {
+ const lookup = pinnedProviderLookup("1.1.1.1", 4);
+ await expect(new Promise((resolve, reject) => {
+ lookup("provider.example", { all: true }, (error, address, family) => {
+ if (error) reject(error);
+ else resolve({ address, family });
+ });
+ })).resolves.toEqual({ address: [{ address: "1.1.1.1", family: 4 }], family: undefined });
+
+ await expect(new Promise((resolve, reject) => {
+ lookup("provider.example", { all: false }, (error, address, family) => {
+ if (error) reject(error);
+ else resolve({ address, family });
+ });
+ })).resolves.toEqual({ address: "1.1.1.1", family: 4 });
+ });
+
it("rejects DNS rebinding answers before any socket is opened", async () => {
const privateResolver = async () => [{ address: "10.0.0.7", family: 4 as const }];
await expect(resolveSafeProviderEndpoint("https://provider.example/v1", privateResolver))
diff --git a/lib/host/ssrf.ts b/lib/host/ssrf.ts
index ba47d7a9..45c655b0 100644
--- a/lib/host/ssrf.ts
+++ b/lib/host/ssrf.ts
@@ -1,7 +1,7 @@
import { lookup as dnsLookup } from "node:dns/promises";
import { request as httpRequest } from "node:http";
import { request as httpsRequest } from "node:https";
-import { isIP } from "node:net";
+import { isIP, type LookupFunction } from "node:net";
import { Readable } from "node:stream";
const FORBIDDEN_HOST_SUFFIXES = [".localhost", ".local", ".internal", ".home", ".lan"];
@@ -11,6 +11,17 @@ type LookupAnswer = { address: string; family: number };
type Resolver = (hostname: string, options: { all: true; verbatim: true }) => Promise<LookupAnswer[]>;
export type PinnedEndpoint = { url: URL; address: string; family: 4 | 6 };
+/** Node 20+ may request `lookup(..., { all: true })` from http/https (for
+ * auto-family selection). A custom lookup must then return LookupAddress[], not
+ * the legacy `(address, family)` tuple. Keep the already-reviewed pinned address
+ * in either callback shape so the socket can never perform a second DNS lookup. */
+export function pinnedProviderLookup(address: string, family: 4 | 6): LookupFunction {
+ return (_hostname, options, callback) => {
+ if (options.all) callback(null, [{ address, family }]);
+ else callback(null, address, family);
+ };
+}
+
function parseIpv4(address: string): number[] | null {
const parts = address.split(".");
if (parts.length !== 4) return null;
@@ -161,7 +172,7 @@ export async function safeProviderFetch(input: RequestInfo | URL, init?: Request
path: `${pinned.url.pathname}${pinned.url.search}`,
method: request.method,
headers: Object.fromEntries(request.headers.entries()),
- lookup: (_hostname, _options, callback) => callback(null, pinned.address, pinned.family),
+ lookup: pinnedProviderLookup(pinned.address, pinned.family),
}, (response) => {
const status = response.statusCode ?? 502;
const stream = Readable.toWeb(response) as ReadableStream<Uint8Array>;