Skip to content

Add Marshalling support for WIT-SVID keys#7134

Open
sorindumitru wants to merge 3 commits into
spiffe:mainfrom
sorindumitru:wit-marshal
Open

Add Marshalling support for WIT-SVID keys#7134
sorindumitru wants to merge 3 commits into
spiffe:mainfrom
sorindumitru:wit-marshal

Conversation

@sorindumitru

Copy link
Copy Markdown
Member

No description provided.

Signed-off-by: Sorin Dumitru <sorin@returnze.ro>
Copilot AI review requested due to automatic review settings July 9, 2026 09:53

Copilot AI left a comment

Copy link
Copy Markdown

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 on lines +149 to +156
if !c.noWITSVIDKeys {
for keyID, witSigningKey := range bundle.WITAuthorities() {
jwks.Keys = append(jwks.Keys, jose.JSONWebKey{
Key: witSigningKey,
KeyID: keyID,
Use: maybeUse(witSVIDUse),
})
}
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 <sorin@returnze.ro>
Signed-off-by: Sorin Dumitru <sorin@returnze.ro>
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