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(scanners): Add support to all existing scanners for containers #696

Merged
merged 4 commits into from
Sep 21, 2023

Conversation

Tehsmash
Copy link
Contributor

@Tehsmash Tehsmash commented Sep 15, 2023

Description

This commit adds support to all existing scanners for all families for
the image, docker-archive, oci-archive, and oci-directory input types.

In the scenario where a scanner does not support containers natively a
new library containerrootfs has been added which converts the container
into a rootfs folder.

The containerrootfs library supports a cached mode which indentifies
containers based on the source and cache the result so that multiple
scanners (even concurrent ones) attempting to convert the same container
to a rootfs only perform it once. All these cached folders are cleaned
up by a function called once all the families have completed.

Type of Change

[ ] Bug Fix
[X] New Feature
[ ] Breaking Change
[ ] Refactor
[ ] Documentation
[ ] Other (please describe)

Checklist

  • I have read the contributing guidelines
  • Existing issues have been referenced (where applicable)
  • I have verified this change is not present in other open pull requests
  • Functionality is documented
  • All code style checks pass
  • New code contribution is covered by automated tests
  • All new and existing tests pass

@Tehsmash Tehsmash requested a review from a team as a code owner September 15, 2023 14:55
go.mod Outdated Show resolved Hide resolved
pkg/shared/families/malware/clam/clam.go Outdated Show resolved Hide resolved
pkg/shared/families/malware/clam/clam.go Outdated Show resolved Hide resolved
pkg/shared/families/malware/config.go Outdated Show resolved Hide resolved
pkg/shared/families/rootkits/chkrootkit/chkrootkit.go Outdated Show resolved Hide resolved
pkg/shared/utils/containerRootfs/fs.go Outdated Show resolved Hide resolved
pkg/shared/utils/containerRootfs/fs.go Outdated Show resolved Hide resolved
pkg/shared/utils/containerRootfs/fs.go Outdated Show resolved Hide resolved
pkg/shared/utils/containerRootfs/fs.go Outdated Show resolved Hide resolved
pkg/shared/utils/containerRootfs/fs.go Outdated Show resolved Hide resolved
@Tehsmash Tehsmash force-pushed the container_tar_scanning branch 2 times, most recently from c89713f to bfb66cf Compare September 19, 2023 14:14
@Tehsmash
Copy link
Contributor Author

Tehsmash commented Sep 19, 2023

@FrimIdan I had to squash because I changed the containerRootfs directory from camel case to all lower case because of the linter and apparently OSX directories are not case sensitive so git thought it already existed and didn't do the rename so when applying the commits for a rebase it broke things.

pkg/shared/utils/containerrootfs/totempdirectory.go Outdated Show resolved Hide resolved
pkg/shared/utils/containerrootfs/totempdirectory.go Outdated Show resolved Hide resolved
pkg/shared/utils/containerrootfs/totempdirectory.go Outdated Show resolved Hide resolved
pkg/shared/utils/containerrootfs/todirectory.go Outdated Show resolved Hide resolved
pkg/shared/utils/containerRootfs/fs.go Outdated Show resolved Hide resolved
This commit adds support to all existing scanners for all families for
the image, docker-archive, oci-archive, and oci-directory input types.

In the scenario where a scanner does not support containers natively a
new library containerrootfs has been added which converts the container
into a rootfs folder.

The containerrootfs library supports a cached mode which indentifies
containers based on the source and cache the result so that multiple
scanners (even concurrent ones) attempting to convert the same container
to a rootfs only perform it once. All these cached folders are cleaned
up by a function called once all the families have completed.
@Tehsmash Tehsmash added this pull request to the merge queue Sep 21, 2023
Merged via the queue into main with commit bbe1d7a Sep 21, 2023
16 checks passed
@Tehsmash Tehsmash deleted the container_tar_scanning branch September 21, 2023 12:27
@chrisgacsal chrisgacsal mentioned this pull request Nov 6, 2023
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

4 participants