Repository navigation
Snippet: read accepted roots from a precalculated list on another hostname - #67
Merged
Merged
Conversation
Fetching get-roots from the log's own hostname and then forwarding the submission made Cloudflare fail it with error 1201 ("Snippet tried to continue to origin multiple times"). Instead, CONFIG.logEnvironments entries can give a log a roots URL, which must be on another hostname (the Snippet fails to deploy if the log's own pattern matches it, and one on the requested hostname is ignored); roots aren't checked for logs without one, or that use CONFIG.environment.
The roots URL serves a list of the hashes of the roots' subject names ("CF_CTreq Accepted Roots v1"), annotated with the names, which tools/roots-hashes.mjs generates from a log's get-roots endpoint, a get-roots response or a PEM bundle. Reading precalculated hashes, rather than the roots themselves, keeps the Snippet well within its 5 ms CPU time limit (about 0.1 ms for 700 roots, rather than about 5 ms). A list that can't be read, including an empty one, skips the check.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the Cloudflare error 1201 outage: v1.5.0 fetched
get-rootsfrom the log's own hostname and then forwarded the submission, which Cloudflare fails as "Snippet tried to continue to origin multiple times". Requests that reached a copy of the snippet without cached roots (including every one of Google's log monitoring submissions) failed with a 503.Roots URL per log
CONFIG.logEnvironmentsentries can now be[regular expression, environment, roots URL]; the roots URL is optional, so existing entries are unchanged.""ornull, nor for logs that useCONFIG.environment. Sectigo's default entries have none yet, so as configured, no roots are checked.Precalculated roots list
CF_CTreq Accepted Roots v1, then one root per line, as the 8-hex-digit FNV-1a hash of its DER subject name, optionally followed by the subject name for people to read; blank lines and#comments are ignored.npm run roots-hashes -- <source>(tools/roots-hashes.mjs) generates it from a log'sget-rootsURL, aget-rootsresponse or a PEM bundle, sorted and annotated.Tests and docs
Validation
Before re-enabling in production
Deploy the new
cf_ctreq.min.jsto the ctlabs zone and runnpm run test:resubmitagainst Standee and Dumbo; then configure a roots URL (ideally outside the zone, as whether a hostname in the same zone also counts as the origin isn't documented) and run it again.