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

[e2e]: container schedule main provenance-registry slsa3 #3024

Closed
ianlewis opened this issue Dec 8, 2023 · 46 comments
Closed

[e2e]: container schedule main provenance-registry slsa3 #3024

ianlewis opened this issue Dec 8, 2023 · 46 comments
Labels
area:container Issue with the generic container generator e2e e2e integration tests type:bug Something isn't working

Comments

@ianlewis ianlewis added area:container Issue with the generic container generator e2e e2e integration tests type:bug Something isn't working labels Dec 8, 2023
@saisatishkarra
Copy link
Contributor

saisatishkarra commented Dec 11, 2023

The docker repo at line https://github.com/slsa-framework/example-package/actions/runs/7162395442/job/19499307066 to push the container image doesn't seem to exist / permission issue with DOCKER_TOKEN. @ianlewis pls confirm if this was created and where the image needs to be pushed. Repo structure: docker.io/slsa-framework/<workflow-name>

@ianlewis
Copy link
Member Author

The repo server shouldn't be docker.io but ghcr.io so that will need to be fixed. We don't store any of our images from e2e tests in docker.io.
https://github.com/slsa-framework/example-package/blob/abca0df707464cb0017116bf9eefa5938d7eb56e/.github/workflows/e2e.container.schedule.main.provenance-registry.slsa3.yml#L21C9-L21C28

@saisatishkarra
Copy link
Contributor

saisatishkarra commented Dec 12, 2023

@ianlewis Here is more context for the swap and attempt for using dockerhub for images ((i.e deletion after completion) and GHCR for provenance: #2981 that we use two different registries (ghcr for provenance / dockerhub for container images).

Now that the deletion is not a requirement, I can swap them back (images in GHCR and provenance in dockerhub) but would still require the docker.io repo for provenance. Can you clarify what this repo name is / add a secret?

@saisatishkarra
Copy link
Contributor

Workaround PR: slsa-framework/example-package#296 that still requires docker.io for provenance and ghcr.io for images

@laurentsimon
Copy link
Collaborator

laurentsimon commented Dec 12, 2023

The latest run failed with Error response from daemon: Get "https://gchr.io/v2/": remote error: tls: handshake failure https://github.com/slsa-framework/example-package/actions/runs/7185487268. I re-ran and got the same error. May need to enable debugging

@saisatishkarra
Copy link
Contributor

@laurentsimon Quick look at ur comment made me find a typo and here is the fix: slsa-framework/example-package#297

@laurentsimon
Copy link
Collaborator

laurentsimon commented Dec 12, 2023

new run https://github.com/slsa-framework/example-package/actions/runs/7186615098/job/19572433787. The step "Create and sign provenance" shows the following error: tlog entry created with index: 56139934 Error: signing ghcr.io/slsa-framework/example-package.e2e.container.schedule.main.provenance-registry.slsa3@sha256:b11b6093931b12c27cd48a09d7fe3a6f319f99caec0de4a825a560be0e7f8731: GET https://index.docker.io/v2/slsa-framework/example-package.e2e.container.schedule.main.provenance-registry.slsa3/manifests/sha256-b11b6093931b12c27cd48a09d7fe3a6f319f99caec0de4a825a560be0e7f8731.att: UNAUTHORIZED: authentication required; [map[Action:pull Class: Name:slsa-framework/example-package.e2e.container.schedule.main.provenance-registry.slsa3 Type:repository]] main.go:74: error during command execution: signing ghcr.io/slsa-framework/example-package.e2e.container.schedule.main.provenance-registry.slsa3@sha256:b11b6093931b12c27cd48a09d7fe3a6f319f99caec0de4a825a560be0e7f8731: GET https://index.docker.io/v2/slsa-framework/example-package.e2e.container.schedule.main.provenance-registry.slsa3/manifests/sha256-b11b6093931b12c27cd48a09d7fe3a6f319f99caec0de4a825a560be0e7f8731.att: UNAUTHORIZED: authentication required; [map[Action:pull Class: Name:slsa-framework/example-package.e2e.container.schedule.main.provenance-registry.slsa3 Type:repository]] Error: Process completed with exit code 1.

Seems like an authentication error to docker. Mhh, could it be that my token does not have the permissions... It should have. Ill verify and circle back here.

@saisatishkarra
Copy link
Contributor

@laurentsimon Can you confirm if the below info is valid and exists as per https://index.docker.io/v2/slsa-framework/example-package.e2e.container.schedule.main.provenance-registry.slsa3 ?

  • dockerhub repository for provenance: example-package.e2e.container.schedule.main.provenance-registry.slsa3
  • dockerhub org/personal account name: slsa-framework
  • dockerhub username: laurentsimon
  • Token: secrets.E2E_DOCKER_HUB_TOKEN has permissions to write to the above docker repo / org.

@laurentsimon
Copy link
Collaborator

@laurentsimon Can you confirm if the below info is valid and exists as per https://index.docker.io/v2/slsa-framework/example-package.e2e.container.schedule.main.provenance-registry.slsa3 ?

  • dockerhub repository for provenance: example-package.e2e.container.schedule.main.provenance-registry.slsa3

This should be under the same repo laurentsimon

  • dockerhub org/personal account name: slsa-framework

should be laurentsimon

  • dockerhub username: laurentsimon
  • Token: secrets.E2E_DOCKER_HUB_TOKEN has permissions to write to the above docker repo / org.

@saisatishkarra
Copy link
Contributor

@ianlewis / @laurentsimon Here is the PR for provenance account auth

@laurentsimon
Copy link
Collaborator

Current error I'm seeing is FAILED: SLSA verification failed: no matching attestations: during verification. The cosign verification works, but the one with slsa-verifier does not. I think we're missing COSIGN_REPOSITORY="${PROVENANCE_IMAGE}" for slsa-verifier. I'll make the change and see if it fixes the problem

@laurentsimon
Copy link
Collaborator

still failing, I think it's due to the value being visible in the script but not "exported" to the slsa-verifier process by default. Maybe we need to export it explicitly in the script if its value is not empty. Made this change https://github.com/slsa-framework/example-package/blob/main/.github/workflows/scripts/e2e.container.default.verify.sh#L44-L47 but it has not fixed the problem. @saisatishkarra any thoughts? Have you run slsa-verifier CLI locally and confirmed that it works?

@saisatishkarra
Copy link
Contributor

@laurentsimon I haven't run the slsa-verifier locally and never tried exporting COSIGN_REPOSITRORY. I can give it a quick try using 2 local docker repositories at my end if setting the cosign env variable works by default. Otherwise, seems like this should be an explicit option to the verifier.

@saisatishkarra
Copy link
Contributor

saisatishkarra commented Dec 19, 2023

@laurentsimon I have tested this locally with some of the internal images.

  • SLSA VERFIER VERSION:
  ____    _       ____       _             __     __  _____   ____    ___   _____   ___   _____   ____
 / ___|  | |     / ___|     / \            \ \   / / | ____| |  _ \  |_ _| |  ___| |_ _| | ____| |  _ \
 \___ \  | |     \___ \    / _ \    _____   \ \ / /  |  _|   | |_) |  | |  | |_     | |  |  _|   | |_) |
  ___) | | |___   ___) |  / ___ \  |_____|   \ V /   | |___  |  _ <   | |  |  _|    | |  | |___  |  _ <
 |____/  |_____| |____/  /_/   \_\            \_/    |_____| |_| \_\ |___| |_|     |___| |_____| |_| \_\
slsa-verifier: Verify SLSA provenance for Github Actions

GitVersion:    2.4.0
GitCommit:     brew
GitTreeState:  clean
BuildDate:     2023-08-24T22:58:45Z
GoVersion:     go1.21.1
Compiler:      gc
Platform:      darwin/amd64
  • COSIGN VERSION:
  ______   ______        _______. __    _______ .__   __.
 /      | /  __  \      /       ||  |  /  _____||  \ |  |
|  ,----'|  |  |  |    |   (----`|  | |  |  __  |   \|  |
|  |     |  |  |  |     \   \    |  | |  | |_ | |  . `  |
|  `----.|  `--'  | .----)   |   |  | |  |__| | |  |\   |
 \______| \______/  |_______/    |__|  \______| |__| \__|
cosign: A tool for Container Signing, Verification and Storage in an OCI registry.

GitVersion:    2.0.1
GitCommit:     8faaee4d2b5f65678eb0831a8a3d5990a0271d3a
GitTreeState:  "clean"
BuildDate:     2023-04-06T19:10:33Z
GoVersion:     go1.20.3
Compiler:      gc
Platform:      darwin/amd64
  • COSIGN RESPECTS the COSIGN_REPOSITORY env and verified the provenance stored in a different repo
  • slsa-verifier FAILS even when the explicit export of COSIGN_REPOSITORY env and returns FAILED: SLSA verification failed: no matching attestations:

Can you confirm what version of cosign is being used by the slsa-verifier and if the API needs the COSIGN_REPOSITORY env parameter to be explicitly passed sent?

@laurentsimon
Copy link
Collaborator

@saisatishkarra
Copy link
Contributor

Here is the PR for consuming COSIGN_REPOSITORY when set for verifying provenance stored in a different registry. I have tested the go binary of slsa-verifier locally with the changes and it seemed to honor the set env variable and successfully verify image provenance instead of failing.

@ianlewis / @laurentsimon Please guide how to update the e2e workflow to use the ref of the slsa-verifier to test it.

@laurentsimon
Copy link
Collaborator

laurentsimon commented Jan 3, 2024

The changes in the PR make sense. I think this will work. We don't have good support to test a particular ref in the e2e test. I suggest we merge your PR and trigger it at main. Then we follow up with a PR to add a proper --provenance-registry as we decided in slsa-framework/slsa-verifier#724. Wdut?

@saisatishkarra
Copy link
Contributor

Sounds good to me!!

@ianlewis ianlewis closed this as completed Jan 4, 2024
@laurentsimon
Copy link
Collaborator

Looks like it's working, yaay, great job @saisatishkarra
Let me know if you need some guidance on the slsa-verifier. If so, please ping me on the issue and I will answer. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:container Issue with the generic container generator e2e e2e integration tests type:bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants