Skip to content

aws_request_signing: Don't sign x-envoy headers - #18729

Closed
wbertelsen wants to merge 1 commit into
envoyproxy:mainfrom
wbertelsen:aws_request_signing.dont-sign-envoy-headers
Closed

wbertelsen wants to merge 1 commit into
envoyproxy:mainfrom
wbertelsen:aws_request_signing.dont-sign-envoy-headers

Conversation

@wbertelsen

Copy link
Copy Markdown

Commit Message:
Envoy often modifies x-envoy headers ie in https://github.com/envoyproxy/envoy/blob/0fae697/source/common/router/retry_state_impl.cc#L35.
This change also makes them non-canonical and excludes them from request signing.

This is an initial fix for #18695

Signed-off-by: Will Bertelsen [email protected]

Additional Description: N/A
Risk Level: Low
Testing: Tested manually against repo case. Also built and deployed it to own infra.
Docs Changes: None
Release Notes: None
Platform Specific Features: None
Fixes: #18695

Envoy often modifies x-envoy headers ie in https://github.com/envoyproxy/envoy/blob/0fae697/source/common/router/retry_state_impl.cc#L35.
This change also makes them non-canonical and excludes them from request signing.

This is an initial fix for envoyproxy#18695

Signed-off-by: Will Bertelsen <[email protected]>
@repokitteh-read-only

Copy link
Copy Markdown

Hi @wbertelsen, welcome and thank you for your contribution.

We will try to review your Pull Request as quickly as possible.

In the meantime, please take a look at the contribution guidelines if you have not done so already.

🐱

Caused by: #18729 was opened by wbertelsen.

see: more, trace.

@rgs1

rgs1 commented Oct 22, 2021

Copy link
Copy Markdown
Member

/assign rgs1

@rgs1 rgs1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

Mind adding a line in docs/root/version_history/current.rst about the change?

@marcomagdy mind taking a look as well?

if (key == Http::Headers::get().ForwardedFor.get() ||
key == Http::Headers::get().ForwardedProto.get() || key == "x-amzn-trace-id") {
key == Http::Headers::get().ForwardedProto.get() || key == "x-amzn-trace-id" ||
absl::StartsWith(key, "x-envoy")) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ThreadSafeSingleton<Http::PrefixValue>::get().prefix() instead of x-envoy

@lavignes

lavignes commented Oct 25, 2021 •

Copy link
Copy Markdown
Contributor

Ideally we should be adding an option to the signing filter API to control what headers (besides the required ones for sigv4: host / x-amz-date) are included in the signature rather than adding hacks to the signer to exclude particular headers.

@rgs1

rgs1 commented Oct 25, 2021

Copy link
Copy Markdown
Member

Ideally we should be adding an option to the signing filter API to control what headers (besides the required ones for sigv4: host / x-amz-date) are included in the signature rather than adding hacks to the signer to exclude particular headers.

Yeah you are right, the current approach is not sustainable.

@wbertelsen: do you mind changing the approach to extending the signer's API to pass excluded headers (or which ones should be included)?

@lavignes should we do excluded headers instead of included though? Sounds easier to maintain/use.

@rgs1 rgs1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let's go down the route suggested by @lavignes.

@lavignes

lavignes commented Oct 25, 2021 •

Copy link
Copy Markdown
Contributor

@rgs1 Id prefer including headers. But excluding headers via a (probably a list of) StringMatcher would also work pretty well.

@wbertelsen

Copy link
Copy Markdown
Author

I agree making this configurable is the right thing long term, but making that fix is outside the scope of what I'm going to be able to reliably contribute. I'll close this PR and leave the issue up.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AWS Request Signing Filter breaks for internal requests if x-envoy-retry-on is set

3 participants