-
Notifications
You must be signed in to change notification settings - Fork 5.3k
TLS: Allow specification of both typed and non-typed san matchers in config #20529
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
Changes from all commits
85a2cea
edbe61f
c3300cc
326ad25
9ef7193
da2b461
a47153f
d32ac1f
1e5c762
508fc0c
c1177fe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,6 +10,8 @@ | |
| #include "source/common/common/logger.h" | ||
| #include "source/common/config/datasource.h" | ||
|
|
||
| #include "spdlog/spdlog.h" | ||
|
|
||
| namespace Envoy { | ||
| namespace Ssl { | ||
|
|
||
|
|
@@ -59,14 +61,21 @@ CertificateValidationContextConfigImpl::CertificateValidationContextConfigImpl( | |
| std::vector<envoy::extensions::transport_sockets::tls::v3::SubjectAltNameMatcher> | ||
| CertificateValidationContextConfigImpl::getSubjectAltNameMatchers( | ||
| const envoy::extensions::transport_sockets::tls::v3::CertificateValidationContext& config) { | ||
| if (!config.match_typed_subject_alt_names().empty() && | ||
| !config.match_subject_alt_names().empty()) { | ||
| throw EnvoyException("SAN-based verification using both match_typed_subject_alt_names and " | ||
| "the deprecated match_subject_alt_names is not allowed"); | ||
| } | ||
| std::vector<envoy::extensions::transport_sockets::tls::v3::SubjectAltNameMatcher> | ||
| subject_alt_name_matchers(config.match_typed_subject_alt_names().begin(), | ||
| config.match_typed_subject_alt_names().end()); | ||
| // If typed subject alt name matchers are provided in the config, don't check | ||
| // for the deprecated non-typed field. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is minor behavior change we should add to release note I think?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. Could you please take a look? |
||
| if (!subject_alt_name_matchers.empty()) { | ||
| // Warn that we're ignoring the deprecated san matcher field, if both are | ||
| // specified. | ||
| if (!config.match_subject_alt_names().empty()) { | ||
| ENVOY_LOG_MISC(warn, | ||
| "Ignoring match_subject_alt_names as match_typed_subject_alt_names is also " | ||
| "specified, and the former is deprecated."); | ||
| } | ||
| return subject_alt_name_matchers; | ||
| } | ||
| // Handle deprecated string type san matchers without san type specified, by | ||
| // creating a matcher for each supported type. | ||
| for (const envoy::type::matcher::v3::StringMatcher& matcher : config.match_subject_alt_names()) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we keep a warning message for the user? since we ignore this quietly, the user won't know the
match_subject_alt_nameswas ignored.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.