letsencrypt / boulder

An ACME-based certificate authority, written in Go.
Mozilla Public License 2.0
5.06k stars 593 forks source link

wfe: check well-formedness of requested names early #7530

Closed jsha closed 3 weeks ago

jsha commented 4 weeks ago

This allows us to give a user-meaningful error about malformed names early on, instead of propagating internal errors from the new rate limiting system.

This moves the well-formedness logic from WillingToIssue into a new function WellFormedDomainNames, which calls ValidDomain on each name and combines the errors into suberrors if there is more than one. WillingToIssue now calls WellFormedDomainNames to keep the existing behavior. Additionally, WFE calls WellFormedDomainNames before checking rate limits.

This creates a slight behavior change: If an order contains both malformed domain names and wellformed but blocked domain names, suberrors will only be generated for the malformed domain names. This is reflected in the changes to TestWillingToIssue_Wildcard.

Adds a WFE test case for receiving malformed identifiers in a new-order request.

Follows up on #3323 and #7218

Fixes #7526

Some small incidental fixes:

jsha commented 4 weeks ago

Spurious test failure from govulncheck because there's a security release of Go (1.22.4) and (I think) GitHub's concept of the "latest" Go version hasn't updated yet.