Skip to content

aws_request_signing: extend api to allow excluding headers from signing#18998

Merged
mattklein123 merged 3 commits intoenvoyproxy:mainfrom
rexnp:main
Nov 17, 2021
Merged

aws_request_signing: extend api to allow excluding headers from signing#18998
mattklein123 merged 3 commits intoenvoyproxy:mainfrom
rexnp:main

Conversation

@rexnp
Copy link
Copy Markdown
Contributor

@rexnp rexnp commented Nov 12, 2021

Commit Message:
This change extends the AWS Request Signing filter with an optional list of header exclusions (implemented as a list of StringMatchers) named match_excluded_headers. This allows configuring certain headers to not be signed and addresses the issue in #18695.
I also took the opportunity to move the existing hard-coded rules for skipping certain header signings from the signing method itself to the initialization of a signer.

Additional Description: N/A
Risk Level: Low
Testing: Updated unit test cases
Docs Changes: Added description of the new field and updated the example filter configuration with the new field.
Release Notes: Added
Platform Specific Features: N/A
Fixes #18695

@rexnp rexnp requested a review from mattklein123 as a code owner November 12, 2021 21:32
@repokitteh-read-only
Copy link
Copy Markdown

Hi @rexnp, 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: #18998 was opened by rexnp.

see: more, trace.

@repokitteh-read-only
Copy link
Copy Markdown

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

🐱

Caused by: #18998 was opened by rexnp.

see: more, trace.

@mattklein123
Copy link
Copy Markdown
Member

At a high level looks reasonable. Can you check DCO/docs/etc. CI?

/wait

Signed-off-by: Rex Chang <chiyc@amazon.com>

* extends aws request signing filter with header exclusion list

Signed-off-by: Rex Chang <chiyc@amazon.com>

aws_request_signing: extend api to allow header exclusion (#1)

* extends aws request signing filter with header exclusion list

Signed-off-by: Rex Chang <chiyc@amazon.com>

Signed-off-by: Rex Chang <58710378+rexnp@users.noreply.github.com>
Signed-off-by: Rex Chang <58710378+rexnp@users.noreply.github.com>
Copy link
Copy Markdown
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

LGTM with small comments, thanks.

/wait

Comment on lines +101 to +104
const std::vector<std::string> default_excluded_headers_ = {
Http::Headers::get().ForwardedFor.get(), Http::Headers::get().ForwardedProto.get(),
"x-amzn-trace-id"};
std::vector<Matchers::StringMatcherPtr> excluded_header_matchers_ = defaultMatchers();
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.

I see these defaults are pre-existing, but are they documented anywhere? Perhaps make it more clear in the API docs what the defaults are if not set?

Copy link
Copy Markdown
Contributor Author

@rexnp rexnp Nov 16, 2021

Choose a reason for hiding this comment

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

Thanks Matt! Yes, I'll list them out in the doc.

service_name, region, std::move(credentials_provider),
context.mainThreadDispatcher().timeSource());
context.mainThreadDispatcher().timeSource(),
Extensions::Common::Aws::AwsSigV4HeaderExclusionVector{});
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.

Should there be a TODO here for allow configuration of this? Wouldn't the same problem exist for this filter?

Copy link
Copy Markdown
Contributor Author

@rexnp rexnp Nov 16, 2021

Choose a reason for hiding this comment

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

Yes, I think we'd eventually want the same changes for the lambda and grpc iam filters. I'll add a TODO.

const std::string yaml = R"EOF(
service_name: s3
region: us-west-2
match_excluded_headers:
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.

Can you actually test this populates the config correctly?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

Signed-off-by: Rex Chang <58710378+rexnp@users.noreply.github.com>
Copy link
Copy Markdown
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

Thanks!

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

2 participants