sourcegraph/internal/audit
Robert Lin 38d4e83e59
feat/requestclient: propagate original User-Agent as X-Forwarded-For-User-Agent (#64113)
Propagates a for-reference-only record of the first `User-Agent` seen
when a request gets into Sourcegraph across services and contexts. This
allows telemetry to try and indicate where a request originates from
(https://github.com/sourcegraph/sourcegraph/pull/64112), rather than
only having the most recent user-agent.

A new header and `requestclient.Client` property
`X-Forwarded-For-User-Agent` and `ForwardedForUserAgent` is used to
explicitly forward this. Strictly speaking I think we're supposed to
just forward `User-Agent` but it looks like in multiple places we
add/clobber the `User-Agent` ourselves.

The gRPC propagator currently sets user-agent on outgoing requests, this
change also makes that consistent with the HTTP transport, such that
both only explicitly propagate `X-Forwarded-For-User-Agent`

## Test plan

Unit tests
2024-07-29 14:17:25 -07:00
..
audittest bazel: transcribe test ownership to bazel tags (#62664) 2024-05-16 15:51:16 +01:00
integration bazel: transcribe test ownership to bazel tags (#62664) 2024-05-16 15:51:16 +01:00
audit_test.go feat/requestclient: propagate original User-Agent as X-Forwarded-For-User-Agent (#64113) 2024-07-29 14:17:25 -07:00
audit.go feat/requestclient: propagate original User-Agent as X-Forwarded-For-User-Agent (#64113) 2024-07-29 14:17:25 -07:00
BUILD.bazel bazel: transcribe test ownership to bazel tags (#62664) 2024-05-16 15:51:16 +01:00
security_events_test.go disable audit logging to db by default (#51686) 2023-05-23 18:10:43 +00:00
security_events.go disable audit logging to db by default (#51686) 2023-05-23 18:10:43 +00:00