From 9dfee9b368246b016c65807eaa06cd5ec7e7fd06 Mon Sep 17 00:00:00 2001 From: Danyang Chen Date: Wed, 2 Dec 2026 15:11:42 +0800 Subject: [PATCH 1/2] deploy: keep the isolated Bot Social TRUST_PROXY default one the service accepts The overlay defaulted TRUST_PROXY to a list that also contained loopback, and loadTrustProxy refuses to mix loopback with address entries. The refusal is thrown at module load, before listen, so the container exited 1 and restarted forever with /healthz never answering. - drop the loopback token from the overlay default - join the two halves in trust_proxy.test.ts: read the overlay's TRUST_PROXY default and assert loadTrustProxy accepts it, so the default cannot drift back to one the service rejects Refs #3498 --- deploy/isolated/bot-social.compose.yml | 2 +- services/bot-social/test/trust_proxy.test.ts | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/deploy/isolated/bot-social.compose.yml b/deploy/isolated/bot-social.compose.yml index 59421701f..a008c0269 100644 --- a/deploy/isolated/bot-social.compose.yml +++ b/deploy/isolated/bot-social.compose.yml @@ -9,7 +9,7 @@ services: PORT: "8787" DATA_DIR: /data PUBLIC_BASE_URL: ${FLYBOT_WORKSPACE_BOT_SOCIAL_PUBLIC_URL:?Set the FlyBot Workspace public /social URL} - TRUST_PROXY: ${FLYBOT_WORKSPACE_BOT_SOCIAL_TRUST_PROXY:-172.16.0.0/12,10.0.0.0/8,192.168.0.0/16,loopback} + TRUST_PROXY: ${FLYBOT_WORKSPACE_BOT_SOCIAL_TRUST_PROXY:-172.16.0.0/12,10.0.0.0/8,192.168.0.0/16} volumes: - bot-social-data:/data ports: diff --git a/services/bot-social/test/trust_proxy.test.ts b/services/bot-social/test/trust_proxy.test.ts index eb4587495..20e410e5e 100644 --- a/services/bot-social/test/trust_proxy.test.ts +++ b/services/bot-social/test/trust_proxy.test.ts @@ -1,4 +1,7 @@ import assert from "node:assert/strict"; +import { readFileSync } from "node:fs"; +import { dirname, resolve } from "node:path"; +import { fileURLToPath } from "node:url"; import { test } from "node:test"; import { Platform } from "../src/platform.js"; import { buildServer } from "../src/server.js"; @@ -134,3 +137,15 @@ test("a configured proxy cidr is believed, and only it", async (t) => { const B = await ownerWithBot(s.app, "sven"); assert.equal(await addressOfCreate(s.app, B, "656565", { remoteAddress: "203.0.113.9", xff: "198.51.100.8" }), "203.0.113.9"); }); + +test("the isolated Bot Social overlay's TRUST_PROXY default is one the service accepts", () => { + const here = dirname(fileURLToPath(import.meta.url)); + const overlay = readFileSync(resolve(here, "../../../deploy/isolated/bot-social.compose.yml"), "utf8"); + const line = overlay.split("\n").find((text) => text.includes("TRUST_PROXY:")); + assert.ok(line, "the overlay sets TRUST_PROXY"); + const match = /TRUST_PROXY:.*:-([^}]*)\}/.exec(line); + assert.ok(match, "the overlay gives TRUST_PROXY a default"); + const parsed = loadTrustProxy(match[1]); + assert.equal(parsed.kind, "cidrs"); + assert.ok(parsed.peers.length > 0); +}); From 8c5bda659f57d3a17f723f2ccd9c5ead6793303f Mon Sep 17 00:00:00 2001 From: Danyang Chen Date: Wed, 2 Dec 2026 15:20:49 +0800 Subject: [PATCH 2/2] Record the modified Bot Social trust-proxy test in the provenance manifest The overlay-default test changes a file that comes from the Bot Social snapshot, so it moves from the identical-file list to modified_files with the original hash kept, and the component file count follows it down by one. Refs #3498 --- docs/upstream/bot-social-files.json | 6 ------ docs/upstream/migration-manifest.json | 12 +++++++++++- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/docs/upstream/bot-social-files.json b/docs/upstream/bot-social-files.json index e54e65e72..b18fe6bdc 100644 --- a/docs/upstream/bot-social-files.json +++ b/docs/upstream/bot-social-files.json @@ -1961,12 +1961,6 @@ "mode": "100644", "bytes": 6881 }, - "test/trust_proxy.test.ts": { - "sha256": "b578fa4f1f1e3bc7d7d295b0e638b64d79e0bc22912571a150d22803293539c4", - "git_blob_sha": "eb45874953fd4ffd3eddbdab7bd5ebcfdc5e265c", - "mode": "100644", - "bytes": 6229 - }, "test/relationship_request_expiry.test.ts": { "sha256": "9ba880c302665d30d2fb0b3e3c5f22cd4a51e62fdefd81b3e82e587ba09747d0", "git_blob_sha": "42626a067df17c4bba43e12c01bccfc8bd194956", diff --git a/docs/upstream/migration-manifest.json b/docs/upstream/migration-manifest.json index 5b0dbf822..31934acf0 100644 --- a/docs/upstream/migration-manifest.json +++ b/docs/upstream/migration-manifest.json @@ -1737,7 +1737,7 @@ "scripts/install.sh", "scripts/mcp-smoke.ts" ], - "file_count": 436 + "file_count": 435 } }, "not_imported": { @@ -2268,6 +2268,16 @@ "bytes": 3982, "reason": "Derived the rate-limit notice lower bound from the burst's own duration so the tests stop failing when the suite loads the machine; the rendered sentence and product code are untouched.", "license_notice": "Apache-2.0 (FlyBot) or MIT (Bot Social) file modified in this snapshot; see ORIGIN.md." + }, + "services/bot-social/services/bot-social/test/trust_proxy.test.ts": { + "destination": "services/bot-social", + "path": "test/trust_proxy.test.ts", + "original_sha256": "b578fa4f1f1e3bc7d7d295b0e638b64d79e0bc22912571a150d22803293539c4", + "original_git_blob_sha": "eb45874953fd4ffd3eddbdab7bd5ebcfdc5e265c", + "new_sha256": "b642429ce93673b08e3fdea3702b345f1f899a875cc65bbc35f0cdfee74db2a0", + "bytes": 6992, + "reason": "Added a test that reads the isolated overlay's TRUST_PROXY default and asserts loadTrustProxy accepts it; the snapshot checked the YAML and the parser separately, so the two were never joined.", + "license_notice": "Apache-2.0 (FlyBot) or MIT (Bot Social) file modified in this snapshot; see ORIGIN.md." } }, "core_fork_removed": {