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

external authorization: set the SNI value from server name if it isn't available on the connection/socket #34100

Merged
merged 22 commits into from
May 15, 2024

Conversation

marc-barry
Copy link
Contributor

@marc-barry marc-barry commented May 12, 2024

This is my first commit to the Envoy project and I haven't written C++ in many years. I'm still navigating the types and hierarchy and best practices for obtaining the data I need to complete this pull request. I have started in draft first to see the CI processes and look at how the tests run and if my changes cause any issues with current tests.

Commit Message: external authorization: set the SNI value from server name if it isn't available on the connection/socket
Additional Description: Leverages the TLS inspectors server name value, if one was set.
Risk Level: low
Testing: Will test that the SNI value is set from the server name of a connection when the TLS session doesn't have the SNI.
Docs Changes: N/A
Release Notes: exterbal authorization
Platform Specific Features: N/A
[Optional Runtime guard:]
Fixes #34002
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional API Considerations:]

Copy link

Hi @marc-barry, 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: #34100 was opened by marc-barry.

see: more, trace.

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: #34100 was opened by marc-barry.

see: more, trace.

@marc-barry marc-barry marked this pull request as ready for review May 13, 2024 19:25
@marc-barry
Copy link
Contributor Author

I'm unable to determine which of the unit tests in envoy/test/extensions/filters/common/ext_authz/check_request_utils_test.cc is failing. I know that is the location that CI reports to me but I don't know the Envoy CI system well enough to know how to determine which tests is the issue.

@fredyw
Copy link
Member

fredyw commented May 13, 2024

I'm unable to determine which of the unit tests in envoy/test/extensions/filters/common/ext_authz/check_request_utils_test.cc is failing. I know that is the location that CI reports to me but I don't know the Envoy CI system well enough to know how to determine which tests is the issue.

A passing by comment:

In the envoy-presubmit Azure Pipelines, click on View more details on Azure Pipelines at the bottom. That'll bring you to the Azure Devops Pipelines and simply click on the error.

This is the actual error: https://dev.azure.com/cncf/envoy/_build/results?buildId=170326&view=logs&j=8c169225-0ae8-53bd-947f-07cb81846cb5&t=d1a98671-b7ba-5fbf-f06c-ff337c010df4&l=249

@ggreenway ggreenway self-assigned this May 13, 2024
Copy link
Contributor

@ggreenway ggreenway left a comment

Choose a reason for hiding this comment

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

Thanks for working on this!

Please add a test case for this new logic, and you'll need to add a release note.

/wait

Copy link
Contributor

@ggreenway ggreenway left a comment

Choose a reason for hiding this comment

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

Please add some test coverage for the new functionality.

/wait

@marc-barry
Copy link
Contributor Author

I'm working on tests now. Both for the new functionality and addressing the tests that this new functionality is causing to fail.

@marc-barry
Copy link
Contributor Author

@ggreenway I addressed all you comments. I added a new unit test for TCP and then adapted callHttpCheckAndValidateRequestAttributes, which is called by the HTTP tests, to conditionally perform a check using the correct source of the SNI value for comparison. I also adapted the existing CheckAttrContextPeerTLSSession test to have some additional checks that certain functions are called a certain number of times, such as requestedServerName().

Copy link
Contributor

@ggreenway ggreenway left a comment

Choose a reason for hiding this comment

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

Looks good!

Please add a release note to changelogs/current.yaml.

/wait

…lable on the connection/socket.

Signed-off-by: Marc Barry <4965634+marc-barry@users.noreply.github.com>
Signed-off-by: Marc Barry <4965634+marc-barry@users.noreply.github.com>
Signed-off-by: Marc Barry <4965634+marc-barry@users.noreply.github.com>
Signed-off-by: Marc Barry <4965634+marc-barry@users.noreply.github.com>
…ce and clang-format.

Signed-off-by: Marc Barry <4965634+marc-barry@users.noreply.github.com>
Signed-off-by: Marc Barry <4965634+marc-barry@users.noreply.github.com>
…quiring one less call to connection() and ssl().

Signed-off-by: Marc Barry <4965634+marc-barry@users.noreply.github.com>
…e TLS session SNI isn't set.

Signed-off-by: Marc Barry <4965634+marc-barry@users.noreply.github.com>
Signed-off-by: Marc Barry <4965634+marc-barry@users.noreply.github.com>
Signed-off-by: Marc Barry <4965634+marc-barry@users.noreply.github.com>
Signed-off-by: Marc Barry <4965634+marc-barry@users.noreply.github.com>
Signed-off-by: Marc Barry <4965634+marc-barry@users.noreply.github.com>
Signed-off-by: Marc Barry <4965634+marc-barry@users.noreply.github.com>
…erver name.

Signed-off-by: Marc Barry <4965634+marc-barry@users.noreply.github.com>
Signed-off-by: Marc Barry <4965634+marc-barry@users.noreply.github.com>
Signed-off-by: Marc Barry <4965634+marc-barry@users.noreply.github.com>
Signed-off-by: Marc Barry <4965634+marc-barry@users.noreply.github.com>
Signed-off-by: Marc Barry <4965634+marc-barry@users.noreply.github.com>
… when the sessions SNI is empty.

Signed-off-by: Marc Barry <4965634+marc-barry@users.noreply.github.com>
Signed-off-by: Marc Barry <4965634+marc-barry@users.noreply.github.com>
Signed-off-by: Marc Barry <4965634+marc-barry@users.noreply.github.com>
Signed-off-by: Marc Barry <4965634+marc-barry@users.noreply.github.com>
@ggreenway ggreenway enabled auto-merge (squash) May 15, 2024 15:59
@marc-barry
Copy link
Contributor Author

@ggreenway is there anything I need to do for that failing check? It does look to me that it might be CI flakiness but perhaps there is an underlying issue that needs my attention.

@ggreenway
Copy link
Contributor

That's a weird error; pretty sure you didn't cause it. I'm re-running the failing job to see if it passes.

@ggreenway ggreenway merged commit 190f9e0 into envoyproxy:main May 15, 2024
51 of 52 checks passed
@marc-barry marc-barry deleted the marc-barry/set-sni branch May 16, 2024 10:53
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.

Issues accessing the SNI (server name) from the TLS inspector within External Authorization CheckRequest
3 participants