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

Sign images using Sigstore #3707

Merged
merged 7 commits into from
Jan 12, 2023
Merged

Conversation

marcofranssen
Copy link
Contributor

@marcofranssen marcofranssen commented Dec 20, 2022

  • Limit workflow job permissions to bare minimum
  • Add container signing using Sigstore keyless

Pull Request check list

  • Commit conforms to CONTRIBUTING.md?
  • Proper tests/regressions included?
  • Documentation updated?

Affected functionality

Description of change

This allows consumers of the image to verify the signature. E.g. via a policy engine in k8s or via cosign verify in workflows etc.

See https://registry-ui.chainguard.app/ to explore the signatures of an image.
and https://rekor.tlog.dev/ to explore the transparancy log (shows which workflow was used to sign the image) This information can be used in policies and attestations.

Which issue this PR fixes

@evan2645 evan2645 added this to the 1.5.4 milestone Dec 20, 2022
Comment on lines +20 to +21
env:
COSIGN_EXPERIMENTAL: 1
Copy link
Collaborator

Choose a reason for hiding this comment

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

is this to use keyless approach?

Copy link
Contributor Author

@marcofranssen marcofranssen Jan 5, 2023

Choose a reason for hiding this comment

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

yes, although experimental, haven't faced any issue in the last year I have been using it on various repos. I think they are close to making this feature GA, so with new release of cosign, this might not be required anymore.

Copy link

Choose a reason for hiding this comment

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

Sigstore is now GA so the env var here is no longer needed 🎉

Copy link

Choose a reason for hiding this comment

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

this is still required until we cut a cosign release v2

steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install cosign
Copy link
Collaborator

Choose a reason for hiding this comment

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

so, we'll be signing only release and nightly builds, how about regular builds images? (the ones generated when running PRs)
I think signing regular PR images can be useful to verify sign still working, and we may benefits with that if we create an IT that verify our images are signed

Copy link

Choose a reason for hiding this comment

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

agree, you can sign the image that you generate in the main branch build

Copy link
Contributor Author

@marcofranssen marcofranssen Jan 10, 2023

Choose a reason for hiding this comment

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

For that there is already a nightly in place. On the main branch no images are released, so also nothing to sign there. Or is there a way to sign an image that hasn't been pushed to a registry? Basically offline signature? I'm not aware you can sign without pushing to a registry.

@marcofranssen
Copy link
Contributor Author

marcofranssen commented Dec 27, 2022

so, we'll be signing only release and nightly builds, how about regular builds images? (the ones generated when running PRs) I think signing regular PR images can be useful to verify sign still working, and we may benefits with that if we create an IT that verify our images are signed

Signatures are stored in the registry. As well in the transparency log. IMHO doesn't make sense to do that. Those images are also not published meaning we are pushing signatures and and transparancy log records for images that do not exist in the registry.

@amartinezfayo amartinezfayo modified the milestones: 1.5.4, 1.6.0 Jan 5, 2023
Copy link

@cpanato cpanato left a comment

Choose a reason for hiding this comment

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

some comments, this is super nice to see 🎉

Comment on lines +20 to +21
env:
COSIGN_EXPERIMENTAL: 1
Copy link

Choose a reason for hiding this comment

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

this is still required until we cut a cosign release v2

packages: write

env:
COSIGN_EXPERIMENTAL: 1

steps:
- name: Checkout
uses: actions/checkout@v3
Copy link

Choose a reason for hiding this comment

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

a good practice is to use the git hash instead of the tag and have a comment to which release is pointing to. Dependabot when update the release can also update the comment :)

Suggested change
uses: actions/checkout@v3
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0

same applies to the other actions

Copy link
Contributor Author

@marcofranssen marcofranssen Jan 10, 2023

Choose a reason for hiding this comment

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

There is another PR adressing this practice already. #3727

steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install cosign
Copy link

Choose a reason for hiding this comment

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

agree, you can sign the image that you generate in the main branch build

Copy link
Member

@amartinezfayo amartinezfayo left a comment

Choose a reason for hiding this comment

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

Thank you @marcofranssen!

@amartinezfayo amartinezfayo merged commit f9977d1 into spiffe:main Jan 12, 2023
@cpanato
Copy link

cpanato commented Jan 16, 2023

🎉

@marcofranssen marcofranssen deleted the container-signing branch January 16, 2023 21:04
stevend-uber pushed a commit to stevend-uber/spire that referenced this pull request Oct 16, 2023
* Limit workflow job permissions to bare minimum

This allows to narrow down workflow permissions in GitHub settings

See https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs
and https://docs.github.com/en/actions/security-guides/automatic-token-authentication\#permissions-for-the-github_token

Signed-off-by: Marco Franssen <[email protected]>

* Add container signing using Sigstore keyless

Signed-off-by: Marco Franssen <[email protected]>

Signed-off-by: Marco Franssen <[email protected]>
Co-authored-by: Marcos Yacob <[email protected]>
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.

6 participants