Skip to content

fix(demo): self-call host respects config.server.host#44

Merged
MorganOnCode merged 1 commit into
masterfrom
fix/demo-self-call-host
May 15, 2026
Merged

fix(demo): self-call host respects config.server.host#44
MorganOnCode merged 1 commit into
masterfrom
fix/demo-self-call-host

Conversation

@MorganOnCode
Copy link
Copy Markdown
Owner

Closes audit #14. The demo route's loopback fetch to its own server hardcoded `http://127.0.0.1:\${port}\`, which works in production (we listen on 0.0.0.0 so 127.0.0.1 inside the container resolves to the same process) but breaks if the operator ever sets `server.host` to a specific IP.

Fix is one line of logic: read `config.server.host`, and substitute `127.0.0.1` only when the configured host is the wildcard `0.0.0.0` (since wildcard isn't a valid client address).

Test plan

  • typecheck / lint / 452 tests pass
  • CI passes
  • After deploy: /demo SSE stream completes the 7 steps as before (no behaviour change with default config)

🤖 Generated with Claude Code

Closes audit #14. The demo route makes loopback fetch calls to its own
server (/supported, /verify, /settle, etc. -- a 7-step live demo). The
URL was hardcoded to http://127.0.0.1:${port}, which works because we
listen on 0.0.0.0 in production and 127.0.0.1 inside the container
reaches the same process. But it's brittle: any operator who changes
server.host to a specific IP would break the demo.

Fix: read fastify.config.server.host, and substitute 127.0.0.1 when the
configured host is the wildcard 0.0.0.0 (since the wildcard isn't a
valid client address).

No production behaviour change today -- server.host stays 0.0.0.0 so
the resulting URL is identical (127.0.0.1:port). The fix simply makes
the route honor whatever the operator configures.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@MorganOnCode MorganOnCode merged commit 9ca23c4 into master May 15, 2026
5 checks passed
@MorganOnCode MorganOnCode deleted the fix/demo-self-call-host branch May 15, 2026 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant