-
Notifications
You must be signed in to change notification settings - Fork 16
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
[Infra] test data generator #6
Conversation
General repo struct refactor
│ ├── rules/cis | ||
│ │ ├── cis_1_1_1 # rule package | ||
│ ├── cis_k8s/rules | ||
│ | ├── cis_k8s.rego # Handles all Kubernetes CIS rules evalutations |
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.
move it outside the rules
test_pass { | ||
test.rule_pass(finding) with input as rule_input("0644") | ||
} | ||
|
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.
add test when it shouldn't be evaluated - meaning filename is different than kube-apiserver.yaml
import data.lib.test | ||
|
||
test_violation { | ||
test.rule_violation(finding) with input as rule_input("0700") |
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.
refactor test.assert_violation
and test.assert_passed
test.rule_violation(finding) with input as rule_input("0700") | ||
} | ||
|
||
test_pass { |
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.
Add another test for more restrictive file mode (instead of the exact value) to the common.rego
with common_test.rego
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 would like to add for testing assertion that we have minimal schema validations
compliance/cis_k8s/test_data.rego
Outdated
# test data generater | ||
filesystem_input(filename, mode, uid, gid) = { | ||
"type": "filesystem", | ||
"path": "file/path", |
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.
add the filename into the end of the example path
elastic#6 ---NOTE--- This is an imported commit, it was initially committed to the csp-security-policies repo which was then merged into cloudbeat. See: elastic/cloudbeat#1405
Add test data generator
General repo struct refactor