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

Append a request header with a value from a secret #37656

Closed
arkodg opened this issue Dec 13, 2024 · 8 comments
Closed

Append a request header with a value from a secret #37656

arkodg opened this issue Dec 13, 2024 · 8 comments
Labels
area/http area/sds SDS related enhancement Feature requests. Not bugs or questions.

Comments

@arkodg
Copy link
Contributor

arkodg commented Dec 13, 2024

Description:

I'd like the ability to append a request header value from a secret (SDS) , this header represents the API key header and the secret represents the actual API key

The request_headers_to_add field in the RouteConfiguration uses the HeaderValueOption which only supports a literal value

Relates to envoyproxy/gateway#4757

[optional Relevant Links:]

Any extra documentation required to understand the issue.

@arkodg arkodg added enhancement Feature requests. Not bugs or questions. triage Issue requires triage labels Dec 13, 2024
@arkodg
Copy link
Contributor Author

arkodg commented Dec 13, 2024

cc @mathetake @aabchoo

@adisuissa adisuissa added area/http area/sds SDS related and removed triage Issue requires triage labels Dec 16, 2024
@adisuissa
Copy link
Contributor

Sounds a bit risky.
Can you provide more details on the desired behavior (requirement) that you want to accomplish?

@jewertow
Copy link
Contributor

@adisuissa another use case: appending authentication header to the HTTP CONNECT request sent to the upstream forward proxy, like Squid. Currently, we can only set a literal value in tunneling_config.headers_to_add. Why do you think it's risky?

I could try to contribute this feature.

@arkodg
Copy link
Contributor Author

arkodg commented Jan 6, 2025

@adisuissa sharing a real use case example here

I would like to route API requests from downstream and upstream it to OpenAI, which uses an API Key as an authentication mechanism https://platform.openai.com/docs/quickstart?language-preference=curl#make-your-first-api-request
I cannot use the request_headers_to_add because I do not want to expose this sensitive key in the config dump, similar to the tls cert private key

@winston0410
Copy link

@adisuissa sharing a real use case example here

I would like to route API requests from downstream and upstream it to OpenAI, which uses an API Key as an authentication mechanism https://platform.openai.com/docs/quickstart?language-preference=curl#make-your-first-api-request

I cannot use the request_headers_to_add because I do not want to expose this sensitive key in the config dump, similar to the tls cert private key

I have similar usecase. I have a static website, and I need to communicate with an API behind Envoy. Instead of creating a proxy to add api token to the reqeust for me, I just want to let envoy handle that before routing traffic to that API

@adisuissa
Copy link
Contributor

adisuissa commented Jan 27, 2025

I agree that the header's value should not be part of the config-dump, and adding a way to annotate it as sensitive seems the right way to go. However, this is different than what I thought the original request was: adding an ability to copy the output of SDS and send it to the upstream.
FWIW, I think this header's value will still be dumped as part of the access-logs. I guess the better way to address this issue is to authenticate against a server and receive a token for the request, and that should be added to the request.

@arkodg
Copy link
Contributor Author

arkodg commented Jan 29, 2025

I like the annotation idea @adisuissa , does this design pattern already exist in Envoy Proxy today ?

looks like an attempt was made to redact header values in a bottom up way #27820
The goal is for this value to not be accessible in

  • config dump
  • access logs
  • or used in a substitution formatter in other places (like setting the header value using %REQ(X-API-TOKEN)%)

cc @mathetake @wbpcode

@arkodg
Copy link
Contributor Author

arkodg commented Feb 4, 2025

@arkodg arkodg closed this as completed Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/http area/sds SDS related enhancement Feature requests. Not bugs or questions.
Projects
None yet
Development

No branches or pull requests

4 participants