Skip to content

Commit

Permalink
Add serial number and revision number to svid minting log entries (sp…
Browse files Browse the repository at this point in the history
…iffe#3699)

* Added svid serial number and entry revision number where applicable

Signed-off-by: Alexander Viktorov <[email protected]>
  • Loading branch information
alexviktorov authored Dec 22, 2022
1 parent fe4b0dd commit 42540ae
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion pkg/server/api/svid/v1/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,12 @@ func (s *Service) MintX509SVID(ctx context.Context, req *svidv1.MintX509SVIDRequ
}

rpccontext.AddRPCAuditFields(ctx, logrus.Fields{
telemetry.ExpiresAt: x509SVID[0].NotAfter.Unix(),
telemetry.ExpiresAt: x509SVID[0].NotAfter.Format(time.RFC3339),
})

rpccontext.AuditRPCWithFields(ctx, commonX509SVIDLogFields)
log.WithField(telemetry.Expiration, x509SVID[0].NotAfter.Format(time.RFC3339)).
WithField(telemetry.SerialNumber, x509SVID[0].SerialNumber.String()).
WithFields(commonX509SVIDLogFields).
Debug("Signed X509 SVID")

Expand Down Expand Up @@ -263,6 +264,8 @@ func (s *Service) newX509SVID(ctx context.Context, param *svidv1.NewX509SVIDPara
}

log.WithField(telemetry.Expiration, x509Svid[0].NotAfter.Format(time.RFC3339)).
WithField(telemetry.SerialNumber, x509Svid[0].SerialNumber.String()).
WithField(telemetry.RevisionNumber, entry.RevisionNumber).
Debug("Signed X509 SVID")

return &svidv1.BatchNewX509SVIDResponse_Result{
Expand Down
4 changes: 2 additions & 2 deletions pkg/server/api/svid/v1/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ func TestServiceMintX509SVID(t *testing.T) {
x509CA := test.ca.X509CA()
now := test.ca.Clock().Now().UTC()
expiredAt := now.Add(test.ca.X509SVIDTTL())
expiresAtStr := strconv.FormatInt(expiredAt.Unix(), 10)
expiresAtStr := expiredAt.Format(time.RFC3339)
customExpiresAt := now.Add(10 * time.Second)
expiresAtCustomStr := strconv.FormatInt(customExpiresAt.Unix(), 10)
expiresAtCustomStr := customExpiresAt.Format(time.RFC3339)

for _, tt := range []struct {
name string
Expand Down

0 comments on commit 42540ae

Please sign in to comment.