Skip to content

sds: add validation callback for all secret providers#8310

Merged
lizan merged 4 commits intoenvoyproxy:masterfrom
asraa:confignullderefread
Sep 26, 2019
Merged

sds: add validation callback for all secret providers#8310
lizan merged 4 commits intoenvoyproxy:masterfrom
asraa:confignullderefread

Conversation

@asraa
Copy link
Copy Markdown
Contributor

@asraa asraa commented Sep 20, 2019

This adds an implementation of addValidationCallback for all secret providers. This is a no-op, unless the secret provider is a `CertificateValidationContextSdsApi.

Envoy crashes when trying to add a validation callback to CertificateValidationContextProvider due to a bad dynamic cast. When certificate_validation_context_provider_ isn't a CertificateValidationContextSdsApi, we no-op.

Fixes: #7892 and OSS-Fuzz Issues
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=17001
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=16766
Testing: add corpus entry

Signed-off-by: Asra Ali asraa@google.com

Signed-off-by: Asra Ali <asraa@google.com>
…fig provider

Signed-off-by: Asra Ali <asraa@google.com>
@asraa asraa requested a review from lizan as a code owner September 20, 2019 18:04
@asraa
Copy link
Copy Markdown
Contributor Author

asraa commented Sep 20, 2019

@snowp @JimmyCYJ can you take a look and see if this lines up with the SDS intended behavior with respect to the config in the testcase?

Signed-off-by: Asra Ali <asraa@google.com>
snowp
snowp previously approved these changes Sep 24, 2019
Copy link
Copy Markdown
Contributor

@snowp snowp left a comment

Choose a reason for hiding this comment

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

Yeah this makes sense to me, essentially the same solution I had in mind. @lizan mind taking a look as well?

* @return CallbackHandle the handle which can remove that validation callback.
*/
virtual Common::CallbackHandle* addValidationCallback(
std::function<void(const envoy::api::v2::auth::CertificateValidationContext&)> callback) PURE;
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.

Why is it envoy::api::v2::auth::CertificateValidationContext, not SecretType? This SecretProvider only fetches secret of a specified SecretType, it will call the callback the verify if that received secret could be initialized successfully. @lizan

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.

+1 this should be SecretType

Signed-off-by: Asra Ali <asraa@google.com>
@asraa
Copy link
Copy Markdown
Contributor Author

asraa commented Sep 26, 2019

/retest

@repokitteh-read-only
Copy link
Copy Markdown

🤷‍♀️ nothing to rebuild.

🐱

Caused by: a #8310 (comment) was created by @asraa.

see: more, trace.

Copy link
Copy Markdown
Member

@JimmyCYJ JimmyCYJ left a comment

Choose a reason for hiding this comment

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

/lgtm

I am curious, is this file test/server/server_corpus/clusterfuzz-testcase-config_fuzz_test-5729922022113280 auto generated by some tools?

@lizan
Copy link
Copy Markdown
Member

lizan commented Sep 26, 2019

@JimmyCYJ yes it is generated by oss-fuzz

@lizan lizan merged commit e637457 into envoyproxy:master Sep 26, 2019
danzh2010 pushed a commit to danzh2010/envoy that referenced this pull request Oct 4, 2019
This adds an implementation of addValidationCallback for all secret providers. This is a no-op, unless the secret provider is a `CertificateValidationContextSdsApi.

Envoy crashes when trying to add a validation callback to CertificateValidationContextProvider due to a bad dynamic cast. When certificate_validation_context_provider_ isn't a CertificateValidationContextSdsApi, we no-op.

Fixes: envoyproxy#7892 and OSS-Fuzz Issues
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=17001
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=16766
Testing: add corpus entry

Signed-off-by: Asra Ali <asraa@google.com>
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.

Segfault when referencing SDS secrets by name with default validation context

4 participants