Skip to content

gRPC plugin framework does not respect --query.bearer-token-propagation flag #1821

Closed

Description

Requirement - what kind of business use case are you trying to solve?

I am trying to run elastic search storage back end via GRPC plugin and have the bearer token forwarded to the GRPC plugin server.

Problem - what in Jaeger blocks you from solving the requirement?

Query UI has an option to forward Bearer token to the storage back end using --query.bearer-token-propagation=true flag. However, when using the GRPC storage plugin, the context created with spanstore.ContextWithBearerToken(ctx, token) in https://github.com/jaegertracing/jaeger/blob/master/cmd/query/app/token_propagation_handler.go#L48 is not passed to the GRPC plugin.

Currently, the last place in the storage where the context with the bearer.token can be reached, is the GRPC client: https://github.com/jaegertracing/jaeger/blob/master/plugin/storage/grpc/shared/grpc_client.go.

This can be tested by adding these lines of code:

  str, ok := spanstore.GetBearerToken(ctx)
  fmt.Println(fmt.Sprintf(" =====================> CLIENT: The context is: %v ::: %t", str, ok))

to any of the following methods:

  • func (c *grpcClient) GetTrace(ctx context.Context, traceID model.TraceID) (*model.Trace, error)
  • func (c *grpcClient) GetServices(ctx context.Context) ([]string, error)
  • func (c *grpcClient) GetOperations(ctx context.Context, service string) ([]string, error)
  • func (c *grpcClient) FindTraces(ctx context.Context, query *spanstore.TraceQueryParameters) ([]*model.Trace, error)
  • func (c *grpcClient) FindTraceIDs(ctx context.Context, query *spanstore.TraceQueryParameters) ([]model.TraceID, error)

However, on the server part of the plugin, the context is a new instance because the plugin is running as a separate process.

Proposal - what do you suggest to solve the problem or improve the existing situation?

To fix this problem, the bearer token has to be passed inside of the GRPC requests to the GRPC server and the ContextWithBearerToken must be reconstructed on the other side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions