Skip to content

test: Check that a deployed snippet checks the log's accepted roots - #74

Merged
robstradling merged 1 commit into
mainfrom
test-deployed-root-check
Nov 17, 2026
Merged

robstradling merged 1 commit into
mainfrom
test-deployed-root-check

Conversation

@robstradling

Copy link
Copy Markdown
Member

What

Adds npm run test:roots (test/roots.mjs), a fourth check of a deployed log. Until now, nothing checked that a deployed snippet actually applies root-not-accepted. With CTREQ_LOG_URL set, npm test only sends requests that the local snippet rejects for log.example.com, which has no roots list. test:resubmit only shows that real entries aren't falsely rejected.

CTREQ_LOG_URL=https://tiger2027h1.ct.sectigo.com npm run test:roots
  • It sends the log one certificate whose issuer ("CF_CTreq test: not a root") isn't a root.
  • The local snippet built for the log's zone (from dist/) must reject it with root-not-accepted. If that snippet has no roots list for the hostname, e.g. a localhost URL, the check is skipped with an explanation.
  • The deployed snippet must reject it too, with 400 and X-CTreq-Reject: root-not-accepted. A Cloudflare error page, or the log answering itself, fails the check: the failure message asks whether the zone's current snippet is the one deployed.
  • Were the deployed snippet to forward it, the log would reject it itself (the signature is also invalid), so nothing is logged.
  • It works for any log with a roots list, including Standee, Dumbo and Tigger. That's why it's a separate script: test:forwarding needs a production log.

test:forwarding and test:roots share a new outputFor() in tools/build.mjs, which picks the snippet to deploy for a log's hostname. The README's "Testing a deployed log" section has a new row and subsection.

Testing

  • I haven't run it against a real log. Instead, a preload script stood in for a deployed snippet (the local zone build in front of a fake log):
    • with the current zone snippet: passes;
    • with no snippet: fails;
    • localhost URL: skipped;
    • no URL: prints usage and exits 2.
  • The test chain gets root-not-accepted locally for all eight Sectigo logs.
  • npm test and npm run test:minified pass.

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

npm run test:roots sends the log identified by CTREQ_LOG_URL one certificate
whose issuer isn't a root. The local snippet built for the log's zone must
reject it with root-not-accepted (else the check is skipped), and the
deployed snippet must too, confirming that the zone's current snippet, with
its lists of accepted roots, is the one deployed. Were the deployed snippet
to forward it, the log would reject it itself, so nothing is logged.

test:forwarding and test:roots share outputFor(), which finds the snippet
to deploy for a log's hostname.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@robstradling
robstradling merged commit f0b90e8 into main Nov 17, 2026
18 checks passed
@robstradling
robstradling deleted the test-deployed-root-check branch November 17, 2026 10:41
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.

1 participant