Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate builder and validator #3869

Merged
merged 5 commits into from
Feb 17, 2023
Merged

Conversation

azdagron
Copy link
Member

@azdagron azdagron commented Feb 16, 2023

Also:

  • moves validator into own package
  • deletes unused signing code from jwtsvid package

Also:
- moves validator into own package
- deletes unused signing code from jwtsvid package

Signed-off-by: Andrew Harding <[email protected]>
@azdagron azdagron force-pushed the credentialcomposer-next branch from 1f47635 to 41ec0d4 Compare February 16, 2023 00:57
@@ -0,0 +1,227 @@
package jwtsvid
Copy link
Member Author

Choose a reason for hiding this comment

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

This is just a renamed token_test.go with just the validation test portion remaining.

@@ -40,31 +40,28 @@ type Config struct {
Clock clock.Clock
DataStore datastore.DataStore
ServerCA ca.ServerCA
AgentTTL time.Duration
Copy link
Member Author

Choose a reason for hiding this comment

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

AgentTTL is now handled in the builder.

@@ -398,93 +398,6 @@ func (b *Builder) buildX509SVIDTemplate(spiffeID spiffeid.ID, publicKey crypto.P
return tmpl, nil
}

func (b *Builder) ValidateX509CA(ca *x509.Certificate) error {
Copy link
Member Author

Choose a reason for hiding this comment

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

These moved into the credvalidator package.

@@ -0,0 +1,176 @@
package credvalidator
Copy link
Member Author

Choose a reason for hiding this comment

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

This is just existing code split out from the credtemplate.Builder.

@@ -0,0 +1,395 @@
package credvalidator_test
Copy link
Member Author

Choose a reason for hiding this comment

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

These tests are just existing code moved out from the credtemplate.Builder

Copy link
Collaborator

@MarcosDY MarcosDY left a comment

Choose a reason for hiding this comment

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

Looks great!!!

@@ -86,6 +86,7 @@ func (ca *UpstreamCA) SignCSR(ctx context.Context, csrDER []byte, preferredTTL t
x509.KeyUsageCRLSign,
BasicConstraintsValid: true,
IsCA: true,
ExtraExtensions: csr.ExtraExtensions,
Copy link
Collaborator

Choose a reason for hiding this comment

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

is it a change to what we have on previous versions? why is it required?

Copy link
Member Author

Choose a reason for hiding this comment

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

The CredentialComposers can add extra extensions to the CSR that is signed upstream.

}
telemetry_server.IncrServerCASignX509CACounter(ca.c.Metrics)
Copy link
Collaborator

Choose a reason for hiding this comment

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

signing X509 SVIDS will increment ServerCASignX509CA is that ok?

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy-paste bug! Fixed.

@@ -250,3 +253,27 @@ func makePublicKey(t *testing.T, kid string) *common.PublicKey {
PkixBytes: pkixBytes,
}
}

func generateServerCACSR() ([]byte, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

since error is not used, may we fatal here? or just ignore and depends on getting an empty csr is enough?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure. I changed it to panic since it is only used in tests and run at init time.

Signed-off-by: Andrew Harding <[email protected]>
Copy link
Collaborator

@MarcosDY MarcosDY left a comment

Choose a reason for hiding this comment

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

LGTM!!!

@MarcosDY MarcosDY added this to the 1.6.0 milestone Feb 16, 2023
@MarcosDY MarcosDY merged commit d4a5911 into spiffe:main Feb 17, 2023
@azdagron azdagron deleted the credentialcomposer-next branch February 17, 2023 15:51
stevend-uber pushed a commit to stevend-uber/spire that referenced this pull request Oct 16, 2023
* Integrate builder and validator

Also:
- moves validator into own package
- deletes unused signing code from jwtsvid package

Signed-off-by: Andrew Harding <[email protected]>
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