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

docs(design): Scan Container Images with Trivy Filesystem Scanne #830

Merged
merged 2 commits into from
Jan 11, 2022

Conversation

deven0t
Copy link
Collaborator

@deven0t deven0t commented Nov 26, 2021

resolves: #818

@deven0t deven0t requested a review from danielpacak November 26, 2021 10:29
@danielpacak danielpacak added this to the Release v0.14.0 milestone Nov 26, 2021
@danielpacak danielpacak added the 🎨 design More about design and architecture than writing Go code label Nov 26, 2021
@deven0t deven0t force-pushed the deven-trivy-fs-scan-design branch from b79a6dd to 613014f Compare December 23, 2021 07:12
deven0t added a commit to deven0t/starboard that referenced this pull request Dec 23, 2021
``trivy.command: fs`` will change the trivy scan option to pick up vulnerability scans
using trivy fs scan command

This is the implementation of first approach suggested here aquasecurity#830
deven0t added a commit to deven0t/starboard that referenced this pull request Dec 23, 2021
``trivy.command: fs`` will change the trivy scan option to pick up vulnerability scans
using trivy fs scan command

This is the implementation of first approach suggested here aquasecurity#830
@deven0t deven0t force-pushed the deven-trivy-fs-scan-design branch from 613014f to b1326c6 Compare January 4, 2022 11:19
deven0t added a commit to deven0t/starboard that referenced this pull request Jan 4, 2022
``trivy.command: fs`` will change the trivy scan option to pick up vulnerability scans
using trivy fs scan command

This is the implementation of first approach suggested here aquasecurity#830
deven0t added a commit to deven0t/starboard that referenced this pull request Jan 5, 2022
``trivy.command: fs`` will change the trivy scan option to pick up vulnerability scans
using trivy fs scan command

This is the implementation of first approach suggested here aquasecurity#830
deven0t added a commit to deven0t/starboard that referenced this pull request Jan 6, 2022
``trivy.command: fs`` will change the trivy scan option to pick up vulnerability scans
using trivy fs scan command

This is the implementation of first approach suggested here aquasecurity#830
Copy link
Contributor

@danielpacak danielpacak left a comment

Choose a reason for hiding this comment

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

Hey @deven0t Overall LGTM. I left a few comments to clarify the proposal.

docs/design/design_trivy_file_system_scanner.md Outdated Show resolved Hide resolved
docs/design/design_trivy_file_system_scanner.md Outdated Show resolved Hide resolved
docs/design/design_trivy_file_system_scanner.md Outdated Show resolved Hide resolved
With this approach we have following problem:
1. When image pulled from private registry without ImagePullSecret or service account
(https://kubernetes.io/docs/concepts/containers/images/#configuring-nodes-to-authenticate-to-a-private-registry)
2. When image pulled from managed registry of managed cluster
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be nice to clarify that in this case typically a service account or cluster node is authorized to pull images from registries and users are not supposed to create imagePullSecrets.

docs/design/design_trivy_file_system_scanner.md Outdated Show resolved Hide resolved
docs/design/design_trivy_file_system_scanner.md Outdated Show resolved Hide resolved
docs/design/design_trivy_file_system_scanner.md Outdated Show resolved Hide resolved
docs/design/design_trivy_file_system_scanner.md Outdated Show resolved Hide resolved
docs/design/design_trivy_file_system_scanner.md Outdated Show resolved Hide resolved
@deven0t deven0t force-pushed the deven-trivy-fs-scan-design branch from b1326c6 to ce04af3 Compare January 7, 2022 11:08
@deven0t deven0t requested a review from danielpacak January 11, 2022 03:10
@danielpacak danielpacak force-pushed the deven-trivy-fs-scan-design branch 2 times, most recently from 425a646 to 8f5e702 Compare January 11, 2022 16:42
Signed-off-by: Daniel Pacak <pacak.daniel@gmail.com>
@danielpacak danielpacak force-pushed the deven-trivy-fs-scan-design branch from 8f5e702 to 3687cb5 Compare January 11, 2022 16:46
@danielpacak danielpacak changed the title Docs(design): Vulnerability scanning using Trivy file system scanner docs(design): Scan Container Images with Trivy Filesystem Scanne Jan 11, 2022
Copy link
Contributor

@danielpacak danielpacak left a comment

Choose a reason for hiding this comment

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

Great work @deven0t I just pushed a few edits to your branch to cleanup duplicates and some of the implementations details.

@danielpacak danielpacak merged commit 922ec04 into aquasecurity:main Jan 11, 2022
To scan a container image of a given K8s workload Starboard will create a corresponding container of a scan Job and
override its entrypoint to invoke Trivy filesystem scanner.

This approach requires Trivy executable to be downloaded and made available to the entrypoint. We'll do that by adding

Choose a reason for hiding this comment

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

This could maybe be done with a csi driver as well.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure that I understood this comment. Could you elaborate on how we can use csi driver in this case?

Choose a reason for hiding this comment

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

just thinking, instead of copying the file from an init container to an emtpydir, a csi driver in ephemeral mode could mount the file into the container.

Copy link

@kfox1111 kfox1111 Jan 12, 2022

Choose a reason for hiding this comment

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

May not be worth the effort. but could be like:

kind: Pod
apiVersion: v1
metadata:
  name: my-csi-app-inline-volume
spec:
  containers:
    - name: my-frontend
      image: busybox
      command: [ "sleep", "100000" ]
      volumeMounts:
      - mountPath: "/trivy"
        name: my-csi-volume
  volumes:
  - name: my-csi-volume
    csi:
      driver: trivy

the init container to the scan Job. Such init container will use the Trivy container image to copy Trivy executable out
to the emptyDir volume, which will be shared with the other containers.

Another init container is required to download Trivy vulnerability database and save it to the mounted shared volume.

Choose a reason for hiding this comment

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

Same.

deven0t added a commit to deven0t/starboard that referenced this pull request Jan 17, 2022
``trivy.command: fs`` will change the trivy scan option to pick up vulnerability scans
using trivy fs scan command

This is the implementation of approach suggested here aquasecurity#830
deven0t added a commit to deven0t/starboard that referenced this pull request Jan 17, 2022
``trivy.command: fs`` will change the trivy scan option to pick up vulnerability scans
using trivy fs scan command

This is the implementation of approach suggested here aquasecurity#830
deven0t added a commit to deven0t/starboard that referenced this pull request Jan 17, 2022
``trivy.command: fs`` will change the trivy scan option to pick up vulnerability scans
using trivy fs scan command

This is the implementation of approach suggested here aquasecurity#830
deven0t added a commit to deven0t/starboard that referenced this pull request Jan 19, 2022
``trivy.command: fs`` will change the trivy scan option to pick up vulnerability scans
using trivy fs scan command

This is the implementation of approach suggested here aquasecurity#830
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎨 design More about design and architecture than writing Go code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Write proposal to use Trivy file system scanner
3 participants