Skip to content

Add Marshalling support for WIT-SVID keys - #7134

Merged
sorindumitru merged 3 commits into
spiffe:mainfrom
sorindumitru:wit-marshal
Aug 14, 2026
Merged

sorindumitru merged 3 commits into
spiffe:mainfrom
sorindumitru:wit-marshal

Conversation

@sorindumitru

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings July 9, 2026 09:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR extends pkg/common/bundleutil JWKS marshalling to include WIT-SVID signing keys (as use: "wit-svid"), adds an option to omit them, and introduces convenience helpers for producing X509/JWT/WIT-specific bundle outputs.

Changes:

  • Add a new JWKS use value ("wit-svid") and marshal WIT authorities into the bundle output.
  • Add NoWITSVIDKeys() marshal option to optionally omit WIT keys.
  • Add MarshalX509SVIDBundle, MarshalJWTSVIDBundle, and MarshalWITSVIDBundle helpers, with accompanying unit tests.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
pkg/common/bundleutil/types.go Adds the wit-svid use constant for JWKS entries.
pkg/common/bundleutil/marshal.go Adds WIT key marshalling, a NoWITSVIDKeys option, and new targeted marshal helper functions.
pkg/common/bundleutil/marshal_test.go Extends marshalling tests to cover WIT keys and the new helper functions.

Comment thread pkg/common/bundleutil/marshal.go Resolved
Comment on lines +89 to +96
func MarshalWITSVIDBundle(bundle *spiffebundle.Bundle, opts ...MarshalOption) (string, error) {
allOpts := append([]MarshalOption{NoX509SVIDKeys(), NoJWTSVIDKeys()}, opts...)
marshaledBundle, err := Marshal(bundle, allOpts...)
if err != nil {
return "", err
}
return string(marshaledBundle), nil
}

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.

I think this decision was made for us by go-spiffe already. I don't think we can fix it there now, since it would be a breaking API change.

Signed-off-by: Sorin Dumitru <[email protected]>
Signed-off-by: Sorin Dumitru <[email protected]>
return Marshal(bundle, allOpts...)
}

func MarshalWITSVIDBundle(bundle *spiffebundle.Bundle, opts ...MarshalOption) (string, error) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why it to be a string but all another ones are []byte?

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.

This matches the shape of the API. See JWTBundles vs WITBundles.

We can probably do []byte here but it would mean ugly conversions where we use it.

@github-actions github-actions Bot assigned sorindumitru and unassigned MarcosDY Aug 8, 2026
@sorindumitru
sorindumitru requested a review from MarcosDY August 13, 2026 18:15
@github-actions github-actions Bot assigned MarcosDY and unassigned sorindumitru Aug 13, 2026
@sorindumitru sorindumitru added this to the 1.15.3 milestone Aug 14, 2026
@sorindumitru
sorindumitru added this pull request to the merge queue Aug 14, 2026
Merged via the queue into spiffe:main with commit 2e186cd Aug 14, 2026
56 checks passed
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.

3 participants