fix(signing): use protojson.Marshal for standard Sigstore Bundle format
#275
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Leeway's remote cache has 0% hit rate, causing every build to rebuild all packages locally, wasting 15-20 minutes per build (250-333 hours/month).
Fixes https://linear.app/ona-team/issue/CLC-2083/improve-att-generation
Root Cause
The attestation generation code was using Go's standard
json.Marshalinstead of protobuf'sprotojson.Marshal, which caused:media_typevsmediaType)oneoffield names leaking into JSON)verification_material.Content.CertificatevsverificationMaterial.certificate)Official Sigstore Bundle v0.3 format: https://docs.sigstore.dev/about/bundle/
Solution
Use
protojson.MarshalOptionswith explicit configuration:This generates a standard Sigstore Bundle v0.3 format with:
mediaType,verificationMaterial)certificate,dsseEnvelope)verificationMaterial.certificate)Changes
protojson.MarshalOptionswith explicit configuration instead ofjson.MarshalTestBundleFormatCompliance: Verifies expected output format (6 subtests)TestProtojsonMarshalOptions: Tests actual protobuf marshaling behavior (4 subtests)Testing
All existing tests pass, plus new format verification tests:
New Tests
TestBundleFormatCompliance - Verifies expected format structure:
TestProtojsonMarshalOptions - Tests actual protobuf marshaling:
These tests ensure our MarshalOptions configuration produces the correct format without requiring Sigstore credentials.
Expected Impact
Verification
After deploying this fix, new attestations will have the correct format:
Risk Assessment
Low Risk:
References
Co-authored-by: Ona no-reply@ona.com