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
This commit is contained in:
Andrew Gabbitas 2021-09-07 16:54:14 -06:00 committed by GitHub
parent 258e0cf7c1
commit a768128187
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -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)
}
}