-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
* build: Add bundle inspection
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: test rego bundle | ||
on: | ||
pull_request: | ||
env: | ||
GO_VERSION: "1.18" | ||
jobs: | ||
opa-tests: | ||
name: OPA tests | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Build bundle | ||
run: make bundle | ||
- name: Setup OPA | ||
run: | | ||
curl -L -o opa_linux_amd64 https://openpolicyagent.org/downloads/latest/opa_linux_amd64 | ||
curl -L -o checksum https://openpolicyagent.org/downloads/latest/opa_linux_amd64.sha256 | ||
sha256sum -c checksum | ||
chmod 755 ./opa_linux_amd64 | ||
sudo mv ./opa_linux_amd64 /usr/local/bin/opa | ||
- name: Check bundle | ||
run: opa inspect bundle.tar.gz |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"revision" : "[GITHUB_SHA]", | ||
"roots": ["policies"] | ||
"roots": [""] | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
liamg
Author
Contributor
|
||
} |
So while this is a correct change, it has exposed a new challenge with downloading policies. It's a little convoluted so bear with me:
opa inspect
rightly throws an error:Notice the issues are only in
kubernetes/lib/kubernetes
dirs, which are the libraries.AFAIK, there's a flag to disable embedded policies, https://github.com/aquasecurity/trivy/blob/5f0bf1445aad6e8107a9f3977ba7e1969c09724a/pkg/fanal/analyzer/config/config.go#L13 – but this still lets embedded libraries to be loaded.
I can see two ways:
My thoughts:
For point 2. since the embedded policies are loaded via an init() https://github.com/aquasecurity/defsec/blob/master/pkg/rego/embed.go#L19-L27 – how can we completely stop embedding policies and libraries altogether when using defsec?
Any other thoughts? I'm open to ideas.
We can discuss this over a call (8AM pacific, oct 14 if you prefer).