mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: extract, log, and strip aibridgeproxy request ID header in aibridged (#23731)
## Problem `aibridgeproxyd` sends `X-AI-Bridge-Request-Id` on every MITM request to `aibridged` for cross-service log correlation, but aibridged never reads it. The header is silently forwarded to upstream LLM providers. ## Changes * Renamed the header to `X-Coder-AI-Governance-Request-Id` to match the existing `X-Coder-AI-Governance-*` convention. * `aibridged` now extracts the header, logs it and strips it before forwarding upstream. * Added `TestServeHTTP_StripInternalHeaders` to verify no `X-Coder-*` headers leak to upstream
This commit is contained in:
@@ -16,6 +16,10 @@ import (
|
||||
// that use per-user LLM credentials but cannot set custom headers.
|
||||
const HeaderCoderToken = "X-Coder-AI-Governance-Token" //nolint:gosec // This is a header name, not a credential.
|
||||
|
||||
// HeaderCoderRequestID is a header set by aibridgeproxyd on each
|
||||
// request forwarded to aibridged for cross-service log correlation.
|
||||
const HeaderCoderRequestID = "X-Coder-AI-Governance-Request-Id"
|
||||
|
||||
// IsBYOK reports whether the request is using BYOK mode, determined
|
||||
// by the presence of the X-Coder-AI-Governance-Token header.
|
||||
func IsBYOK(header http.Header) bool {
|
||||
|
||||
Reference in New Issue
Block a user