-
Notifications
You must be signed in to change notification settings - Fork 176
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 bug in acl config validation #982
Changes from 1 commit
76220b7
770d364
52fa51f
05feb4c
8934690
a2db2d7
5008e38
e204f2d
c7bec9a
f56829d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -199,10 +199,24 @@ impl PolicyEnforcer { | |
) -> ZResult<PolicyInformation> { | ||
let mut policy_rules: Vec<PolicyRule> = Vec::new(); | ||
for config_rule in config_rule_set { | ||
// config validation | ||
if config_rule.interfaces.is_empty() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems that with this PR the interface list becomes always required, am I correct? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for 0.11 it should be required in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why? I could simply want to deny There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For that we will require explicit keywords like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think that we need some special keyword for all, IMHO, if filter filed absent it means that filter not applied for this field. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree for interfaces and flows. |
||
|| config_rule.actions.is_empty() | ||
|| config_rule.flows.is_empty() | ||
|| config_rule.key_exprs.is_empty() | ||
{ | ||
bail!("error from bad config"); | ||
Mallets marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
oteffahi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
for subject in &config_rule.interfaces { | ||
if subject.trim().is_empty() { | ||
bail!("error from bad interface value"); | ||
Mallets marked this conversation as resolved.
Show resolved
Hide resolved
Mallets marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
for flow in &config_rule.flows { | ||
for action in &config_rule.actions { | ||
for key_expr in &config_rule.key_exprs { | ||
if key_expr.trim().is_empty() { | ||
bail!("error from bad key-expression value"); | ||
Mallets marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
policy_rules.push(PolicyRule { | ||
subject: Subject::Interface(subject.clone()), | ||
key_expr: key_expr.clone(), | ||
|
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.
Since a security feature that the user wished to enable did not go through correctly, in my opinion it seems dangerous to proceed. Shouldn't we stop execution?
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.
I think the upper logic should decide what to do with the execution. The interceptor has the freedom to return an error here and it should do so. I wouldn't panic directly at this level.