molecule-core/workspace-server/cmd/memory-plugin-postgres
Hongming Wang 1052f8bdb0 fix(memory-plugin): bind to 127.0.0.1 by default
Self-review of PR #2906 flagged: defaultListenAddr was ":9100" — binds
on every container interface. Inside today's deployment that's moot
(no host port mapping, platform talks over loopback) but it's not
least-privilege. A future Dockerfile edit that publishes the port,
a misconfigured Fly machine, or a future cross-host plugin topology
would expose an unauth'd memory store.

Loopback is the right baseline. Operators with a multi-host topology
already override via MEMORY_PLUGIN_LISTEN_ADDR — that path is unchanged.

Tests:
  * TestLoadConfig_DefaultListenAddrIsLoopback pins the new default.
  * TestLoadConfig_ListenAddrEnvOverride pins the override path so
    operators relying on it don't break.
  * TestLoadConfig_MissingDatabaseURL covers the existing fail-fast.

No prior unit tests existed for loadConfig — boot_e2e_test.go always
sets MEMORY_PLUGIN_LISTEN_ADDR explicitly, so the default was never
exercised by tests. This PR adds that coverage.

Refs RFC #2728. Hardening follow-up to PR #2906.
2026-05-05 11:35:24 -07:00
..
migrations Memory v2 PR-3: built-in postgres plugin server + schema migrations 2026-05-04 07:31:56 -07:00
boot_e2e_test.go Memory v2 fixup Optional-2: real-subprocess boot E2E 2026-05-04 09:23:46 -07:00
config_test.go fix(memory-plugin): bind to 127.0.0.1 by default 2026-05-05 11:35:24 -07:00
E2E.md Memory v2 fixup Opt-2: add E2E.md operator runbook 2026-05-04 09:24:16 -07:00
main.go fix(memory-plugin): bind to 127.0.0.1 by default 2026-05-05 11:35:24 -07:00