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

refactor!: return CertificateVerficationResponse{} in VerifyCert() #74

Merged
merged 1 commit into from
Feb 16, 2024

Conversation

viccuad
Copy link
Member

@viccuad viccuad commented Feb 15, 2024

Description

Relates to kubewarden/cel-policy#15.

pkg/capabilities/VerifyCert() returns a (bool, err). In the case that it returns (false, err), the error is not a runtime error but it may contain the reason for the failed certificate verification.

Return a (CertificateVerficationResponse{},err) instead, which contains the bool trusted and a reason, or a runtime error.

Test

CI.

Additional Information

Tradeoff

Potential improvement

@viccuad viccuad self-assigned this Feb 15, 2024
@viccuad viccuad marked this pull request as ready for review February 15, 2024 13:48
@viccuad viccuad requested a review from a team as a code owner February 15, 2024 13:48
Copy link
Member

@flavio flavio left a comment

Choose a reason for hiding this comment

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

I'm fine doing this change to the API

pkg/capabilities/crypto/crypto.go Outdated Show resolved Hide resolved
pkg/capabilities/crypto/crypto.go Outdated Show resolved Hide resolved
Copy link
Member

@jvanz jvanz left a comment

Choose a reason for hiding this comment

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

I'm fine with the change. Just take a look on Flavio's comments.

Copy link
Contributor

@fabriziosestito fabriziosestito left a comment

Choose a reason for hiding this comment

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

:shipit: once comments are addressed

pkg/capabilities/VerifyCert() returns a `(bool, err)`. In the case that it
returns `(false, err)`, the error is not a runtime error but it
may contain the reason for the failed certificate verification.

Return a ``(CertificateVerficationResponse{},err)` instead, which contains the
bool trusted and a reason, or a runtime error.

Signed-off-by: Víctor Cuadrado Juan <[email protected]>
Copy link
Member

@flavio flavio left a comment

Choose a reason for hiding this comment

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

LGTM

@viccuad viccuad merged commit aef65c4 into kubewarden:main Feb 16, 2024
5 checks passed
@viccuad viccuad deleted the fix-cap branch February 16, 2024 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants