Skip to content

Replace the committed .der TLS fixtures with generated ones #368

Open

Description

@SDL-A1

crates/cli/testdata/tls/ holds seven committed binary files used by the
public_ip TLS tests, three of which are private keys:

ca.der             375 B   CN=ca test root
localhost.der      382 B   CN=localhost
other.der          382 B   CN=other
untrusted.der      385 B   CN=untrusted
localhost.key.der  138 B
other.key.der      138 B
untrusted.key.der  138 B

They are what they claim to be — I parsed each one: self-signed, correct
subjects for the trusted / wrong-hostname / untrusted cases, valid
2026-11-14 to 2126-10-21. The hundred-year validity deliberately avoids the
usual trap of committed test certificates silently expiring and breaking CI
years later.

Why change them anyway

They cannot be reviewed. A reviewer sees seven opaque files and has to
take on trust that they are minimal self-signed certificates. That is fine
once, when someone has just parsed them; it is not fine as a standing
property of the repository.

They cannot be regenerated. There is no script. If a test ever needs a
different SAN, a different key algorithm, or a fifth certificate, there is
no way to produce a matching set.

Three of them are private keys. Worthless ones, but committing key
material trains the wrong habit and trips secret scanners.

Two options, and a recommendation

PEM plus a committed gen-certs.sh — recommended. The files become
text, openssl x509 -text reads them, the script makes them reproducible,
and it adds no dependencies.

Generate at runtime with rcgen as a dev-dependency. Cleaner still — the
properties under test become readable in the test source rather than hidden
in a file — but it pulls roughly three to eight crates into the dev tree to
remove 1.9 KB of fixtures that have been verified harmless. For a project
that has just tightened its stance on dependency surface, that is a worse
trade than it first appears.

Either is an improvement. The first is the smaller change and the one I would
take.

Context

Arrived with #365. Not a defect in that pull request, which was reviewed and
merged on its merits — this is the follow-up it earned.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions