letsencrypt / letsencrypt/boulder
Slightly decrease ValidationRecord size
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 5.8k
- Forks
- 649
- Avg merge
- 3d 23h
- Merged PRs (30d)
- 24
Description
For each challenge in our database that gets validated, we store a ValidationRecord. This isn't for audit purposes (we have logs for that), but to help clients debug beyond what's in the Problem Details string. We can make some trivial tweaks to shorten the output. For instance, consider this modified example from the logs:
"validationRecord":[{"url":"http://example.com/.well-known/acme-challenge/xyzabcdef","hostname":"example.com","port":"80","addressesResolved":["192.88.99.11"],"addressUsed":"192.88.99.11"},{"url":"https://example.com/.well-known/acme-challenge/xyzabcdef","hostname":"example.com","port":"443","addressesResolved":["192.88.99.1"],"addressUsed":"192.88.99.1"},{"url":"https://example.com/ERROR/message.html?foo=bar","hostname":"example.com","port":"443","addressesResolved":["192.88.99.1"],"addressUsed":"192.88.99.1"}
The first entry in validationRecord represents the first fetch in the chain, which is fully specified by the challenge's hostname and token. We can eliminate the URL, hostname, and port fields.
Also, for many requests addressUsed will be the same as addressesResolved. We can eliminate addressesResolved in that case (keeping it for the case when multiple addresses were resolved).
Also, we can remove the "hostname" in all cases since that's duplicated in the URL. And we can remove "port" for the same reason.
"validationRecord":[{"addressUsed":"192.88.99.11"},{"url":"https://example.com/.well-known/acme-challenge/xyzabcdef","addressUsed":"192.88.99.1"},{"url":"https://example.com/ERROR/message.html?foo=bar","addressUsed":"192.88.99.1"}
This turns 516 bytes into 230 bytes. The gain will be smaller on URLs that don't redirect, though.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the ValidationRecord definition and its serialization path, then inspect how records are built for the challenge fetch chain. Compare serialized output with the issue's examples; done means redundant URL, hostname, and port fields are omitted as described, and addressesResolved is retained only when needed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100