Skip to content

Set cert fields required by rust-spiffe workload api clients - #19

Merged
alec-w merged 2 commits into
cofide:mainfrom
glindstedt:push-olwktkkuzptp
Apr 7, 2026
Merged

alec-w merged 2 commits into
cofide:mainfrom
glindstedt:push-olwktkkuzptp

Conversation

@glindstedt

Copy link
Copy Markdown
Contributor

When using rust-spiffe1 the Workload API client complained about the BasicConstraints extension being missing:

failed to parse X.509 SVID: X.509 extension is missing: 2.5.29.19

SPIFFE spec does not require the pathLenConstraint to be set, so we specify -1 which means that it is unset.2

When verifying the server certificate on the client side while setting up the mTLS connection it failed to parse the certificate with BadEncoding. This turned out to be because NotBefore had not been set, which prevented the certificate from even being parsed before it could be verified.

Footnotes

  1. https://github.com/maxlambrecht/rust-spiffe ↩

  2. https://spiffe.io/docs/latest/spiffe-specs/x509-svid/#41-basic-constraints ↩

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request updates the InMemoryCA implementation in pkg/spire-devserver/memory-ca.go to include NotBefore timestamps for both CA and SVID certificates, and adds basic constraints to SVIDs for better client compatibility. The review feedback recommends backdating the NotBefore fields by one minute to prevent 'not yet valid' errors caused by clock skew between systems, which is particularly important given the short four-minute lifetime of the SVIDs.

Comment thread pkg/spire-devserver/memory-ca.go Outdated
Comment thread pkg/spire-devserver/memory-ca.go Outdated
@alec-w
alec-w self-requested a review April 7, 2026 14:40
@alec-w

alec-w commented Apr 7, 2026

Copy link
Copy Markdown
Member

Thanks @glindstedt 🙂

Is it worth applying those 2 suggestions from Gemini do you think? Stops a small clock drift being a spurious issue in the future (unlikely if this is only used in dev - but code has a funny habit of propagating to production)

@glindstedt

Copy link
Copy Markdown
Contributor Author

@alec-w Yeah doesn't hurt, I'll apply them 👍

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

@alec-w alec-w left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Contribution much appreciated 🙂

@alec-w
alec-w merged commit a3acd8c into cofide:main Apr 7, 2026
1 check passed
@glindstedt
glindstedt deleted the push-olwktkkuzptp branch April 7, 2026 15:18
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.

2 participants