Skip to content

Migrate chain validation from internal/lax509 to filippo.io/sunlight/chain - #1014

Draft
phbnf wants to merge 2 commits into
transparency-dev:mainfrom
phbnf:sunlight-chain
Draft

phbnf wants to merge 2 commits into
transparency-dev:mainfrom
phbnf:sunlight-chain

Conversation

@phbnf

@phbnf phbnf commented Dec 3, 2026 •

Copy link
Copy Markdown
Collaborator

Replaces our forked internal/lax509 package with filippo.io/sunlight/chain https://pkg.go.dev/filippo.io/sunlight/chain (v0.11.0) for chain validation and precertificate handling, removing crypto/x509 from the submission path and deleting internal/lax509/.

Behavioral & flag changes:

  • Unified SPKI-only blocking: Replaces --roots_reject_fingerprints and --intermediates_reject_fingerprints with a single --blocked_spkis flag, blocking by SPKI SHA-256 anywhere in the chain (leaf, intermediate, or root). Blocked roots remain in get-roots, while submissions chaining to them are rejected. This make the API much simpler.
  • Removed flags:
    • --reject_extension: was the last remaining dependency on crypto/x509 in chain validation.
    • --accept_sha1_signing_algorithms: now a no-op since filippo.io/sunlight/chain always accepts SHA-1 signatures.
  • Extended Key Usage: --ext_key_usages now only accepts an empty value, ServerAuth, and BrandIndicatorForMessageIdentification.
  • Precertificate Signing Certificates: Precertificates issued by Precertificate Signing Certificates are now rejected (per filippo.io/sunlight/chain and CA/B Forum Ballot SC-092), fixing Remove support for precert signing certificates #995.
  • Terraform: Updated deployment modules for the flag changes (roots_reject_fingerprints → blocked_spkis, removed -accept_sha1_signing_algorithms)

Towards #1010.

Drop certificate DER fingerprint matching and PEMCertPool root filtering
in favor of a single SPKI-only BlockedSPKIs / --blocked_spkis option
(and blocked_spkis in the Terraform modules), enforced across every
certificate in a verified chain (leaf, intermediate, and root).

Unlike --reject_extension, --roots_reject_fingerprints and
--intermediates_reject_fingerprints are intentionally removed rather
than kept as deprecated flags: because a SHA-256 of a certificate DER
and a SHA-256 of an SPKI are indistinguishable (and intermediates are
not known at startup), ignoring or SPKI-forwarding old configs would
silently fail open for anyone passing certificate DER fingerprints.
Failing closed at startup forces callers to migrate explicitly to
--blocked_spkis with SPKI SHA-256 hashes.
Replace internal/lax509 with filippo.io/sunlight/chain v0.11.0 and remove
crypto/x509 parsing from the submission hot path:

- Back x509util.PEMCertPool with immutable chain.Roots snapshots swapped
  atomically on root updates, validating roots via chain.Roots.Add.
- Update ChainValidator, handlers, requestLog, and CTStorage.AddIssuerChain
  to work on raw DER certificates and chain.Verified (NotBefore, NotAfter,
  TBSCertificate, IssuerKeyHash).
- Add x509util.EntryFromVerified to build log entries directly from
  chain.Verified without re-parsing or re-marshaling TBSCertificate.
- Delegate BlockedSPKIs directly to Verifier.BlockedKeys.
- Restrict ExtKeyUsages to "" (default, allow all), "ServerAuth", and
  "BrandIndicatorForMessageIdentification" (accepting "Any" as a deprecated
  alias that logs an error).
- Remove AcceptSHA1 from ChainValidationConfig and the GCE Terraform flag,
  keeping --accept_sha1_signing_algorithms as a deprecated no-op flag that
  logs an error now that filippo.io/sunlight/chain unconditionally verifies
  SHA-1 signatures.
- Reject precertificates issued by Precertificate Signing Certificates as
  enforced by filippo.io/sunlight/chain (allowed by static-ct-api@v1.1.0
  and sunset by CA/B Forum Ballot SC-092).
- Remove internal/lax509 and update docs and linter config.
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