- C-1: SelfSignedCert + generate_self_signed_cert document the rcgen-default validity (1975→4096, never expires in practice), no SANs (CA verification fails as designed — pairs with SHA256: pinning), and the additive not_before/not_after route if tighter validity is ever wanted - C-4: RemoteIdentity::fingerprint + FingerprintPinVerifier document case-/format-exactness (pins produced by fingerprint_from_cert_der, lowercase hex, exact ed25519:/SHA256: prefixes); written from the ADR-007-corrected chain — same-format-but-wrong pins fail closed at the pin compare, cross-format mismatches fail earlier at cert-type negotiation (the review's original pin-compare mechanism superseded) - N-3: TlsServerConfig doc records the keep-non-Clone-for-v1 decision (API identical across feature configurations; conditional Clone is its own trap); N-3 closed in review 001 - N-4: "Client-cert-type negotiation" section on VerifyPresentedCertVerifier (cross-referenced from AcceptAnyCertVerifier): requires_raw_public_keys() stays trait-default false on both server verifiers — do not fix to true (rejects X.509 clients); the raw-only-offer rejection can only arise from a foreign resolver with only_raw_public_keys() == true — interop boundary of the request-not-require shape, fail-closed, not a downgrade; pinned by server_verifiers_keep_requires_raw_public_keys_default_false - Work item 5: FingerprintPinVerifier's pop cross-ref now names both server verifiers (default VerifyPresentedCertVerifier verifies per ADR-008; AcceptAnyCertVerifier escape hatch does not) Verification: cargo test (default, 69 lib tests) and --all-features (78 lib tests, 1 new), clippy --all-targets --all-features -D warnings, fmt --check, doc --no-deps warning-free — all green
13 KiB
13 KiB
id, name, status, depends_on, scope, risk, impact, level, tags
| id | name | status | depends_on | scope | risk | impact | level | tags | ||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| docs-pin-c1-c4-n3-n4 | Docs + pin batch — self-signed validity, fingerprint pin format-exactness, Clone-under-no-acme, cert-type negotiation note (C-1, C-4, N-3, N-4) | completed | narrow | low | component | implementation |
|
Description
Four doc/doc+pin findings that close as rustdoc (plus one decided question):
- C-1 —
generate_self_signed_cert()produces a cert valid 1975→4096 (rcgen'sCertificateParams::default()— verified against rcgen 0.13.2 source, certificate.rs:94-96) and has no SANs. "Dev cert" silently meaning "never expires" is a documented-behavior gap. One doc line ongenerate_self_signed_cert(andSelfSignedCert): the generated cert never expires in practice, carries no SANs, and pins against CA verification by design; if a tighter validity is ever wanted,not_before/not_afterare additive params. - C-4 —
RemoteIdentity::fingerprintaccepts any string and the pin comparison is exact-string (src/client.rs:293): uppercase-hex pins,sha256:lowercase prefix, and cross-prefix pins (SHA256:-of-an-ed25519-remote) construct fine and reject at handshake — fail-closed, never a downgrade, but a config-author trap. Doc line onRemoteIdentity::fingerprint(and/orFingerprintPinVerifier): pins must be produced byfingerprint_from_cert_der— case- and format-exact (ed25519:<lowercase hex>/SHA256:<lowercase hex>); malformed pins fail closed at handshake. Update for ADR-007 (commit49d4432): the pin format is no longer only a verification selector — it also selects the cert-type offer (ed25519:→ offer[RawPublicKey],SHA256:→ default X.509 offer), and a cross-format mismatch now fails earlier, at cert-type negotiation, before the pin compare is even reached (pinned bytests/handshake_behavior.rs:ed25519_pin_against_x509_server_fails_closed_at_negotiation). The review's original C-4 mechanism ("rejected at pin comparison") is superseded — same fail-closed verdict, earlier failure point. Write the doc line from that chain: mismatched format fails at negotiation (a config error, ADR-007); same-format-but-wrong pins (case, garbage) construct and fail at the pin compare. - N-3 —
TlsServerConfigis notCloneeven underdefault = []where the struct has noJoinHandlefield. The all-features posture is what the API freeze pins (conditionalCloneis its own trap: an API difference between feature configurations). Decision: keep non-Clone for v1; record the reasoning in the type's doc (one sentence) and close the question — revisit only with a concrete consumer demanding it. - N-4 — re-scoped 2026-09-12: the mechanism analysis this item
originally asked for is already documented. ADR-007
(
docs/architecture/decisions/007-cert-type-negotiation.md, commit49d4432) records the whole negotiation chain, andRawKeyClientCertResolver's doc block (src/client.rs:152-171) carries the client-side mechanism note (only_raw_public_keys() == false→ X.509 offer; the(false, true, false)arm reasoning). Do not re-derive or duplicate that analysis. What remains is a short server-verifier note (a sibling section in theAcceptAnyCertVerifierandVerifyPresentedCertVerifierdocs, or one shared paragraph referenced from both):requires_raw_public_keys()staysfalseon both server verifiers — do not "fix" it totrue(that would reject X.509 clients; the request-but-don't-require shape accepts both cert types).- Post-ADR-007, the crate's own
RawKeyClientCertResolverpresents the SPKI under the X.509 offer unconditionally (client.rs:187,raw_public_keys: false), so a raw-key client against this crate's servers never sends a raw-only offer. TheIncorrectCertificateTypeExtensionrejection of a raw-only client offer ((false, true, false)arm) can now only arise from a foreign rustls resolver that setsonly_raw_public_keys() == true— state it as an interop boundary of the request-not-require shape, fail-closed, not a downgrade. - A raw-key server presentation (
RawKeyCertResolver,only_raw_public_keys() == trueon the server-cert side) is the other knob (server_certificate_types) and is unaffected. Without the note, the next reader may "fix" the verifier totrueand break X.509 clients, or mis-diagnose a foreign raw-only client failure as a bug.
Work
- C-1 doc lines (
generate_self_signed_cert+SelfSignedCert). - C-4 doc lines (
RemoteIdentity::fingerprint,FingerprintPinVerifier— format-exactness + fail-closed, with the ADR-007 negotiation-earlier failure point per the Description). - N-3: the one-sentence decision note on
TlsServerConfig's doc; close N-3 in the review's finding list (no code change). - N-4: the short server-verifier negotiation note per the re-scoped
item 4 in the Description (a sibling section on
AcceptAnyCertVerifier+VerifyPresentedCertVerifier, or one shared paragraph referenced from both). If desired, add a pinned unit test assertingrequires_raw_public_keys() == falsestays default (it's a trait default — the test just documents the choice). - While in these docs:
FingerprintPinVerifier's pop cross-ref (src/client.rs:253-255) currently says only "the server-sideAcceptAnyCertVerifierdoes not [verify possession]" — post-ADR-008 the default server verifierVerifyPresentedCertVerifierdoes; mention both (the default verifies, the escape hatch does not). - Cross-check the review's finding numbering so each doc change cites its finding.
Verification
- All four doc notes exist and render (
cargo doc --no-depswarning-free) - The N-3 decision is recorded (doc + this task's Summary)
- No code-behavior change beyond an optional unit pin
cargo test, clippy, fmt, doc green
Acceptance Criteria
- A config author reading the rustdoc cannot mis-case a pin, pin the wrong prefix, or expect a never-expiring dev cert to expire
- The raw-only-client interop boundary is documented before a consumer hits it (short note per the re-scope; the full mechanism lives in ADR-007)
References
- docs/reviews/001-implementation-review.md §C-1, §C-4, §N-3, §N-4 (§N-4 — the correction blocks are historical context now; ADR-007 is the authoritative record of the negotiation mechanism), and the §Status block
- src/server.rs:223-257 (the self-signed helper +
SelfSignedCert), src/server.rs:18-24 (TlsServerConfig— where the N-3 note goes), src/client.rs:253-255 (the pop cross-ref), src/credentials.rs:36-38 (RemoteIdentity::fingerprint), src/identity.rs (SelfSigned doc) - ADR-007 (
docs/architecture/decisions/007-cert-type-negotiation.md) — the authoritative negotiation record; ADR-008 (the verifier default change that makesVerifyPresentedCertVerifierpart of the N-4 note) - rustls 0.23.44
server/hs.rs::process_cert_type_extension(the negotiation table) andclient/hs.rs(the[RawPublicKey]-only offer rule) — consult only if extending the analysis beyond what ADR-007 records - tests/impersonation_posture.rs (its fixed resolver pins
only_raw_public_keys() == false— post-ADR-007 that is also the crate resolver's unconditional shape), tests/handshake_behavior.rs (ed25519_pin_against_x509_server_fails_closed_at_negotiation— the negotiation fail-closed pin)
Notes
- C-1: doc blocks added on both
SelfSignedCertandgenerate_self_signed_cert(src/server.rs): the cert is valid 1975→4096 (rcgen 0.13'sCertificateParams::default()) — never expires in practice — carries no SANs, so CA verification of it fails as expected; it pairs withSHA256:fingerprint pinning (a pin that outlives any plausible deployment by design) and can never fail the way an ACME/ops-managed cert can;not_before/not_afterare additive if tighter validity is ever wanted. Thecert_chainfield doc repeats the validity/no-SAN facts briefly. - C-4: two doc blocks written from the ADR-007-corrected chain:
RemoteIdentity::fingerprint(src/credentials.rs): the pin must be produced byfingerprint_from_cert_der, case- and format-exact (lowercase hex,ed25519:/SHA256:prefixes); same-format-but-wrong pins (uppercase hex, lowercasesha256:, garbage) construct and fail closed at the pin compare; mismatched format fails earlier, at cert-type negotiation (ADR-007), before the pin compare is reached — same fail-closed verdict, earlier failure point.FingerprintPinVerifier(src/client.rs): a "The pin is case- and format-exact" section covering the same chain from the verifier's side (exact-string compare; the pin format also selects the server cert-type offer per ADR-007, so a wrong-format pairing aborts at negotiation).
- N-3: one decision paragraph added to
TlsServerConfig's doc (src/server.rs): notClonefor v1, kept so the API is identical across feature configurations (conditionalClonewould be an API difference between feature sets); share viaArc, revisit only if a concrete consumer demands it. N-3 closed in review 001 (docs/reviews/001-implementation-review.md§N-3 remediation status, plus a status-block note). - N-4: a "Client-cert-type negotiation (ADR-007, review 001 §N-4)"
section added on
VerifyPresentedCertVerifier(the default verifier), stating:requires_raw_public_keys()stays on the trait defaultfalseon both server verifiers — do not "fix" it totrue(that would reject every X.509 client); the crate's ownRawKeyClientCertResolverpresents the SPKI under the X.509 offer unconditionally, so a raw-only client offer rejection (IncorrectCertificateTypeExtension, rustlsserver/hs.rs::process_cert_type_extension's(false, true, false)arm) can only arise from a foreign resolver withonly_raw_public_keys() == true— an interop boundary of the request-not-require shape, fail-closed, not a downgrade; the raw-key server side (RawKeyCertResolver,server_certificate_types) is the other knob and unaffected.AcceptAnyCertVerifiercarries a cross-reference paragraph ("the same shape and rationale apply verbatim") instead of a duplicate. No mechanism re-derivation — ADR-007 stays the authoritative record. Pinned by a new unit testserver_verifiers_keep_requires_raw_public_keys_default_false(src/server.rs tests) asserting the trait-defaultfalseon both verifiers. - Work item 5 (pop cross-ref):
FingerprintPinVerifier's closing paragraph now says the defaultVerifyPresentedCertVerifierverifies possession (ADR-008, resolving OQ-TLS-09) and theAcceptAnyCertVerifierescape hatch does not — the pre-ADR-008 sentence that named onlyAcceptAnyCertVerifieris gone. - Work item 6 (finding citations): every doc block names its finding (§C-1, §C-4, §N-3, §N-4) and review 001's status block records the batch closure, including the §C-4 supersession note.
- Review 001 updates: §N-3 marked "closed by decision"; Status block gained a "Status update (2026-09-12, docs-pin batch)" paragraph.
- ADR-007 doc-link style note: rustdoc renders the
../docs/architecture/decisions/007-cert-type-negotiation.mdrelative links fromsrc/credentials.rs/src/server.rs; verified present in the rendered HTML (cargo doc --no-depswarning-free, links resolve to the repo file path).
Summary
All four doc/doc+pin findings closed as rustdoc (plus one decided question), no code-behavior change beyond the optional unit pin:
src/server.rs— C-1 validity/no-SAN facts onSelfSignedCert+generate_self_signed_cert; N-3 one-sentence non-Clone decision onTlsServerConfig; N-4 "Client-cert-type negotiation" section onVerifyPresentedCertVerifier+ cross-ref onAcceptAnyCertVerifier; new pinned unit testserver_verifiers_keep_requires_raw_public_keys_default_false(asserts the trait-defaultfalseon both server verifiers).src/credentials.rs— C-4 format-exactness block onRemoteIdentity::fingerprint(pin produced byfingerprint_from_cert_der; same-format-but-wrong → pin-compare rejection; cross-format → ADR-007 negotiation abort).src/client.rs— C-4 "case- and format-exact" section onFingerprintPinVerifier(with the ADR-007 offer-selection chain); work item 5: the pop cross-ref now names both server verifiers (default verifies per ADR-008, escape hatch does not).docs/reviews/001-implementation-review.md— §N-3 closed by decision; Status block records the C-1/C-4/N-3/N-4 closure and the §C-4 mechanism supersession.
Verification: cargo test (default, 69 lib + integration) and
cargo test --all-features (78 lib tests, new pin test passing),
cargo clippy --all-targets --all-features -- -D warnings,
cargo fmt --check, cargo doc --no-deps warning-free — all green.