Repository navigation
Add Marshalling support for WIT-SVID keys - #7134
Conversation
Signed-off-by: Sorin Dumitru <[email protected]>
There was a problem hiding this comment.
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
usevalue ("wit-svid") and marshal WIT authorities into the bundle output. - Add
NoWITSVIDKeys()marshal option to optionally omit WIT keys. - Add
MarshalX509SVIDBundle,MarshalJWTSVIDBundle, andMarshalWITSVIDBundlehelpers, 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. |
| 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 | ||
| } |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
why it to be a string but all another ones are []byte?
There was a problem hiding this comment.
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.
No description provided.