Skip to content

svid.v1 client: add support for building WIT-SVIDs - #7132

Merged
sorindumitru merged 6 commits into
spiffe:mainfrom
sorindumitru:wit-client
Aug 7, 2026
Merged

sorindumitru merged 6 commits into
spiffe:mainfrom
sorindumitru:wit-client

Conversation

@sorindumitru

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings July 9, 2026 08:57

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

Adds client-side support in the SPIRE Agent for minting WIT-SVIDs via the svid.v1 server API, including a new client method and accompanying unit tests.

Changes:

  • Introduces a WITSVID result type and adds NewWITSVIDs() to the agent client interface.
  • Implements batched WIT-SVID minting via BatchNewWITSVID, including per-result status handling and conversion to time.Time.
  • Adds unit test coverage and a fake SVID server implementation for BatchNewWITSVID.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
pkg/agent/client/client.go Adds WITSVID, client interface method, and the batch RPC plumbing to mint WIT-SVIDs.
pkg/agent/client/client_test.go Adds tests and fake server support for the new WIT-SVID batch minting client method.

Comment on lines +422 to +425
pkixPublicKey, err := x509.MarshalPKIXPublicKey(publicKey)
if err != nil {
return nil, err
}
Signed-off-by: Sorin Dumitru <[email protected]>
Signed-off-by: Sorin Dumitru <[email protected]>
Comment thread pkg/agent/client/client.go Outdated
}

params = append(params, &svidv1.NewWITSVIDParams{
EntryId: entryID,

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.

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.

Ups, yes, this needs to be set. Added it as parameter

return nil, fmt.Errorf("failed to batch new WIT-SVID(s): %w", err)
}

okStatus := int32(codes.OK)

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.

we are not validating response the same way we do for jwt:

	case svid.IssuedAt == 0:
		return nil, spiffeid.ID{}, errors.New("JWTSVID missing issued at")
	case svid.ExpiresAt == 0:
		return nil, spiffeid.ID{}, errors.New("JWTSVID missing expires at")
	case svid.IssuedAt > svid.ExpiresAt:
		return nil, spiffeid.ID{}, errors.New("JWTSVID issued after it has expired")
	}

this can result on invalid values, NewWITSVIDs converts both via time.Unix so a zero ExpiresAt becomes 1970.

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.

Added that now

@github-actions github-actions Bot assigned sorindumitru and unassigned MarcosDY Aug 4, 2026
Signed-off-by: Sorin Dumitru <[email protected]>
Signed-off-by: Sorin Dumitru <[email protected]>
Signed-off-by: Sorin Dumitru <[email protected]>
@MarcosDY MarcosDY self-assigned this Aug 4, 2026
@sorindumitru
sorindumitru added this pull request to the merge queue Aug 7, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 7, 2026
@sorindumitru sorindumitru added this to the 1.15.3 milestone Aug 7, 2026
@sorindumitru
sorindumitru added this pull request to the merge queue Aug 7, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 7, 2026
@sorindumitru
sorindumitru added this pull request to the merge queue Aug 7, 2026
Merged via the queue into spiffe:main with commit 457f8ed Aug 7, 2026
55 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