Skip to content

workflows/release: upload assets, dogfood verification - #116

Merged
woodruffw merged 10 commits into
mainfrom
ww/verification-dogfooding
Jun 6, 2022
Merged

woodruffw merged 10 commits into
mainfrom
ww/verification-dogfooding

Conversation

@woodruffw

@woodruffw woodruffw commented Jun 4, 2022 •

Copy link
Copy Markdown
Member

Needs testing with a prerelease.

Closes #106.

cc @jku

Signed-off-by: William Woodruff [email protected]

@woodruffw woodruffw added the component:cicd CI/CD label Jun 4, 2022
@woodruffw
woodruffw requested a review from di June 4, 2022 14:55
@woodruffw woodruffw self-assigned this Jun 4, 2022
Signed-off-by: William Woodruff <[email protected]>
./smoketest-env/bin/python -m \
sigstore verify \
--cert "${dist}.crt" --signature "${dist}.sig" \
--cert-oidc-issuer https://token.actions.githubusercontent.com \

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

IMO we need some way to verify the workflow (org, repo, name) here as well. Maybe not a blocker for this but something to think about

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yep. These are the X.509v3 extensions we can verify against:

        X509v3 extensions:
            X509v3 Key Usage: critical
                Digital Signature
            X509v3 Extended Key Usage: 
                Code Signing
            X509v3 Basic Constraints: critical
                CA:FALSE
            X509v3 Subject Key Identifier: 
                D2:A5:AA:A9:BF:8D:EA:35:7D:C5:6B:16:A8:45:68:A2:9A:15:2C:FB
            X509v3 Authority Key Identifier: 
                58:C0:1E:5F:91:45:A5:66:A9:7A:CC:90:A1:93:22:D0:2A:C5:C5:FA
            X509v3 Subject Alternative Name: critical
                URI:https://github.com/sigstore/sigstore-python/.github/workflows/release.yml@refs/tags/v0.4.2
            1.3.6.1.4.1.57264.1.1: 
                https://token.actions.githubusercontent.com
            1.3.6.1.4.1.57264.1.6: 
                refs/tags/v0.4.2
            1.3.6.1.4.1.57264.1.3: 
                dd2be1d19eeb0fbffbc36afe27bba7ba03fe97cf
            1.3.6.1.4.1.57264.1.5: 
                sigstore/sigstore-python
            1.3.6.1.4.1.57264.1.2: 
                release
            1.3.6.1.4.1.57264.1.4: 
                release

So we could additionally do the SAN here (since we have that via the misleading --cert-email option), as well as the commit hash and symbolic ref.

@jku jku Jun 6, 2022 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yes, I would agree checking SAN would make sense. My security property assumptions (that I have not yet checked against github docs) are

  • GitHub asserts that the workflow referred to by SAN was used to run this build
  • GitHub asserts that it only gives OIDC tokens to trusted GitHub build systems

This still leaves some details (like the choice of using mutable tag in SAN) that could be improved by checking the other extensions if/when that is possible, but I think SAN+OIDC provider is a very good starting point.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

GitHub asserts that the workflow referred to by SAN was used to run this build

Yes, this is my understanding.

GitHub asserts that it only gives OIDC tokens to trusted GitHub build systems

Assuming you mean GitHub-hosted systems that have the appropriate permissions, I believe so.

woodruffw added 5 commits June 4, 2022 11:00
Signed-off-by: William Woodruff <[email protected]>
To avoid confusing twine.

Signed-off-by: William Woodruff <[email protected]>
Signed-off-by: William Woodruff <[email protected]>
@woodruffw
woodruffw marked this pull request as ready for review June 4, 2022 18:40
@woodruffw

Copy link
Copy Markdown
Member Author

Example of us now attaching our signing results to each release:

Screen Shot 2022-06-04 at 2 43 26 PM

We run sigstore verify with these results as part of the release workflow as well.

@woodruffw
woodruffw requested a review from di June 4, 2022 18:48

@jku jku left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good.

As a future consideration, if GitHub alone has six seemingly custom extensions that they think are useful, it looks like a somewhat generic --cert-extension <id> <value> option could maybe make sense -- so that callers can decide what they expect the certificate to contain without requiring specific support from sigstore-python?

I can see a benefit in making the GitHub case smoother than just that, but maybe a separate example script (or maybe a separate command sigstore verify-github) would be more useful than adding many potentially github-specific options to sigstore verify?

./smoketest-env/bin/python -m \
sigstore verify \
--cert "${dist}.crt" --signature "${dist}.sig" \
--cert-oidc-issuer https://token.actions.githubusercontent.com \

@jku jku Jun 6, 2022 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yes, I would agree checking SAN would make sense. My security property assumptions (that I have not yet checked against github docs) are

  • GitHub asserts that the workflow referred to by SAN was used to run this build
  • GitHub asserts that it only gives OIDC tokens to trusted GitHub build systems

This still leaves some details (like the choice of using mutable tag in SAN) that could be improved by checking the other extensions if/when that is possible, but I think SAN+OIDC provider is a very good starting point.

# Confusingly, this action also supports updating releases, not
# just creating them. This is what we want here, since we've manually
# created the release that triggered the action.
uses: softprops/action-gh-release@v1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We use this action in python-tuf as well, at least for now... It is weird that GitHub does not provide this as a standard action and instead forces us to use third parties just to upload release artifacts but 🤷 .

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Very weird indeed.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yep, this is a frustration of mine with Actions: GitHub invested a lot of time and effort into initial implementations of a lot of things under the actions/ namespace, but doesn't maintain many of them anymore. The "correct" action to use here is actions/upload-release-asset, but it's completely unmaintained and doesn't support globs.

di
di previously approved these changes Jun 6, 2022
Comment thread sigstore/__init__.py Resolved
Comment thread .github/workflows/release.yml Resolved
Co-authored-by: Dustin Ingram <[email protected]>
@woodruffw

woodruffw commented Jun 6, 2022 •

Copy link
Copy Markdown
Member Author

I can see a benefit in making the GitHub case smoother than just that, but maybe a separate example script (or maybe a separate command sigstore verify-github) would be more useful than adding many potentially github-specific options to sigstore verify?

I agree, although IMO sigstore verify --github would be the a nicer shortcut. But we can yakshave 🙂

Or sigstore verify --github-actions I suppose, since we need to differentiate GitHub's "normal" OIDC provider from the one used for actions.

@woodruffw
woodruffw requested a review from di June 6, 2022 17:29
@woodruffw
woodruffw merged commit fc1ed42 into main Jun 6, 2022
@woodruffw
woodruffw deleted the ww/verification-dogfooding branch June 6, 2022 18:14
javanlacerda pushed a commit to javanlacerda/sigstore-python that referenced this pull request Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dogfood verification

3 participants