Skip to content

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

Merged
jsha merged 12 commits into
mainfrom
split-willing-to-issue
Jun 10, 2024
Merged

wfe: check well-formedness of requested names early#7530
jsha merged 12 commits into
mainfrom
split-willing-to-issue

Conversation

@jsha

@jsha jsha commented Jun 4, 2024

Copy link
Copy Markdown
Contributor

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:

  • checkWildcardHostList was checking pa.blocklist for nil before accessing pa.wildcardExactBlocklist. Fix that.
  • move table test for WillingToIssue into a new test case for WellFormedDomainNames
  • move two standalone test cases into the big table test

@jsha jsha requested a review from a team as a code owner June 4, 2024 23:16
@jsha jsha requested a review from pgporada June 4, 2024 23:16
@jsha jsha force-pushed the split-willing-to-issue branch from e64716b to d583df5 Compare June 4, 2024 23:38
@jsha

jsha commented Jun 4, 2024

Copy link
Copy Markdown
Contributor Author

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.

aarongable
aarongable previously approved these changes Jun 5, 2024
Comment thread policy/pa.go Outdated
// breaking queries.
// domain names.
//
// It checks the criteria checked by `WellFormed`, and additionally checks whether

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// It checks the criteria checked by `WellFormed`, and additionally checks whether
// It checks the criteria checked by `WellFormedDomainNames`, and additionally checks whether

Comment thread policy/pa_test.go Outdated
Comment thread wfe2/wfe.go
aarongable
aarongable previously approved these changes Jun 5, 2024
Comment thread policy/pa_test.go Outdated
@jsha jsha merged commit e198d35 into main Jun 10, 2024
@jsha jsha deleted the split-willing-to-issue branch June 10, 2024 20:46
pgporada added a commit that referenced this pull request Jun 20, 2024
In #7530, `wfe.NewOrder` [began constructing a rate limit
transaction](https://github.com/letsencrypt/boulder/pull/7530/files#diff-3f950e720c205ce9fa8dea12c6fd7fd44272c2671f19d0e06962abfbea00d491R2340-R2344)
with a precondition that all names must be lower-cased, however the
actual implementation of the precondition was accidentally overlooked.
This fix corrects that and adds a unit test to prevent a future
regression.

Other changes:
- Only normalized names count towards max names limit
- Only normalized names will be logged in the web.RequestEvent

---------

Co-authored-by: Samantha Frank <hello@entropy.cat>
pgporada added a commit that referenced this pull request Jun 20, 2024
In #7530, `wfe.NewOrder` [began constructing a rate limit
transaction](https://github.com/letsencrypt/boulder/pull/7530/files#diff-3f950e720c205ce9fa8dea12c6fd7fd44272c2671f19d0e06962abfbea00d491R2340-R2344)
with a precondition that all names must be lower-cased, however the
actual implementation of the precondition was accidentally overlooked.
This fix corrects that and adds a unit test to prevent a future
regression.

Other changes:
- Only normalized names count towards max names limit
- Only normalized names will be logged in the web.RequestEvent

---------

Co-authored-by: Samantha Frank <hello@entropy.cat>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

K/V rate limits: key construction and validation shouldn't happen before request validation

4 participants