Skip to content

proposal: crypto/tls: support UPKI revocation checking #82402

Open

Description

@cpu

Proposal Details

This proposal describes adding a default-on, offline server certificate revocation checking mechanism to crypto/tls using a local cache conforming to the C2SP upki-revocation specification. After normal certificate verification succeeds, clients consult an available cache and reject leaf certificates reported as revoked. This can only restrict the set of accepted connections, not allow anything that would have been rejected otherwise.

Background

On Linux, the BSDs, and other platforms without native verifier integration, Go loads system roots but verifies certificates itself, without general revocation checking. Go's verifier-selection logic uses native verifiers only on Windows, macOS, and iOS with system roots. Pools created with x509.NewCertPool also use the pure-Go verifier. Even in cases where native verification is used, revocation checking isn't assured. E.g. Go's Windows verifier doesn't request CRL or OCSP checks.

UPKI provides local revocation checking based on Mozilla's CRLite work, as used in Firefox. It supports independent mirrors of Mozilla's compact aggregated CRL information and avoids both per-connection OCSP availability and privacy concerns and the bandwidth/storage costs of individual CRLs. A shared cache lets administrators update revocation data independently of application releases. Under this proposal, applications built with a supporting Go release benefit without code changes.

UPKI has been supported by Canonical, who are already shipping upki as part of Ubuntu 26.10+. Other distros have done similar (e.g. NixOS), or expressed interest (e.g. Redhat). The Go proposal does not require or directly link any upki components. We target the C2SP specification for the revocation cache. It may be populated by a system service invoking the rustls upki CLI tool, or it may be produced by any other spec compliant process (including a future built-in pure-Go option).

The recent October 2026 eMudhra incident helps illustrates the need for a solution for out of band PKI data, particularly for non-browser usecases. While browsers and platform trust services quickly distributed blocks for compromised intermediate CAs, other clients, including Go, needed software or trust-store updates. This proposal covers out of band data for leaf certificate revocations as a stepping stone towards also handling intermediate distrust, and other PKI data not captured by todays "big bag of trust anchor PEM" system CA certificate bundles.

Proposal

Add the following API to crypto/tls:

package tls

type Config struct {
    // Existing fields...

    // UPKIRevocation controls checking server certificates against a local
    // UPKI revocation cache.
    //
    // With the zero value, a platform-default cache is automatically used, if
    // one is available. It rejects certificates reported as revoked, but
    // permits certificates that are not covered by the cache data or contain no
    // embedded SCTs.
    //
    // UPKIRevocation applies only to client-side verification of server
    // certificates.
    UPKIRevocation UPKIRevocationConfig
}

// ErrUPKIRevoked is returned as a wrapped CertificateVerificationError when a certificate is determined to be revoked. 
var ErrUPKIRevoked = errors.new("certificate is revoked according to UPKI")

// UPKIRevocationConfig controls local, offline UPKI revocation checking of
// server certificates.
//
// It doesn't configure downloading or updating revocation data.
type UPKIRevocationConfig struct {
    // Disabled disables UPKI revocation checking, including automatic
    // discovery of a platform-default cache.
    Disabled bool

    // Directory is a C2SP upki-revocation cache directory. It contains
    // index.bin directly.
    //
    // If Directory is empty, platform-default directories are searched for
    // index.bin in user-before-system order. Discovery skips missing paths,
    // non-directory path components, and paths the process lacks permission
    // to open.
    Directory string

    // MissingData controls the result when a lookup needs an index but its
    // path is missing, a parent is not a directory, or access is denied.
    // By default, the connection proceeds if automatic discovery finds no
    // available index. UPKIRevocationPolicyReject requires an available index.
    // Errors reading or parsing an opened index or its filters are fatal.
    MissingData UPKIRevocationPolicy

    // NotCovered controls the result when the revocation data cannot
    // determine a certificate's status, including when covering filters have
    // no information about the certificate's issuer. By default the connection
    // proceeds. UPKIRevocationPolicyReject produces an error if there isn't
    // sufficient coverage to make a revocation determination.
    NotCovered UPKIRevocationPolicy

    // MissingSCTs controls the result when a certificate contains no embedded
    // Signed Certificate Timestamps. A malformed embedded SCT extension is an
    // error if a cache is explicitly configured or found during discovery.
    // By default a certificate without SCTs proceeds without error.
    // UPKIRevocationPolicyReject produces an error if the SCTs required for
    // a revocation determination aren't present.
    MissingSCTs UPKIRevocationPolicy
}

// UPKIRevocationPolicy controls the result of an inconclusive UPKI revocation
// check.
type UPKIRevocationPolicy uint8

const (
    // UPKIRevocationPolicyDefault uses the default for the corresponding
    // UPKIRevocationConfig field.
    UPKIRevocationPolicyDefault UPKIRevocationPolicy = iota

    // UPKIRevocationPolicyAllow allows the connection to proceed when the
    // revocation check is inconclusive for the corresponding reason.
    UPKIRevocationPolicyAllow

    // UPKIRevocationPolicyReject rejects the connection when the revocation
    // check is inconclusive for the corresponding reason.
    UPKIRevocationPolicyReject
)

Separate MissingSCTs and NotCovered policies let a client allow certificates without embedded SCTs, such as private PKI certificates, while requiring conclusive results for certificates with SCTs.

The proposed API surface is deliberately minimal. Standalone X509 certificate revocation checks or APIs for interacting with binary index or clubcard data remain out of scope, and can be offered in third-party packages such as cpu/go-upki.

Default behaviour

Automatic cache discovery defaults to tlsupki=1 for programs targeting Go 1.28 or later and tlsupki=0 for programs targeting Go 1.27 or earlier. By default, the go directive in the main module or workspace determines the target. An explicit Directory applies with either setting.

A zero-valued UPKIRevocationConfig follows these defaults. The inconclusive-result policies are informed by the rustls-upki defaults for integrating upki with Rustls TLS:

Condition Default result UPKIRevocationConfig override
A lookup is needed and no platform-default index is available Allow MissingData: UPKIRevocationPolicyReject
Certificate contains no embedded SCTs Allow MissingSCTs: UPKIRevocationPolicyReject
An explicitly configured index is unavailable when needed, or a selected index is unavailable when reopened during a cache update Reject MissingData: UPKIRevocationPolicyAllow
Certificate or issuer is not covered, including when every index-selected filter reports that it does not cover the SCT Allow NotCovered: UPKIRevocationPolicyReject
Certificate is reported revoked Always reject No per-result override; only Disabled: true.
Certificate is conclusively not revoked Allow None
Embedded SCT extension is malformed and a cache is explicitly configured or found during discovery Reject None while checking is enabled
Reading or parsing an opened index or a filter fails after any cache-update retries Reject None while checking is enabled

A certificate without embedded SCTs follows MissingSCTs before any cache access. For a malformed embedded SCT extension, an explicit Directory makes the error fatal. With automatic discovery, Go reports the SCT error only if it opens an index. If discovery exhausts the candidate directories, MissingData decides whether the handshake proceeds.

A disagreement between the index and a filter's own coverage metadata is treated as an inconclusive answer from that filter, rather than as a cache integrity error. Other selected filters are still consulted. If none can answer conclusively, the result is handled by the NotCovered policy.

Unknown policy values cause a configuration error. Confirmed revocation always rejects the connection unless UPKI checking is disabled entirely, there is no explicit policy to perform revocation checking but ignore a revoked result.

Cache handling

The cache follows C2SP upki-revocation v1.0.0, specifically version 4 clubcard filters and an upkiidx1 index. Embedded Certificate Transparency Signed Certificate Timestamps (SCTs) select covering filters and a revoked result from any covering filter wins. Go will follow the specified lookup and concurrent-update procedure, opening the current index for each check so published updates take effect without restarting the application.

Any conforming producer, including upki fetch, can provision the cache. Go doesn't download updates, execute or link to Rust code, or read the CLI's config.toml. Directory names the directory containing index.bin and the filter files, typically the CLI cache root's revocation child.

Disabled takes precedence over Directory and prevents cache access. With an empty Directory, GODEBUG=tlsupki=0 also disables checking. By default, discovery searches the user cache and then the system cache by opening each candidate's index.bin in the following locations.

Platform User cache System cache
XDG/Unix $XDG_CACHE_HOME/upki/revocation, falling back to $HOME/.cache/upki/revocation /var/cache/upki/revocation
macOS $HOME/Library/Caches/dev.rustls.upki/revocation /Library/Caches/dev.rustls.upki/revocation
Windows %LOCALAPPDATA%\rustls\upki\cache\revocation %ProgramData%\rustls\upki\cache\revocation

Discovery tries the next candidate if the index path is missing, a parent is not a directory, or access is denied. Other open errors fail the check. The first index opened selects the cache, and that file handle is retained for the check. Once a cache is selected, lookup failures do not trigger fallback to another cache. An explicit Directory bypasses discovery.

The producer publishes index.bin atomically after writing the filters it references, as required by C2SP. Index publication therefore makes a cache available for automatic discovery, allowing directories to be created before the initial fetch completes. Discovery is repeated for each check that needs cache data, so a running application picks up the first published index.

The index selects filters using its coverage metadata, but each selected filter also carries its own coverage metadata. If the two disagree, that filter is treated as unable to answer and the remaining selected filters are still queried. A revoked answer from any filter wins, otherwise, if no filter answers conclusively, the check produces the NotCovered result.

With no default cache index, the added cost is attempting to open the candidate indexes. If an index is present, lookup reads index metadata, binary-searches the CT log table, and parses only covering filters. The cost of this check depends on the number and size of clubcards, but will not require scanning every filter.

The producer authenticates updates and maintains freshness. SCT coverage describes issuance times, not revocation data age, so a stale cache can miss later revocations for covered certificates.

TLS verification behaviour

Checking applies only to end-entity server certificates in TLS clients. CRLite covers CT-logged Web PKI certificates, not intermediate certificates or general client authentication.

The check runs after path and hostname verification succeeds and before VerifyPeerCertificate and VerifyConnection.

Before offering resumption, the client rechecks the certificate using verified chains stored in session state and the current cache and policy. If the check fails, the client attempts a full handshake, allowing the server to present a replacement certificate subject to the same checks.

When InsecureSkipVerify disables normal verification, UPKI checking is skipped. On ECH rejection with a nil EncryptedClientHelloRejectionVerify, Go verifies the public-name certificate and applies UPKI even if InsecureSkipVerify is set. A custom rejection callback takes responsibility for verifying that certificate.

Future work

Future proposals could add native pure-Go cache fetching and updates. It's also possible to experiment with checks against an online mirror using HTTP range lookups, with separate privacy and availability considerations. It's expected that further UPKI specifications could support intermediate/root distrust, CT policy, intermediate preloading, and Merkle Tree Certificate landmarks. The vision of upki covers much of this, and an integration with Go for leaf revocation checking is a foundation and not an end-state.

Changelog

2026-10-21 - Initial proposal text
2026-10-26 - Integrated feedback from jnsgruk (index.bin check vs empty dir, config as pointer).
2026-11-14 - Tweaked the wording of the UPKIRevocationConfig.NotCovered field to clarify not covered status. Added exported ErrUPKIRevoked sentinel for use with CertificateVerificationError when a TLS operation fails because UPKI determined the leaf certificate was revoked.
2026-11-16 - Treated disagreement between index and filter coverage metadata as NotCovered rather than a cache integrity error.
2026-11-17 - Extended MissingData to unavailable indexes during discovery and explicit lookups. Clarified when malformed embedded SCTs fail verification and when UPKI checks the ECH public-name certificate.
2026-11-19 - Restored non-pointer config field, explicitly mentioned defaults in config field comments.

Activity

  1. added this to the Proposal milestone on Oct 21, 2026
  2. changed the title [-]Proposal: crypto/tls: support UPKI revocation checking[/-] [+]proposal: crypto/tls: support UPKI revocation checking[/+] on Oct 22, 2026
  3. hpidcock commented on Oct 22, 2026

    @hpidcock

    I support the intent of this. From the perspective of introducing this into the tls.Config as either opt-in/opt-out, I would hope this does not confuse verification with revocation checking. I've seen many dangerous uses of VerifyPeerCertificate/VerifyConnection (and InsecureSkipVerify) that gives me concerns, and hope that serious consideration is given to ensure there is no confusion (good naming and documentation).

    Even if the proposal to add UPKI revocation checking is rejected, I would hope that tls.Config can gain the ability to plug in a revocation check callback, as to not force developers to use VerifyPeerCertificate/VerifyConnection.

    This is roughly what I would consider a good starting point for this.

    type Config struct {
        // ...
        // InvalidatePeerCertificate is called to establish if a certificate should be considered to be trustworthy.
        // If false is returned without an error, the certificate can be used to establish trust.
        // Returning true without an error prevents this certificate from being used to establish trust.
        // Returning any error prevents the connection from proceeding.
        // InvalidatePeerCertificate is called for every certificate in the chain from leaf to root.
        InvalidatePeerCertificate func(rawCert []byte, cert *x509.Certificate) (bool, error)
        // ...
    }
  4. cpu commented on Oct 22, 2026

    @cpu
    MemberAuthor

    I support the intent of this

    Great, thanks for taking a look :-)

    I would hope this does not confuse verification with revocation checking.

    Definitely not. This is all entirely post-verification.

    hope that serious consideration is given to ensure there is no confusion (good naming and documentation).

    Feedback on the proposed naming and documentation in the triple backtick code in the "Proposal" section is welcome. I think I've named and documented things sufficiently to avoid this confusion but if you have concrete suggestions on improvements I can consider them.

    This is roughly what I would consider a good starting point for this.

    Thank you, but I think this is off-topic for this proposal, which is specifically focused on built-in revocation checking that can be offered by default without application changes or opt-in. If the proposal fails for some reason you could start a new proposal for an alternative callback mechanism for invalid peer certs.

  5. jnsgruk commented on Oct 25, 2026

    @jnsgruk

    Thank you for putting this together @cpu!

    The proposal distinguishes between:

    • No default cache directory: skip checking.
    • An existing cache with no data: reject when a lookup is needed.

    This might pose a timing issue on Ubuntu. The packaging creates /var/cache/upki/revocation before the first successful fetch, which is scheduled by a timer after boot. As I understand it, connections requiring a lookup would therefore fail during that initial window, potentially longer if the fetch fails.

    Perhaps this is an acceptable trade-off, or something we should address in the packaging, but I thought it worth highlighting. Should automatic discovery consider a cache available only once its initial index has been published?

    Relatedly, the proposal selects the first existing cache, preferring the user cache over the system cache. Am I right that an empty user cache would therefore cause rejection when a lookup is needed, even if a populated system cache exists? A stale user cache could also shadow a more current system cache. Is that precedence intentional regardless of the caches' relative freshness?

    Finally, could the new struct entry be a pointer, to avoid people from having to carry the whole struct if they just want to opt out, for example?

    // Proposed change
    type Config struct {
        // Nil uses automatic UPKI checking with default policies.
        UPKIRevocation *UPKIRevocationConfig
    }
    
    // App developer can then opt out with
    cfg := &tls.Config{
        UPKIRevocation: &tls.UPKIRevocationConfig{
            Disabled: true,
        },
    }

    That would avoid embedding the full UPKI configuration in every tls.Config, while retaining default-on behaviour and an explicit Disabled option. There seems to be some precedent in RootCAs *x509.CertPool, where nil selects the system roots.

  6. cpu commented on Oct 26, 2026

    @cpu
    MemberAuthor

    Thanks for the feedback @jnsgruk, very helpful 🙇

    This might pose a timing issue on Ubuntu. The packaging creates /var/cache/upki/revocation before the first successful fetch, which is scheduled by a timer after boot. As I understand it, connections requiring a lookup would therefore fail during that initial window, potentially longer if the fetch fails.

    Perhaps this is an acceptable trade-off, or something we should address in the packaging, but I thought it worth highlighting. Should automatic discovery consider a cache available only once its initial index has been published?

    I like the suggestion of using the index as the indicator rather than the directory, that seens workable and integrates well with the C2SP spec's requirement for how the dir is populated. As a side note, I think the rustls-upki default policy has the same issue, but the reference C FFI OpenSSL callback allows UPKI_ERR_REVOCATION_NO_DATA and so would just not perform any revocation checking in the empty directory case. We should maybe consider adjusting the rustls-upki verifier at the same time to avoid the same race for the Rust ecosystem. I'll take that upstream separately.

    Relatedly, the proposal selects the first existing cache, preferring the user cache over the system cache. Am I right that an empty user cache would therefore cause rejection when a lookup is needed, even if a populated system cache exists? A stale user cache could also shadow a more current system cache. Is that precedence intentional regardless of the caches' relative freshness?

    That's correct. I think that matches the typical XDG semantics. I think if we adjust the empty directory behaviour (keying on index.bin) then we don't need to worry about it as much and would fall back to the system dir.

    W.r.t freshness, I don't want to start imposing policy on that. File modification time alone won't be a great signal, and in either case I believe strongly we should "fail open" for stale data (not erroring) to avoid a situation like the one that befell some lower quality Android certificate transparency implementations.

    Finally, could the new struct entry be a pointer, to avoid people from having to carry the whole struct if they just want to opt out, for example?

    I think that's a reasonable idea 👍

    Since this feedback is arriving pretty quickly after the initial proposal I'm going to edit the first proposal text vs re-stating here, with a note about what changed pointing to this comment.

  7. philhofer commented on Oct 27, 2026

    @philhofer
    Contributor

    Thanks for proposing this. It's pretty clear we need something to help ensure that certificate revocations are expected.

    I've rolled out upki revocation checking in a limited capacity in our production servers to see what is covered, what breaks, etc. My first reaction is that, at least today, there is a small but nonetheless very significant fraction of the internet that is not covered under CRLite, which somewhat limits its usefulness. It appears that the lag is a known issue (mozilla/crlite#392 (comment)). But, 112 days of lag for Google Xenon2026h2 (as of Oct 2nd) is a pretty big deal IMO. As of this writing, the cert for google.com is covered, but www.google.com is not, and the leaf cert for the latter is nearly one month old.

    Does Mozilla have a target SLA for incorporating CT logs and CRLs?

  8. djc commented on Oct 27, 2026

    @djc

    I've rolled out upki revocation checking in a limited capacity in our production servers to see what is covered, what breaks, etc. My first reaction is that, at least today, there is a small but nonetheless very significant fraction of the internet that is not covered under CRLite, which somewhat limits its usefulness. It appears that the lag is a known issue (mozilla/crlite#392 (comment)). But, 112 days of lag for Google Xenon2026h2 (as of Oct 2nd) is a pretty big deal IMO. As of this writing, the cert for google.com is covered, but www.google.com is not, and the leaf cert for the latter is nearly one month old.
    Does Mozilla have a target SLA for incorporating CT logs and CRLs?

    As I understand the limitation is mostly with upstream CT logs. But, static CT logs are replacing RFC 6962 logs in the next ~year so, AIUI, this should significantly alleviate the rate limiting issues Mozilla has when reading CT logs.

  9. aclements commented on Nov 4, 2026

    @aclements
    Member

    Proposal review discussion:

    • At a high level, we're totally supportive of integrating with UPKI. We haven't yet looked at the details of the proposed API.
  10. aclements commented on Nov 4, 2026

    @aclements
    Member

    This proposal has been added to the active column of the proposals project
    and will now be reviewed at the weekly proposal review meetings.
    — aclements for the proposal review group

  11. moved this to Active in Proposalson Nov 4, 2026
  12. aclements commented on Nov 11, 2026

    @aclements
    Member

    Proposal review discussion:

    • This seems like something we should do and the API seems basically right. Main concern is that UPKI is still a bit of a moving target. But there's probably not anything in the API design that would be affected by future changes to UPKI. Based on @rolandshoemaker 's conversations with Canonical, they're very aware of the pain that would be caused by changing any of the on-disk format.
  13. aclements commented on Nov 11, 2026

    @aclements
    Member

    @cpu is the implementation of this ready to go and just waiting on the proposal?

  14. 2 remaining items

  15. gopherbot commented on Nov 16, 2026

    @gopherbot
    Contributor

    Change https://go.dev/cl/863406 mentions this issue: crypto/tls: add UPKI revocation checking

  16. cpu commented on Nov 16, 2026

    @cpu
    MemberAuthor

    I could open a stack of draft CLs in the next few days that could be ready for early review alongside proposal approval.

    This is done, starting with https://go-review.googlesource.com/c/go/+/864541

    Along the way I also made two proposal tweaks based on the implementation experience. Both reflected in the initial proposal comment and summarized in the changelog at the end:

    2026-11-14 - Tweaked the wording of the UPKIRevocationConfig.NotCovered field to clarify not covered status. Added exported ErrUPKIRevoked sentinel for use with CertificateVerificationError when a TLS operation fails because UPKI determined the leaf certificate was revoked.
    2026-11-16 - Treated disagreement between index and filter coverage metadata as NotCovered rather than a cache integrity error.

    Lastly, I also added a CL at the end of the WIP stack that adds a GODEBUG toggle. GODEBUG=tlsupki=0 would disable UPKI revocation checks for configurations that rely on platform-default cache discovery. A config that named a cache directory explicitly would be unaffected by the GODEBUG. I've separated that addition since it wasn't part of the proposal. Should it be? It feels like since we're enabling new checks by default without code change that it's prudent to also have a way to avoid the new code without an application change.

  17. cpu commented on Nov 18, 2026

    @cpu
    MemberAuthor

    Updated based on some feedback from the CL stack, and rolled in the GODEBUG:

    2026-11-17 - Extended MissingData to unavailable indexes during discovery and explicit lookups. Clarified when malformed embedded SCTs fail verification and when UPKI checks the ECH public-name certificate.

  18. cpu commented on Nov 18, 2026

    @cpu
    MemberAuthor

    For broader information on common questions about upki, I also created a FAQ that might be helpful for readers of the proposal.

  19. moved this from Active to Likely Accept in Proposalson Nov 19, 2026
  20. aclements commented on Nov 19, 2026

    @aclements
    Member

    Based on the discussion above, this proposal seems like a likely accept.
    — aclements for the proposal review group

    The proposal is given in #82402 (comment)

  21. FiloSottile commented on Nov 19, 2026

    @FiloSottile
    Contributor

    Love this. Minor nit: why is Config.UPKIRevocation a pointer? There is no semantic difference between nil and zero anyway, and UPKIRevocationConfig carries no state. I'd revert it to a non-pointer.

  22. cpu commented on Nov 19, 2026

    @cpu
    MemberAuthor

    I'd revert it to a non-pointer.

    Done, and also clarified the default behaviours on the config struct field Godoc comments.

  23. reopened this on Nov 20, 2026
  24. cpu commented on Nov 20, 2026

    @cpu
    MemberAuthor

    gopherbot closed this as completedin ec1f7332m ago
    cpu reopened this 1m ago

    I merged the CLs ahead of the 1.28 freeze after confirming OOB this is OK for a likely accept status proposal on the condition that it be backed out if necessary. Leaving this open until the proposal process is completed.

  25. added a commit that references this issue on Nov 20, 2026
    ec1f733
  26. dyhkwong commented on Nov 23, 2026

    @dyhkwong
    Contributor

    None of those default cache directories exist on Android. Any chance for an alternative such as environment variable?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    • Status
      Likely Accept

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions