-
Notifications
You must be signed in to change notification settings - Fork 392
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: validate SecurityPolicy on controller and egctl translate
#4987
fix: validate SecurityPolicy on controller and egctl translate
#4987
Conversation
Signed-off-by: Kensei Nakada <handbomusic@gmail.com>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4987 +/- ##
========================================
Coverage 66.71% 66.72%
========================================
Files 209 209
Lines 32052 32379 +327
========================================
+ Hits 21384 21605 +221
- Misses 9388 9468 +80
- Partials 1280 1306 +26 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Kensei Nakada <handbomusic@gmail.com>
332b28e
to
0e44d82
Compare
Signed-off-by: Kensei Nakada <handbomusic@gmail.com>
internal/cmd/egctl/testdata/translate/out/invalid-securitypolicy.all.yaml
Outdated
Show resolved
Hide resolved
Signed-off-by: Kensei Nakada <handbomusic@gmail.com>
Signed-off-by: Kensei Nakada <handbomusic@gmail.com>
551e107
to
25eeb94
Compare
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.
LGTM thanks !
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.
LGTM.
IMO, the validation should be removed from the api package and moved into the gateway API translation package. This can be addressed in a follow-up PR.
Another question around the validation is that, shouldn't we do it with a validation webhook instead of at the reconciliation? |
Signed-off-by: Kensei Nakada <handbomusic@gmail.com>
Signed-off-by: Kensei Nakada <handbomusic@gmail.com>
1cbda49
to
d5901e5
Compare
@@ -53,10 +64,6 @@ func validateSecurityPolicySpec(spec *egv1a1.SecurityPolicySpec) error { | |||
return utilerrors.NewAggregate(errs) | |||
} | |||
|
|||
if err := ValidateJWTProvider(spec.JWT.Providers); err != nil { |
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.
Yet another bug: It panics if spec.JWT is nil.
@arkodg @zhaohuabing Sorry I had missed the test was failing. |
7302818
to
c54e177
Compare
Signed-off-by: Kensei Nakada <handbomusic@gmail.com>
c54e177
to
faa9e21
Compare
I guess another reason probably is that Webhook can not be used for the host deployment mode. @arkodg should have more context on this. |
The PR looks good! But it confuses me that why we have this SecurityPolicy validations here ? I can understand the existence of EnvoyGateway validations, and EnvoyProxy validations (which can be removed once the CEL expression is stable). |
So, what would you propose instead? |
outlining the steps EG performs - Receives Input (1) and Translates it (2) |
What type of PR is this?
What this PR does / why we need it:
ValidateSecurityPolicy
exists, but isn't called like other validation functions (ValidateEnvoyProxy etc).SecurityPolicy
s without CORS or JWT are considered invalid and failed at the validation.Which issue(s) this PR fixes:
Fixes #
Release Notes: No