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

refactor(deps): Merge trivy-iac into Trivy #6005

Merged
merged 18 commits into from Feb 12, 2024
Merged

refactor(deps): Merge trivy-iac into Trivy #6005

merged 18 commits into from Feb 12, 2024

Conversation

simar7
Copy link
Member

@simar7 simar7 commented Jan 25, 2024

Description

Merges current state of trivy-iac into Trivy.

Related issues

Required PRs to be reviewed before

Checklist

  • I've read the guidelines for contributing to this repository.
  • I've followed the conventions in the PR title.
  • I've added tests that prove my fix is effective or that my feature works.
  • I've updated the documentation with the relevant information (if needed).
  • I've added usage information (if the PR introduces new options)
  • I've included a "before" and "after" example to the description (if the PR is a user interface change).

@simar7
Copy link
Member Author

simar7 commented Jan 26, 2024

Note: I've left out avd_docs and cmd/avd_generator from this PR. They still remain in trivy-iac repo. Should we move them here or elsewhere? What about avd-generator repo, as per this PR? aquasecurity/avd-generator#79

@simar7 simar7 requested a review from nikpivkin January 26, 2024 05:59
@simar7 simar7 self-assigned this Jan 26, 2024
@simar7 simar7 marked this pull request as ready for review January 27, 2024 02:29
@simar7 simar7 requested a review from knqyf263 as a code owner January 27, 2024 02:29
@simar7
Copy link
Member Author

simar7 commented Jan 27, 2024

@knqyf263 and @nikpivkin I understand that this PR is quite big so please take your time to review.

Besides the new files being added, most of the changes are actually using the new files (rather than the trivy-iac package).

Please let me know if I can do anything to help you review this PR. I've also broken the merge of misconfig scanning into this PR and the defsec changes, in this PR.

Copy link
Collaborator

@knqyf263 knqyf263 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make a new directory iac under pkg and put detection, scanners and adapters there? We should be going to reorganize the structure in the future, but a dedicated directory helps us set the owners for now.

extrafs can be located under pkg directly as it is like a common utility.

@simar7
Copy link
Member Author

simar7 commented Jan 30, 2024

Can we make a new directory iac under pkg and put detection, scanners and adapters there? We should be going to reorganize the structure in the future, but a dedicated directory helps us set the owners for now.

extrafs can be located under pkg directly as it is like a common utility.

Thanks that's a great point about code owners. I've updated it.

Copy link
Collaborator

@knqyf263 knqyf263 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are many tests about checks, like test/testdata/dockerfile/DS001. Since logic and checks are separated, I feel like Trivy should not have the tests for checks. What do you think?

@simar7
Copy link
Member Author

simar7 commented Feb 6, 2024

There are many tests about checks, like test/testdata/dockerfile/DS001. Since logic and checks are separated, I feel like Trivy should not have the tests for checks. What do you think?

Yeah that's a valid point. They should be moved. I've moved them into the checks repo: aquasecurity/trivy-checks#70

Copy link
Collaborator

@knqyf263 knqyf263 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are several files under test/. Are they integration tests? It looks unit tests to me.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it a unit test? If so, the file should be next to the relevant Go file.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah they really are just terraform functional tests. I've relocated them under the terraform directory. Also deleted another test which was not relevant rules_test.go.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I guess those tests were added for tfsec. When creating defsec, they were just copied from tfsec.

test/testutil/util.go Outdated Show resolved Hide resolved
@knqyf263 knqyf263 added this pull request to the merge queue Feb 12, 2024
Merged via the queue into main with commit 7bd3b63 Feb 12, 2024
12 checks passed
@knqyf263 knqyf263 deleted the merge-trivy-iac-3 branch February 12, 2024 11:20
@knqyf263
Copy link
Collaborator

@simar7 I've already merged the PR, but I'm curious why we still have a defsec dependency.

trivy/go.mod

Line 16 in 4b4b625

github.com/aquasecurity/defsec v0.94.2-0.20240119001230-c2d65f49dfeb

I thought defsec was split into trivy-iac and trivy-policies.

@simar7
Copy link
Member Author

simar7 commented Feb 12, 2024

@simar7 I've already merged the PR, but I'm curious why we still have a defsec dependency.

trivy/go.mod

Line 16 in 4b4b625

github.com/aquasecurity/defsec v0.94.2-0.20240119001230-c2d65f49dfeb

I thought defsec was split into trivy-iac and trivy-policies.

Yes because last time the merge was too big to review so we split it up. The second PR is here that merges remaining pieces from defsec into Trivy. It was stacked on top of this PR but since this merged first, I will recreate it and ask for a review.

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.

refactor(misconf): Merging trivy-iac into Trivy
3 participants