From 982b21bb0637d07e41649ef384d35c66f5248917 Mon Sep 17 00:00:00 2001 From: James Munnelly Date: Fri, 1 May 2020 12:18:34 +0100 Subject: [PATCH] Fix bug that could lead to validation to fail when attempting to update immutable field Signed-off-by: James Munnelly --- pkg/controller/acmeorders/sync.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/controller/acmeorders/sync.go b/pkg/controller/acmeorders/sync.go index d27a807d6..17e0e7cf4 100644 --- a/pkg/controller/acmeorders/sync.go +++ b/pkg/controller/acmeorders/sync.go @@ -239,9 +239,10 @@ func (c *controller) updateOrderStatus(ctx context.Context, cl acmecl.Interface, } o.Status.FinalizeURL = acmeOrder.FinalizeURL c.setOrderState(&o.Status, acmeOrder.Status) - // only set the authorizations field if the lengths mismatch. - // state can be rebuilt in this case on the next call to ProcessItem. - if len(o.Status.Authorizations) != len(acmeOrder.AuthzURLs) { + // once the 'authorizations' slice contains at least one item, it cannot be + // updated. If it does not contain any items, update it containing the list + // of authorizations returned on the Order. + if len(o.Status.Authorizations) == 0 { o.Status.Authorizations = constructAuthorizations(acmeOrder) }