From a768128187eac27d154f7c5e810782f684abbd23 Mon Sep 17 00:00:00 2001 From: Andrew Gabbitas Date: Tue, 7 Sep 2021 16:54:14 -0600 Subject: [PATCH] Return rate limited domain names in order (#5639) `enforceNameCounts` takes a slice of names as an input and returns a slice of domain names that are over limit. Return the badNames in the same order they were input. Fixes: #5631 --- ra/ra.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ra/ra.go b/ra/ra.go index b0a9c548b..52d32fbb4 100644 --- a/ra/ra.go +++ b/ra/ra.go @@ -1403,8 +1403,11 @@ func (ra *RegistrationAuthorityImpl) enforceNameCounts(ctx context.Context, name } var badNames []string - for name, count := range response.Counts { - if count >= limit.GetThreshold(name, regID) { + // Find the names that have counts at or over the threshold. Range + // over the names slice input to ensure the order of badNames will + // return the badNames in the same order they were input. + for _, name := range names { + if response.Counts[name] >= limit.GetThreshold(name, regID) { badNames = append(badNames, name) } }