You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: only trust x-forwarded-host from configured trusted proxies (#26204) (#26316)
Backport of #26204 (commit b5ef700) to `release/2.29`
Replace RequestHost with httpmw.EffectiveHost, which honors
X-Forwarded-Host only when the original socket peer is a configured
trusted origin, otherwise falling back to the received Host header.
<details>
<summary>The following cherry-pick conflicts were resolved</summary>
This release branch predates several things the fix was built on: the
agentchat
and agentproc packages, the OBSERVABILITY.md doc, the cdr.dev/slog v3
migration,
and the user_agent request-log field. Rebasing produced six conflicts.
Dropped (absent on this branch, so not part of the backport):
- .claude/docs/OBSERVABILITY.md
- agent/agentchat/log_test.go (entire agentchat package absent)
- agent/agentproc/api_test.go (entire agentproc package absent)
Adapted:
- agent/api.go — kept the release-branch version and added only the
required , nil
for the new two-argument loggermw.Logger signature; did not pull in
agentchat.Middleware or its import.
- coderd/httpmw/loggermw/logger.go — kept cdr.dev/slog v1, removed the
now-unused
httpapi import, and applied the security change (log the trust-aware
effective
host plus received_host). Did not introduce the user_agent field, which
this
branch doesn't log.
- coderd/httpmw/loggermw/logger_internal_test.go — updated
requiredFields to match
(added received_host, kept user_agent out) and rewrote the new
TestLoggerMiddleware_HostFields to use the branch's local fakeSink
helper, since
the fix's testutil.NewFakeSink/Entries() API doesn't exist here.
</details>
> [!NOTE]
> Breaking change. See the original PR for the breaking-change details.
0 commit comments