-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
feat(misconf): Support custom data for rego policies for cloud #4745
Conversation
Hi Simar, I've removed this PR from the milestone as we usually have only issues in the milestone. |
Signed-off-by: Simar <simar@linux.com>
Signed-off-by: Simar <simar@linux.com>
Signed-off-by: Simar <simar@linux.com>
Signed-off-by: Simar <simar@linux.com>
Signed-off-by: Simar <simar@linux.com>
@@ -969,6 +971,7 @@ func Test_Run(t *testing.T) { | |||
cacheContent string | |||
regoPolicy string | |||
allServices []string | |||
inputData string |
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.
Will we provide an example in the docs on using this?
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.
We already have that here https://aquasecurity.github.io/trivy/v0.43/docs/scanner/misconfiguration/custom/data/
This PR just extends that functionality to be used in Trivy Cloud Scanning.
Need this as OPA is currently broken on Windows open-policy-agent/opa#4521 Signed-off-by: Simar <simar@linux.com>
pkg/cloud/aws/commands/run_test.go
Outdated
regoDir := filepath.Join("testdata", "Test_Run_Dir") | ||
require.NoError(t, os.MkdirAll(regoDir, 0755)) | ||
defer os.RemoveAll(regoDir) |
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'm curious about the benefit of 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.
pkg/commands/artifact/run.go
Outdated
@@ -579,7 +579,7 @@ func initScannerConfig(opts flag.Options, cacheClient cache.Cache) (ScannerConfi | |||
Trace: opts.Trace, | |||
Namespaces: append(opts.PolicyNamespaces, defaultPolicyNamespaces...), | |||
PolicyPaths: append(opts.PolicyPaths, downloadedPolicyPaths...), | |||
DataPaths: opts.DataPaths, | |||
DataPaths: append(opts.DataPaths, downloadedPolicyPaths...), |
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.
Why do we want to pass policy paths as data paths? The policies are loaded as data by mistake, no? I may be missing something.
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.
it was a typo, updated here 18b29d5
…ecurity#4745) * feat(misconf): Support custom data for cloud policies Signed-off-by: Simar <simar@linux.com> * use policyfs Signed-off-by: Simar <simar@linux.com> * refactor to reduce cyclomatic complexity Signed-off-by: Simar <simar@linux.com> * bump defsec * update docs Signed-off-by: Simar <simar@linux.com> * update test assertion Signed-off-by: Simar <simar@linux.com> * update test Need this as OPA is currently broken on Windows open-policy-agent/opa#4521 Signed-off-by: Simar <simar@linux.com> * fix data path * fix(mapfs): convert volume names into dirs * revert creating temp dirs --------- Signed-off-by: Simar <simar@linux.com> Co-authored-by: Teppei Fukuda <knqyf263@gmail.com>
Description
This PR adds support for supplying custom data for rego policies.
Related issues
--config-data
for cloud scanning #4565Checklist