Skip to content

Commit cb7786b

Browse files
authored
Deprecate NoPendingAuthzReuse flag (#8458)
1 parent 313ce53 commit cb7786b

File tree

10 files changed

+453
-734
lines changed

10 files changed

+453
-734
lines changed

features/features.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ type Config struct {
2828
ExpirationMailerUsesJoin bool
2929
DOH bool
3030
IgnoreAccountContacts bool
31+
NoPendingAuthzReuse bool
3132

3233
// ServeRenewalInfo exposes the renewalInfo endpoint in the directory and for
3334
// GET requests. WARNING: This feature is a draft and highly unstable.
@@ -71,12 +72,6 @@ type Config struct {
7172
// fails validation.
7273
AutomaticallyPauseZombieClients bool
7374

74-
// NoPendingAuthzReuse causes the RA to only select already-validated authzs
75-
// to attach to a newly created order. This preserves important client-facing
76-
// functionality (valid authz reuse) while letting us simplify our code by
77-
// removing pending authz reuse.
78-
NoPendingAuthzReuse bool
79-
8075
// StoreARIReplacesInOrders causes the SA to store and retrieve the optional
8176
// ARI replaces field in the orders table.
8277
StoreARIReplacesInOrders bool

mocks/sa.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -466,10 +466,6 @@ func (sa *StorageAuthorityReadOnly) GetValidAuthorizations2(ctx context.Context,
466466
return auths, nil
467467
}
468468

469-
func (sa *StorageAuthorityReadOnly) GetAuthorizations2(ctx context.Context, req *sapb.GetAuthorizationsRequest, _ ...grpc.CallOption) (*sapb.Authorizations, error) {
470-
return &sapb.Authorizations{}, nil
471-
}
472-
473469
// GetAuthorization2 is a mock
474470
func (sa *StorageAuthorityReadOnly) GetAuthorization2(ctx context.Context, id *sapb.AuthorizationID2, _ ...grpc.CallOption) (*corepb.Authorization, error) {
475471
return &corepb.Authorization{}, nil

ra/ra.go

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2211,24 +2211,12 @@ func (ra *RegistrationAuthorityImpl) NewOrder(ctx context.Context, req *rapb.New
22112211
}
22122212
authzExpiryCutoff := ra.clk.Now().Add(minTimeToExpiry)
22132213

2214-
var existingAuthz *sapb.Authorizations
2215-
if features.Get().NoPendingAuthzReuse {
2216-
getAuthReq := &sapb.GetValidAuthorizationsRequest{
2217-
RegistrationID: req.RegistrationID,
2218-
ValidUntil: timestamppb.New(authzExpiryCutoff),
2219-
Identifiers: idents.ToProtoSlice(),
2220-
Profile: req.CertificateProfileName,
2221-
}
2222-
existingAuthz, err = ra.SA.GetValidAuthorizations2(ctx, getAuthReq)
2223-
} else {
2224-
getAuthReq := &sapb.GetAuthorizationsRequest{
2225-
RegistrationID: req.RegistrationID,
2226-
ValidUntil: timestamppb.New(authzExpiryCutoff),
2227-
Identifiers: idents.ToProtoSlice(),
2228-
Profile: req.CertificateProfileName,
2229-
}
2230-
existingAuthz, err = ra.SA.GetAuthorizations2(ctx, getAuthReq)
2231-
}
2214+
existingAuthz, err := ra.SA.GetValidAuthorizations2(ctx, &sapb.GetValidAuthorizationsRequest{
2215+
RegistrationID: req.RegistrationID,
2216+
ValidUntil: timestamppb.New(authzExpiryCutoff),
2217+
Identifiers: idents.ToProtoSlice(),
2218+
Profile: req.CertificateProfileName,
2219+
})
22322220
if err != nil {
22332221
return nil, err
22342222
}

ra/ra_test.go

Lines changed: 2 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1718,7 +1718,7 @@ func TestNewOrder_AuthzReuse(t *testing.T) {
17181718
Name: "Reuse pending authz",
17191719
RegistrationID: Registration.Id,
17201720
Identifier: identifier.NewDNS(pending),
1721-
ExpectReuse: true, // TODO(#7715): Invert this.
1721+
ExpectReuse: false,
17221722
},
17231723
{
17241724
Name: "Reuse valid authz",
@@ -1766,40 +1766,6 @@ func TestNewOrder_AuthzReuse(t *testing.T) {
17661766
}
17671767
}
17681768

1769-
// TestNewOrder_AuthzReuse_NoPending tests that authz reuse doesn't reuse
1770-
// pending authzs when a feature flag is set.
1771-
// This is not simply a test case in TestNewOrder_OrderReuse because it relies
1772-
// on feature-flag gated behavior. It should be unified with that function when
1773-
// the feature flag is removed.
1774-
func TestNewOrder_AuthzReuse_NoPending(t *testing.T) {
1775-
// TODO(#7715): Integrate these cases into TestNewOrder_AuthzReuse.
1776-
_, _, ra, _, _, cleanUp := initAuthorities(t)
1777-
defer cleanUp()
1778-
1779-
features.Set(features.Config{NoPendingAuthzReuse: true})
1780-
defer features.Reset()
1781-
1782-
// Create an initial order and two pending authzs.
1783-
extant, err := ra.NewOrder(context.Background(), &rapb.NewOrderRequest{
1784-
RegistrationID: Registration.Id,
1785-
Identifiers: []*corepb.Identifier{
1786-
identifier.NewDNS("a.com").ToProto(),
1787-
identifier.NewDNS("b.com").ToProto(),
1788-
},
1789-
})
1790-
test.AssertNotError(t, err, "creating test order")
1791-
1792-
// With the feature flag enabled, creating a new order for one of these names
1793-
// should not reuse the existing pending authz.
1794-
new, err := ra.NewOrder(context.Background(), &rapb.NewOrderRequest{
1795-
RegistrationID: Registration.Id,
1796-
Identifiers: []*corepb.Identifier{identifier.NewDNS("a.com").ToProto()},
1797-
})
1798-
test.AssertNotError(t, err, "creating test order")
1799-
test.AssertNotEquals(t, new.Id, extant.Id)
1800-
test.AssertNotEquals(t, new.V2Authorizations[0], extant.V2Authorizations[0])
1801-
}
1802-
18031769
func TestNewOrder_ValidationProfiles(t *testing.T) {
18041770
_, _, ra, _, _, cleanUp := initAuthorities(t)
18051771
defer cleanUp()
@@ -2012,7 +1978,7 @@ func TestNewOrder_ProfileIdentifierTypes(t *testing.T) {
20121978
}
20131979
}
20141980

2015-
// mockSAWithAuthzs has a GetAuthorizations2 method that returns the protobuf
1981+
// mockSAWithAuthzs has a GetValidAuthorizations2 method that returns the protobuf
20161982
// version of its authzs struct member. It also has a fake GetOrderForNames
20171983
// which always fails, and a fake NewOrderAndAuthzs which always succeeds, to
20181984
// facilitate the full execution of RA.NewOrder.
@@ -2043,14 +2009,6 @@ func (msa *mockSAWithAuthzs) GetValidAuthorizations2(ctx context.Context, req *s
20432009
return resp, nil
20442010
}
20452011

2046-
func (msa *mockSAWithAuthzs) GetAuthorizations2(ctx context.Context, req *sapb.GetAuthorizationsRequest, _ ...grpc.CallOption) (*sapb.Authorizations, error) {
2047-
return msa.GetValidAuthorizations2(ctx, &sapb.GetValidAuthorizationsRequest{
2048-
RegistrationID: req.RegistrationID,
2049-
Identifiers: req.Identifiers,
2050-
ValidUntil: req.ValidUntil,
2051-
})
2052-
}
2053-
20542012
func (msa *mockSAWithAuthzs) GetAuthorization2(ctx context.Context, req *sapb.AuthorizationID2, _ ...grpc.CallOption) (*corepb.Authorization, error) {
20552013
for _, authz := range msa.authzs {
20562014
if authz.ID == fmt.Sprintf("%d", req.Id) {

0 commit comments

Comments
 (0)