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

[bug] Standard discrepancy: buildInvocationId versus buildInvocationID #3876

Open
woodruffw opened this issue Sep 10, 2024 · 7 comments
Open
Labels
status:triage Issue that has not been triaged type:bug Something isn't working

Comments

@woodruffw
Copy link

woodruffw commented Sep 10, 2024

My colleague @facutuesca observed this bug with the generator_generic_slsa3.yml action.

Describe the bug

In SLSA 0.1 and 0.2, buildInvocationId is spelled with a lowercase "d":

Screenshot 2024-09-10 at 4 55 22 PM

Similarly, it's spelled with a lowercase "d" in 1.0, where it's renamed to invocationId:

Screenshot 2024-09-10 at 4 56 24 PM

However, generator_generic_slsa3.yml@2.0.0 appears to generate 0.2 provenance objects with buildInvocationID (capital 'D') instead.

An example of this can be seen in sigstore-python's release artifacts, e.g. our intoto provenance for v3.2.0:

https://github.com/sigstore/sigstore-python/releases/download/v3.2.0/provenance-sigstore-v3.2.0.intoto.jsonl

when the payload is decoded, we can see that it's a v0.2 Provenance with the mis-spelled metadata.buildInvocationID. Excerpted below:

"metadata": {
    "buildInvocationID": "10457864437-1",
    "completeness": {
        "parameters": true,
        "environment": false,
        "materials": false
    },
    "reproducible": false
}

I've also attached the full SLSA provenance as a file to this report: slsa.json

To Reproduce

To reproduce, use the latest version of generator_generic_slsa3.yml (2.0.0) in a workflow, like so:

  generate-provenance:
    needs: [build]
    name: Generate build provenance
    permissions:
      actions: read # To read the workflow path.
      id-token: write # To sign the provenance.
      contents: write # To add assets to a release.
    # Currently this action needs to be referred by tag. More details at:
    # https://github.com/slsa-framework/slsa-github-generator#verification-of-provenance
    uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v2.0.0
    with:
      provenance-name: provenance-sigstore-${{ github.event.release.tag_name }}.intoto.jsonl
      base64-subjects: "${{ needs.build.outputs.hashes }}"
      upload-assets: true

(Not all of these options may be necessary; that's exactly how they appear in sigstore-python's CI, which observed this behavior.)

Expected behavior

I expected buildInvocationID to be spelled as buildInvocationId, for consistency with the SLSA provenance spec.

Additional context

None!

@woodruffw woodruffw added status:triage Issue that has not been triaged type:bug Something isn't working labels Sep 10, 2024
@ramonpetgrave64
Copy link
Collaborator

Thanks for reporting this. It seems like a go-style initialism that we've mistakenly enforced. I'm a bit surprised we're not seeing compatibility errors between the generators and slsa-verifier.

I'd like to address this soon, but is it currently causing difficulties for you?

@woodruffw
Copy link
Author

I'd like to address this soon, but is it currently causing difficulties for you?

Not difficulties per se, but we noticed it while adding SLSA predicate handling to sigstore-python: sigstore/sigstore-python#1115 🙂

In particular, we currently have a manual alias for the non-compliant field name here:

https://github.com/sigstore/sigstore-python/pull/1115/files#diff-f1ebf27728ce90626c6d7d75f863a09ca8095663033d3146912b814f0716c593R128

@woodruffw
Copy link
Author

(We'd ideally ship SLSA predicate support in sigstore-python without that hack, but I'm not sure if that's a good idea or not -- I suppose it would depend on how widely used this action is, and whether others are similarly assuming that this field is spelled as ID instead of Id).

@ramonpetgrave64
Copy link
Collaborator

Lots of folks are using older versions of the generic generator, so it could be wiser for you to maintain backwards compatibility for preexisting provenances.

But first, is the new functionality you're adding to sigstore-python to be able to both generate and verify signed Sigstore bundles that have SLSA provenance statements (what I think you call DSSE statements)?

Currently the generic generator does not produce Sigstore bundles, only signed DSSE envelopes that wrap the provenances statements, which still use fulcio certificates for signing. slsa-verifier would do online lookups for more verification procedures.

We have a pending change to make the generic generator produce sigstore bundles, so I perhaps I should also fix the this initialism issue before we release that change.

If sigstore-python's verification is only meant to work with sigstore-bundles, and the generic generator does not yet produce sigstore bundles, do you still need the alias?

@woodruffw
Copy link
Author

woodruffw commented Sep 12, 2024

We have a pending change to make the generic generator produce sigstore bundles, so I perhaps I should also fix the this initialism issue before we release that change.

That would be great!

If sigstore-python's verification is only meant to work with sigstore-bundles, and the generic generator does not yet produce sigstore bundles, do you still need the alias?

Ah, true -- I think we observed this while looking for samples to check our the inner SLSA payload validation against, but we indeed won't ever directly consume the outputs of this action. So yeah, unless I'm missing something, we don't actually need the alias.

(CCing @facutuesca to confirm)

@facutuesca
Copy link

facutuesca commented Sep 12, 2024

So yeah, unless I'm missing something, we don't actually need the alias.

Is there any workflow where a user would want to generate a sigstore bundle using the predicate inside the DSSE envelope generated by this action?

The verification where we found this issue is not the usual bundle verification, but rather a validation we run when generating sigstore bundles with DSSE envelopes. For that, the user needs to specify an artifact and a predicate:

sigstore attest --predicate-type https://slsa.dev/provenance/v0.2 --predicate ./path/to/predicate.json  FILE

Then sigstore validates that predicate.json has the expected structure of a v0.2 provenance, before actually creating the bundle.

So if a user trying to generate a bundle with this action's output's predicate is something we don't expect to happen, then yeah, we don't need the alias in sigstore-python

@woodruffw
Copy link
Author

Is there any workflow where a user would want to generate a sigstore bundle using the predicate inside the DSSE envelope generated by this action?

I suspect not -- people using this action are probably passing the output around as-is, not reconstituting it into another bundle format 🙂

So yeah, it sounds like we should drop our alias.

ramonpetgrave64 added a commit that referenced this issue Oct 24, 2024
…orkflows (#3777)

# Summary

fixes
#3750

pending slsa-framework/slsa-verifier#799

Changes the internal go code to produce Sigstore Bundles, instead of
only signed DSSE envelopes. This means that the generic generator and go
builder workflows now produce Sigstore Bundles, just like the other
BYOB-type workflows.

## Testing Process

Testing done on a previous commit with a test workflow. It's using a
slightly modified slsa-verifier that respects sls-aw workflows from
non-main branches.
-
https://github.com/slsa-framework/slsa-github-generator/actions/runs/10425271660

## Followup

[ ] Produce the provenance in v1 format, rather than the current v0.2
format.
[ ] fix initialism of `[build]invocationID` to `[build]invocationId`
#3876

## Checklist

- [x] Review the contributing
[guidelines](https://github.com/slsa-framework/slsa-github-generator/blob/main/CONTRIBUTING.md)
- [x] Add a reference to related issues in the PR description.
- [x] Update documentation if applicable.
- [x] Add unit tests if applicable.
- [x] Add changes to the
[CHANGELOG](https://github.com/slsa-framework/slsa-github-generator/blob/main/CHANGELOG.md)
if applicable.

---------

Signed-off-by: Ramon Petgrave <32398091+ramonpetgrave64@users.noreply.github.com>
Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
Signed-off-by: Mend Renovate <bot@renovateapp.com>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Mend Renovate <bot@renovateapp.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:triage Issue that has not been triaged type:bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants