fix: require auth for non-loopback remote daemons#369
Conversation
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: da4c460234
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
src/daemon-client.ts
Outdated
| if (normalized === 'localhost' || normalized === '::1' || normalized === '[::1]') return true; | ||
| return /^127(?:\.\d{1,3}){3}$/.test(normalized); |
There was a problem hiding this comment.
Treat IPv4-mapped loopback hosts as local
isLoopbackHostname only whitelists localhost, ::1, and 127/8, so a base URL like http://[::ffff:127.0.0.1]:4310 (which Node normalizes to hostname [::ffff:7f00:1]) is treated as non-loopback and rejected without a daemon auth token. That causes local-only daemon endpoints to fail the new trust check even though they are loopback addresses, which is inconsistent with the “non-loopback requires auth” behavior this change is trying to enforce.
Useful? React with 👍 / 👎.
Summary
Require daemon auth when
AGENT_DEVICE_DAEMON_BASE_URLpoints to a non-loopback host so remote command execution is not accepted from unauthenticated external URLs.Update the daemon-client tests and remote-tenancy/config docs to reflect the authenticated-only remote flow. Touched 6 files total, and scope stayed within the remote-daemon client/tests/docs surface.
Validation
pnpm check:quickpnpm check:unit