-
Notifications
You must be signed in to change notification settings - Fork 303
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
Implement security policy validator for real #393
Implement security policy validator for real #393
Conversation
pkg/fuzz/features/security_policy.go
Outdated
case "deny(502)": | ||
expectedCode = 502 | ||
default: | ||
return fuzz.CheckResponseContinue, fmt.Errorf("unregonized rule %q", policy.Rules[0].Action) |
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.
Nit: "unrecognized"
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.
Thanks, fixed.
@@ -112,7 +112,10 @@ func ServiceMapFromIngress(ing *v1beta1.Ingress) ServiceMap { | |||
for _, path := range rule.HTTP.Paths { | |||
hp := HostPath{Host: rule.Host, Path: path.Path} | |||
if _, ok := ret[hp]; !ok { | |||
ret[hp] = &path.Backend | |||
// Copy the value over to a new struct so that we won't be |
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.
What was the purpose for this change?
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.
During the test I found we are saving the same pointer for path.Backend
in this for loop because path is defined in the init statement.
Ref https://golang.org/ref/spec#For_statements: "Variables declared by the init statement are re-used in each iteration."
50dbb92
to
9f87dd1
Compare
/lgtm |
This PR teaches security policy validator to actually check for response's status code.
/assign @rramkumar1 @bowei