feat: inject visitor identity headers into proxied workspace app requests - #27929
Open
ianp-rr wants to merge 1 commit into
Open
feat: inject visitor identity headers into proxied workspace app requests#27929ianp-rr wants to merge 1 commit into
ianp-rr wants to merge 1 commit into
Conversation
…ied app requests Add configurable HTTP header injection for workspace app proxying. When enabled, the proxy injects X-Coder-User-Id, X-Coder-Username, and X-Coder-User-Email headers identifying the authenticated visitor. Each header is gated by an independent deployment setting (default off). Incoming X-Coder-* headers are always stripped to prevent spoofing, regardless of whether injection is enabled. Visitor identity is baked into the signed app token at issuance time to avoid per-request DB lookups. New deployment flags: --proxy-header-pass-user-id --proxy-header-pass-username --proxy-header-pass-user-email The flags are marked for external workspace proxies and wired through the wsproxy server command so behavior is consistent on external proxies. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
ianp-rr
marked this pull request as ready for review
August 6, 2026 19:47
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds opt-in visitor identity headers to workspace app proxying, so apps running inside a workspace can identify the authenticated Coder user visiting them (for example, to attribute actions in shared apps or drive app-level authorization).
Three deployment settings control which headers are injected, all default off:
--proxy-header-pass-user-id→X-Coder-User-Id--proxy-header-pass-username→X-Coder-Username--proxy-header-pass-user-email→X-Coder-User-EmailIncoming
X-Coder-*request headers are always stripped before proxying to prevent spoofing, regardless of settings. Visitor identity is captured in the signed app token at issuance, so header injection adds no per-request database lookups. Unauthenticated (public app) requests carry no identity, so no headers are injected for them. The settings are marked for external workspace proxies and wired throughcoder wsproxy server, so behavior is consistent on both the built-in proxy and external proxies.Security notes
http.Header.Setrejects control characters.--proxy-header-pass-user-email.SignedToken.MatchesRequest; cookie scoping ensures each browser session carries its own signed token.Verification
Integration tests spin up a full deployment with a workspace app that echoes received
X-Coder-*request headers back as response headers, then assert injection, spoof-stripping, and per-setting selectivity through a real proxied request:Test_ResolveRequest(token issuance) also passes with the new visitor fields.AI disclosure
Per the AI Contribution guidelines: this PR was developed with AI assistance (Claude) under my direction, and I take ownership of its content. The change has been verified as described above.