Skip to content
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: add examples of custom checks #295

Merged
merged 3 commits into from
Nov 30, 2024
Merged

Conversation

nikpivkin
Copy link
Contributor

@nikpivkin nikpivkin commented Nov 26, 2024

Related issues:

This PR includes:

  • examples for almost all kinds of IaC scanners, including the recently added yaml and json.
  • using additional data in checks that are passed through the --config-data flag
  • ignoring built-in checks using Rego
  • using built-in Rego functions that Trivy adds. The example uses sh.parse_commands to parse shell scripts

@nikpivkin nikpivkin force-pushed the exmpls branch 4 times, most recently from 9d804f4 to 76bda8b Compare November 28, 2024 06:14
@nikpivkin
Copy link
Contributor Author

nikpivkin commented Nov 28, 2024

@simar7 In this PR trivy runs as a cli application via a package, which locks us into the version of trivy specified in go.mod. Alternatively, we can run the latest version of trivy via localstack, which will allow us to run tests in parallel and reduce the number of transitive dependencies (but I don't think this is critical). But then we would have to consider whether it would be too expensive to run such tests often. And the third option is to just install trivy via setup-trivy and call trivy directly. WDYT?

@nikpivkin nikpivkin marked this pull request as ready for review November 28, 2024 06:37
@nikpivkin nikpivkin requested a review from simar7 as a code owner November 28, 2024 06:37
@simar7
Copy link
Member

simar7 commented Nov 29, 2024

But then we would have to consider whether it would be too expensive to run such tests often.

Interesting, why are they expensive to run in localstack? I think running them in localstack is actually good as it adds a layer of integration testing for us in trivy-checks to ensure nothing breaks in Trivy when we release a new trivy-checks version. Also we could add other verisons of Trivy here (besides latest) to ensure we test against a set of versions.

@nikpivkin
Copy link
Contributor Author

We will pull the Trivy image every time we run the tests . Or can we cache it? If the cache will not be invalidated, we will constantly pull the same version of Trivy in case of using latest tag.

@simar7
Copy link
Member

simar7 commented Nov 29, 2024

Let's merge this in for now as it's better than nothing and improve it in further iterations. I think for this PR this work is sufficient for now.

@simar7 simar7 added this pull request to the merge queue Nov 30, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to a conflict with the base branch Nov 30, 2024
@simar7 simar7 added this pull request to the merge queue Nov 30, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to a conflict with the base branch Nov 30, 2024
@simar7 simar7 merged commit ebd9a00 into aquasecurity:main Nov 30, 2024
5 checks passed
@nikpivkin nikpivkin deleted the exmpls branch November 30, 2024 04:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants