Skip to content

Commit

Permalink
Rename 'now' to 'validUntil' in GetAuthz requests (#7631)
Browse files Browse the repository at this point in the history
The name "now" was always misleading, because we never set the value to
be the actual current time, we always set it to be some time in the
future to avoid returning authzs which expire in the very near future.
Changing the name to "validUntil" matches the current naming in
GetPendingAuthorizationRequest.
  • Loading branch information
aarongable authored Jul 25, 2024
1 parent 986c78a commit 98a4bc0
Show file tree
Hide file tree
Showing 6 changed files with 713 additions and 711 deletions.
6 changes: 3 additions & 3 deletions mocks/sa.go
Original file line number Diff line number Diff line change
Expand Up @@ -468,10 +468,10 @@ func (sa *StorageAuthorityReadOnly) GetValidAuthorizations2(ctx context.Context,
if req.RegistrationID != 1 && req.RegistrationID != 5 && req.RegistrationID != 4 {
return &sapb.Authorizations{}, nil
}
now := req.Now.AsTime()
expiryCutoff := req.ValidUntil.AsTime()
auths := &sapb.Authorizations{}
for _, name := range req.Domains {
exp := now.AddDate(100, 0, 0)
exp := expiryCutoff.AddDate(100, 0, 0)
authzPB, err := bgrpc.AuthzToPB(core.Authorization{
Status: core.StatusValid,
RegistrationID: req.RegistrationID,
Expand All @@ -485,7 +485,7 @@ func (sa *StorageAuthorityReadOnly) GetValidAuthorizations2(ctx context.Context,
Status: core.StatusValid,
Type: core.ChallengeTypeDNS01,
Token: "exampleToken",
Validated: &now,
Validated: &expiryCutoff,
},
},
})
Expand Down
4 changes: 2 additions & 2 deletions ra/ra.go
Original file line number Diff line number Diff line change
Expand Up @@ -2100,7 +2100,7 @@ func (ra *RegistrationAuthorityImpl) RevokeCertByApplicant(ctx context.Context,
authzMapPB, err = ra.SA.GetValidAuthorizations2(ctx, &sapb.GetValidAuthorizationsRequest{
RegistrationID: req.RegID,
Domains: cert.DNSNames,
Now: timestamppb.New(ra.clk.Now()),
ValidUntil: timestamppb.New(ra.clk.Now()),
})
if err != nil {
return nil, err
Expand Down Expand Up @@ -2528,7 +2528,7 @@ func (ra *RegistrationAuthorityImpl) NewOrder(ctx context.Context, req *rapb.New

getAuthReq := &sapb.GetAuthorizationsRequest{
RegistrationID: newOrder.RegistrationID,
Now: timestamppb.New(authzExpiryCutoff),
ValidUntil: timestamppb.New(authzExpiryCutoff),
Domains: newOrder.Names,
}
existingAuthz, err := ra.SA.GetAuthorizations2(ctx, getAuthReq)
Expand Down
Loading

0 comments on commit 98a4bc0

Please sign in to comment.