Skip to content

Commit 86b14de

Browse files
committed
SigningConfig Fix issue with default validFor end date
We want to special case the missing validFor dates: Make sure we use time.Time default value in that case. This is needed because elsewhere in code we use Time.IsZero() to check for it. Signed-off-by: Jussi Kukkonen <[email protected]>
1 parent b8ffbad commit 86b14de

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

pkg/root/signing_config.go

+13-2
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,22 @@ type ServiceConfiguration struct {
4848

4949
func NewService(s *prototrustroot.Service) Service {
5050
validFor := s.GetValidFor()
51+
52+
var start time.Time
53+
if validFor.GetStart() != nil {
54+
start = validFor.GetStart().AsTime()
55+
}
56+
57+
var end time.Time
58+
if validFor.GetEnd() != nil {
59+
end = validFor.GetEnd().AsTime()
60+
}
61+
5162
return Service{
5263
URL: s.GetUrl(),
5364
MajorAPIVersion: s.GetMajorApiVersion(),
54-
ValidityPeriodStart: validFor.GetStart().AsTime(),
55-
ValidityPeriodEnd: validFor.GetEnd().AsTime(),
65+
ValidityPeriodStart: start,
66+
ValidityPeriodEnd: end,
5667
}
5768
}
5869

0 commit comments

Comments
 (0)