tfsec icon indicating copy to clipboard operation
tfsec copied to clipboard

question: Where is the code for OPA data.lib.result package

Open xNok opened this issue 3 years ago • 5 comments

I am looking at writing custom policies using Rego. However I am trying to test my policies with the opa cli

opa test . -v --explain=full

However, this library mentioned in the example is not included in my policy folder the opa complains about not knowing where to find it.

I was wondering where that file was so I could import it for test purposes.

xNok avatar Aug 17 '22 10:08 xNok

Hi @xNok - you can find it here: https://github.com/aquasecurity/defsec/blob/master/internal/rules/defsec/lib/defsec.rego

It may be worth cloning the defsec repo and pulling in the rego contents of internal/rules

liamg avatar Aug 17 '22 11:08 liamg

Thanks for the quick answer

I am not sure why you suggest cloning the entire repository. I was thinking of duplicating the result function and using tfsec --rego-policy-dir.

While I am here do you know if there is a way to include custom police in the vscode extension? It doesn't seem to be an option, maybe I should open a feature request?

xNok avatar Aug 17 '22 11:08 xNok

To be honest I couldn't remember off the top of my head if there were other required library files.

You shouldn't need the result function to run it with tfsec, as tfsec has the result (and other rego files) baked into it.

liamg avatar Aug 17 '22 12:08 liamg

As for the vscode extension, I don't think there is atm - @owenrumney can possibly confirm?

liamg avatar Aug 17 '22 12:08 liamg

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Sep 16 '22 15:09 github-actions[bot]