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

Verify container images #3921

Merged
merged 1 commit into from
Dec 22, 2022

Conversation

wyike
Copy link
Contributor

@wyike wyike commented Dec 7, 2022

It allows to scan the controller manager image locally

This script is referring hack/verify-container-images.sh from cluster-api

Fixes #3894

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Dec 7, 2022

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: wyike (4b47d61f5c1e9518ef4f772e8fb8401e2579aedc)

@k8s-ci-robot k8s-ci-robot added cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. needs-priority labels Dec 7, 2022
@k8s-ci-robot
Copy link
Contributor

Welcome @wyike!

It looks like this is your first PR to kubernetes-sigs/cluster-api-provider-aws 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/cluster-api-provider-aws has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Dec 7, 2022
@k8s-ci-robot
Copy link
Contributor

Hi @wyike. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Dec 7, 2022
@Ankitasw
Copy link
Member

Ankitasw commented Dec 7, 2022

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Dec 7, 2022
@Ankitasw
Copy link
Member

Ankitasw commented Dec 7, 2022

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 7, 2022
@Ankitasw
Copy link
Member

Ankitasw commented Dec 7, 2022

Hey @wyike thanks for the PR.
Have you tested this script locally?

@wyike
Copy link
Contributor Author

wyike commented Dec 8, 2022

Hi @Ankitasw, yeah I tested on mac and linuxx86_64:

 ./hack/verify-container-images.sh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 51.4M  100 51.4M    0     0  1583k      0  0:00:33  0:00:33 --:--:-- 2883k
docker pull docker.io/docker/dockerfile:1.1-experimental
1.1-experimental: Pulling from docker/dockerfile
Digest: sha256:de85b2f3a3e8a2f7fe48e8e84a65f6fdd5cd5183afa6412fff9caa6871649c44
Status: Image is up to date for docker/dockerfile:1.1-experimental
docker.io/docker/dockerfile:1.1-experimental
docker pull gcr.io/distroless/static:latest
latest: Pulling from distroless/static
Digest: sha256:5759d194607e472ff80fff5833442d3991dd89b219c96552837a2c8f74058617
Status: Image is up to date for gcr.io/distroless/static:latest
gcr.io/distroless/static:latest
docker build --build-arg ARCH=amd64 --build-arg LDFLAGS="-X 'sigs.k8s.io/cluster-api-provider-aws/v2/version.buildDate=2022-12-08T09:11:22Z' -X 'sigs.k8s.io/cluster-api-provider-aws/v2/version.gitCommit=4b47d61f5c1e9518ef4f772e8fb8401e2579aedc' -X 'sigs.k8s.io/cluster-api-provider-aws/v2/version.gitTreeState=clean' -X 'sigs.k8s.io/cluster-api-provider-aws/v2/version.gitMajor=1' -X 'sigs.k8s.io/cluster-api-provider-aws/v2/version.gitMinor=4' -X 'sigs.k8s.io/cluster-api-provider-aws/v2/version.gitVersion=v1.4.0-585-4b47d61f5c1e95' -X 'sigs.k8s.io/cluster-api-provider-aws/v2/version.gitReleaseCommit=b038843096636cbfd6992b52a2aef145d0dd12f1'" . -t gcr.io/k8s-staging-cluster-api-aws/cluster-api-aws-controller-amd64:dev
[+] Building 7.8s (18/18) FINISHED
 => [internal] load build definition from Dockerfile                                                                                                             0.0s
 => => transferring dockerfile: 37B                                                                                                                              0.0s
 => [internal] load .dockerignore                                                                                                                                0.0s
 => => transferring context: 35B                                                                                                                                 0.0s
 => resolve image config for docker.io/docker/dockerfile:1.1-experimental                                                                                        0.0s
 => CACHED docker-image://docker.io/docker/dockerfile:1.1-experimental                                                                                           0.0s
 => [internal] load build definition from Dockerfile                                                                                                             0.0s
 => => transferring dockerfile: 37B                                                                                                                              0.0s
 => [internal] load metadata for gcr.io/distroless/static:nonroot                                                                                                1.0s
 => [internal] load metadata for docker.io/library/golang:1.18.3                                                                                                 2.9s
 => [toolchain 1/1] FROM docker.io/library/golang:1.18.3@sha256:1650c170f3c55c158431cd35906cb6faf25f5c93b9d8850341c81e1236eaa745                                 0.0s
 => CACHED [stage-2 1/3] FROM gcr.io/distroless/static:nonroot@sha256:ed05c7a5d67d6beebeba19c6b9082a5513d5f9c3e22a883b9dc73ec39ba41c04                           0.0s
 => [internal] load build context                                                                                                                                0.1s
 => => transferring context: 35.63kB                                                                                                                             0.1s
 => CACHED [builder 1/6] WORKDIR /workspace                                                                                                                      0.0s
 => CACHED [builder 2/6] COPY go.mod go.mod                                                                                                                      0.0s
 => CACHED [builder 3/6] COPY go.sum go.sum                                                                                                                      0.0s
 => CACHED [builder 4/6] RUN  --mount=type=cache,target=/root/.local/share/golang      --mount=type=cache,target=/go/pkg/mod      go mod download                0.0s
 => CACHED [builder 5/6] COPY ./ ./                                                                                                                              0.0s
 => [builder 6/6] RUN --mount=type=cache,target=/root/.cache/go-build     --mount=type=cache,target=/go/pkg/mod     --mount=type=cache,target=/root/.local/shar  3.8s
 => [stage-2 2/3] COPY --from=builder /workspace/manager .                                                                                                       0.2s
 => exporting to image                                                                                                                                           0.4s
 => => exporting layers                                                                                                                                          0.4s
 => => writing image sha256:2dedacc7722b085fb014da38b259bb5cf3333180dd31d631715cd7dea04dac45                                                                     0.0s
 => => naming to gcr.io/k8s-staging-cluster-api-aws/cluster-api-aws-controller-amd64:dev                                                                         0.0s

Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them

gcr.io/k8s-staging-cluster-api-aws/cluster-api-aws-controller-amd64:dev (debian 11.5)

Total: 0 (UNKNOWN: 0, LOW: 0, MEDIUM: 0, HIGH: 0, CRITICAL: 0)


manager (gobinary)

Total: 4 (UNKNOWN: 2, LOW: 1, MEDIUM: 1, HIGH: 0, CRITICAL: 0)

┌───────────────────────────┬─────────────────────┬──────────┬───────────────────┬───────────────┬────────────────────────────────────────────────────────────┐
│          Library          │    Vulnerability    │ Severity │ Installed Version │ Fixed Version │                           Title                            │
├───────────────────────────┼─────────────────────┼──────────┼───────────────────┼───────────────┼────────────────────────────────────────────────────────────┤
│ github.com/aws/aws-sdk-go │ CVE-2020-8911       │ MEDIUM   │ v1.44.107         │               │ aws/aws-sdk-go: CBC padding oracle issue in AWS S3 Crypto  │
│                           │                     │          │                   │               │ SDK for golang...                                          │
│                           │                     │          │                   │               │ https://avd.aquasec.com/nvd/cve-2020-8911                  │
│                           ├─────────────────────┼──────────┤                   ├───────────────┼────────────────────────────────────────────────────────────┤
│                           │ CVE-2020-8912       │ LOW      │                   │               │ aws-sdk-go: In-band key negotiation issue in AWS S3 Crypto │
│                           │                     │          │                   │               │ SDK for golang...                                          │
│                           │                     │          │                   │               │ https://avd.aquasec.com/nvd/cve-2020-8912                  │
│                           ├─────────────────────┼──────────┤                   ├───────────────┼────────────────────────────────────────────────────────────┤
│                           │ GHSA-7f33-f4f5-xwgw │ UNKNOWN  │                   │               │ The Go AWS S3 Crypto SDK contains vulnerabilities that can │
│                           │                     │          │                   │               │ permit an...                                               │
│                           │                     │          │                   │               │ https://github.com/advisories/GHSA-7f33-f4f5-xwgw          │
│                           ├─────────────────────┤          │                   ├───────────────┼────────────────────────────────────────────────────────────┤
│                           │ GHSA-f5pg-7wfw-84q9 │          │                   │               │ The Go AWS S3 Crypto SDK contains vulnerabilities that can │
│                           │                     │          │                   │               │ permit an...                                               │
│                           │                     │          │                   │               │ https://github.com/advisories/GHSA-f5pg-7wfw-84q9          │
└───────────────────────────┴─────────────────────┴──────────┴───────────────────┴───────────────┴────────────────────────────────────────────────────────────┘

I see Fabrizio also add github action for it in PR. Do we also need to add for for CAPA?
Another question is I think we are good for kubernetes-sigs/cluster-api#7632, we already have automated dependency bumps in .github/dependabot.yml. Right? :)

@Ankitasw
Copy link
Member

I see Fabrizio also add github action for it in kubernetes-sigs/cluster-api#7604. Do we also need to add for for CAPA?

Yeah I think there is no harm in adding github actions.

Another question is I think we are good for kubernetes-sigs/cluster-api#7632, we already have automated dependency bumps in .github/dependabot.yml. Right? :)

Yes this is already in CAPA 🙂 so we can ignore this.

@wyike wyike force-pushed the verify-container-images branch from 4b47d61 to 2635ee2 Compare December 15, 2022 02:21
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 15, 2022
@wyike wyike force-pushed the verify-container-images branch 2 times, most recently from c4ea9bf to 878ac02 Compare December 16, 2022 06:17
@Ankitasw
Copy link
Member

@wyike could you rebase your PR?

1.The script allows to scan the controller manager image locally
2.Also add github actions for trivy scanning
@wyike wyike force-pushed the verify-container-images branch from 878ac02 to 3dc022a Compare December 22, 2022 12:40
@Ankitasw
Copy link
Member

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 22, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Ankitasw

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 22, 2022
@wyike
Copy link
Contributor Author

wyike commented Dec 22, 2022

Hi @Ankitasw , I rebased just now. But I saw Fabrizio did more changes on his PR recently. I plan to follow and add one more make verify-container-images recently. Not sure if we want to merge after his PR merged in case more changes on his?

@Ankitasw
Copy link
Member

Ankitasw commented Dec 22, 2022

/hold

You can add those changes in this PR itself. I missed checking those changes. Thanks for bringing it up 🙇‍♀️

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 22, 2022
@Ankitasw
Copy link
Member

Let's do follow up PR for remaining work.

/unhold

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 22, 2022
@k8s-ci-robot k8s-ci-robot merged commit d2f648f into kubernetes-sigs:main Dec 22, 2022
@wyike wyike mentioned this pull request Jan 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Script to run trivy scanner on container images
3 participants