-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Fix the bug that validate
flag is not set when the SAN(SubjectAltName) matching is performed
#16816
Conversation
…ubjectAltName) matching succeeds Signed-off-by: Tianyu Xia <tyxia@google.com>
When SAN(SubjectAltName) matching with the provided matchers is the only verification performed and the matching succeeds, the `validated` flag is not updated properly(left as `NotValidated`) and the function return wrong statuscode. Signed-off-by: Tianyu Xia <tyxia@google.com>
When SAN(SubjectAltName) matching with the provided matchers is the only verification performed and the matching succeeds, the `validated` flag is not updated properly(left as `NotValidated`) and the function return wrong statuscode. Signed-off-by: Tianyu Xia <tyxia@google.com>
Hi @tyxia, 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. |
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.
Thank you for fix it! Could you please add a test case for it?
Signed-off-by: Tianyu Xia <tyxia@google.com>
Thank you for the review! I think it is because:
So, the validate flag in this function I changed only represents that it is not validated for SAN, hash etc but doesn't mean that it is not validated because we could have only trust_ca case and it is validated in the code above. In short, I think the fix is technically correct but doesn't make the difference in practice based on current code. Also, this code path is already tested in many integration tests(not its unit test though). Thus, we may not need a new test case here. Please let me know what do you think. |
Yes, I have no doubt the code is correct. But a unit test could help with making it future-proof and to pinpoint a problem better. We know that in case of For example the function could be simplified even farther if we dropped |
|
Thank you for the inputs! I have some local test code but I have one thing want to discuss first: Without full background info of the code but based on my code reading, I think there is one corner case not being handled right now : I quickly tested one change at line 225 to return
to
And it seems reveal one potential bug in sds_dynamic_integration_test's QUIC path(The only failure caused by change above). TCP path of this test works fine. The quick experimental fix for that could be query the true verify_mode that is initialized in I feel this might not be a critical issue at this moment but it might also doesn't hurt to get to the bottom of it :) |
This sounds reasonable. To me |
Signed-off-by: Tianyu Xia <tyxia@google.com>
Signed-off-by: Tianyu Xia <tyxia@google.com>
Signed-off-by: Tianyu Xia <tyxia@google.com>
Signed-off-by: Tianyu Xia <tyxia@google.com>
Signed-off-by: Tianyu Xia <tyxia@google.com>
Signed-off-by: Tianyu Xia <tyxia@google.com>
Yes, I agreed. I will split those fixes into another PR. The unit test is added. PTAL! |
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.
Thank you! LGTM modulo one more check.
test/extensions/transport_sockets/tls/cert_validator/default_validator_test.cc
Show resolved
Hide resolved
Also, cc @htuch for visibility. |
Signed-off-by: Tianyu Xia <tyxia@google.com>
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.
Thank you! Looks good to me.
@yanavlasov I think it's ready for a second pass.
…bridge-stream * upstream/main: (268 commits) tools: adding dio,better comments (envoyproxy#17104) doc: fix misplaced #[extension-category] for Wasm runtimes (envoyproxy#17078) ci: Speedup deps precheck (envoyproxy#17102) doc: fix wrong link on wasm network filter. (envoyproxy#17079) docs: Added v3 API reference. (envoyproxy#17095) docs: Update include paths in repo (envoyproxy#17098) exception: make Ipv6Instance and Ipv4Instance not throw and remove some try catch pattern (envoyproxy#16122) tools: adding reminders for API shephards (envoyproxy#17081) ci: Fix wasm verify example (envoyproxy#17086) [fuzz]: fix oss fuzz bug 34515, limit maglev table size (envoyproxy#16671) test: silencing flaky test (envoyproxy#17084) Set `validate` flag when the SAN(SubjectAltName) matching is performed (envoyproxy#16816) Listener: reset the file event when destroying listener filters (envoyproxy#16952) docs: link additional filters that emit dynamic metadata (envoyproxy#17059) rds: add config reload time stat for rds (envoyproxy#17033) bazel: Use color by default for build and run commands (envoyproxy#17077) ci: Add timing for docker pull (envoyproxy#17074) [Windows] Adding note section in Original Source HTTP Filter (envoyproxy#17058) quic: add quic version counters in http3 codec stats. (envoyproxy#16943) quiche: change crypto stream factory interfaces (envoyproxy#17046) ... Signed-off-by: Garrett Bourg <bourg@squareup.com>
envoyproxy#16816) When SAN(SubjectAltName) matching with the provided matchers is the only verification performed and the matching succeeds, the `validated` flag is not updated properly(left as `NotValidated`) and the function return wrong statuscode. Signed-off-by: Tianyu Xia <tyxia@google.com> Signed-off-by: chris.xin <xinchuantao@qq.com>
envoyproxy#16816) When SAN(SubjectAltName) matching with the provided matchers is the only verification performed and the matching succeeds, the `validated` flag is not updated properly(left as `NotValidated`) and the function return wrong statuscode. Signed-off-by: Tianyu Xia <tyxia@google.com>
When SAN(SubjectAltName) matching with the provided matchers is the only verification performed and matching succeeds, the
validated
flag is not updated properly(i.e. left asNotValidated
) and the function return wrong status code.Add the unit test:
DefaultValidator
object with NULL certificateValidationContext (i.e no validation context). This ensures that the certificate verification later will be only performed on the SAN matcher arg provided in step#3Risk Level: Low
Testing:
Docs Changes: n/a
Release Notes: n/a
Signed-off-by: Tianyu Xia tyxia@google.com