rustls / rustls/rcgen

Rework X509 extension code

Open
#446 0 comments 0 reactions 1 assignee View on GitHub

@cpu is already working on this.

Since Aug 11, 2026.

next-major-release
Dominant language
Rust
Stars
505
Forks
157
Avg merge
39m
Merged PRs (30d)
1

Description

The extension-writing code currently duplicates each extension's presence condition away from the code that encodes it (e.g. the should_write_exts gate vs. write_extensions), which has already produced bugs where requested extensions were silently dropped.

I think we should rework this to represent extensions with an internal Extension trait implemented once per extension type, with per-type from_params constructors so presence logic lives beside encoding, plus an Extensions collection that rejects duplicate OIDs (fixing https://github.com/rustls/rcgen/issues/155) and only emits the outer extensions wrapper when the built collection is non-empty. This would make emptiness observed rather than predicted, and eliminating the gate-drift bug class.

I had started on some of this in a very stale WIP branch and we should revive that before a next major release.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.