Skip to content

httpcli, actor: propagate actor on all internal requests

Administrator requested to merge main-dry-run/propagate-actor into main

Created by: bobheadxi

Propagates actor ID on all outgoing internal requests and adds middleware that services can use to pick up actors from incoming requests and add it to the request context. The middleware is currently only applied to frontend's internal API handler, which already has something similar. Also adds metrics to see the number of requests that are user-authenticated vs internal-authenticated.

This more generalized actor handling replaces all existing usage of X-Sourcegraph-User-ID. The header is also renamed to X-Sourcegraph-Actor-ID to more accurately reflect actor.ID, though backcompat is retained mostly with the old behaviour (though drops support for setting the ID to 0 to imply an internal user)

The plan is to also apply this to searcher separately in https://github.com/sourcegraph/sourcegraph/issues/28412 (in the scope of PD 503 #27916 (closed))

Closes https://github.com/sourcegraph/sourcegraph/issues/27918

Related changes

Turned out to require a number of changes because of import cycles, now that httpcli imports actor to add actor propagation to the default internal HTTP client

Merge request reports

Loading