Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gRPC API: Add support to control the internal request headers #34179

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

tyxia
Copy link
Member

@tyxia tyxia commented May 15, 2024

This is the follow-up of #34125.

#34125 provides the way to remove x-envoy-internal and x-forwarded-for in http asyncClient path.
This API PR provides the config options for envoy-gRPC (which is on top of http asyncClient) to remove x-envoy-internal and x-forwarded-for.

By default, those two config options are TRUE, which keeps the existing behavior. And next in the impl, envoy-gRPC client can config these two options(setting them to FALSE) to not add those two headers.

Signed-off-by: Tianyu Xia <tyxia@google.com>
Copy link

As a reminder, PRs marked as draft will not be automatically assigned reviewers,
or be handled by maintainer-oncall triage.

Please mark your PR as ready when you want it to be reviewed!

🐱

Caused by: #34179 was opened by tyxia.

see: more, trace.

Copy link

CC @envoyproxy/api-shepherds: Your approval is needed for changes made to (api/envoy/|docs/root/api-docs/).
envoyproxy/api-shepherds assignee is @lizan
CC @envoyproxy/api-watchers: FYI only for changes made to (api/envoy/|docs/root/api-docs/).

🐱

Caused by: #34179 was opened by tyxia.

see: more, trace.

tyxia added 2 commits May 15, 2024 12:48
Signed-off-by: Tianyu Xia <tyxia@google.com>
Signed-off-by: Tianyu Xia <tyxia@google.com>
@tyxia tyxia marked this pull request as ready for review May 15, 2024 23:26
@tyxia
Copy link
Member Author

tyxia commented May 15, 2024

/assign @htuch @lizan

PTAL, Thanks!

google.protobuf.BoolValue add_internal_header = 5;

// [#not-implemented-hide:]
// If true, x-forwarded-for header will be added to Envoy-gRPC request header.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realize that we're preserving backwards compatible behavior here by making the default true, but I think XFF for async client makes no sense. Async requests are sidecalls, we're not forwarding to the service on behalf of some client, we're making an RPC to some service mid-way through request processing. For gRPC in particular, I think it's a confusion to include XFF by default in the "gRPC metadata" - @markdroth.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sense. xff is to provide a client IP address to the server which is not applicable to sidecar case.

We probably should use runtime guard approach to make xff removal default. I removed this config from this PR.

PTAL, Thanks

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this makes sense based on my understanding of the original intent from https://www.envoyproxy.io/docs/envoy/latest/configuration/http/http_conn_man/headers.html#x-envoy-internal, although, again it's a bit weird to be attaching something like x-envoy-internal to gRPC - the destination service should know that any call to it is coming from a set of internal trusted clients.

@mattklein123 for a second opinion on this.

Copy link
Member Author

@tyxia tyxia May 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Friendly ping @mattklein123 's opinion.

I think the fundamental question here is :
For envoy-gRPC : Whether (1) we want to remove x-enovy-internal by default. OR (2) we want to keep x-envoy-internal but enable gRPC client's capability of removing it.

From strictly backwards-compatibility perspective, (2) is better. But if we are in agreement with end-state of removing this header from envoy-gRPC, (1) is good and its impact can be mitigated by runtime guard.

Signed-off-by: Tianyu Xia <tyxia@google.com>
@jmarantz
Copy link
Contributor

/wait (for CI to be made green)

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

Successfully merging this pull request may close these issues.

None yet

4 participants