tls: emit context-bearing webpki unsupported-signature errors#6436
Closed
caniko wants to merge 1 commit into
Closed
tls: emit context-bearing webpki unsupported-signature errors#6436caniko wants to merge 1 commit into
caniko wants to merge 1 commit into
Conversation
Replace the parameterless UnsupportedSignatureAlgorithm{,ForPublicKey}
variants with the *Context forms carrying the offending signature
algorithm id (and public-key algorithm id where applicable), so
verification failures surface the actual OID rather than a bare enum.
The *Context variants were added in rustls-webpki v0.103.9; bump the
crate's webpki dep range from "0.103" to "0.103.9" and update the
workspace lockfile so default builds resolve a compatible version.
Adds regression tests:
- `nistp384_sha256` now asserts the returned error is
`UnsupportedSignatureAlgorithmContext` and carries a non-empty
`signature_algorithm_id` plus the supported-algorithm list.
- `signature_scheme_mismatch_carries_both_oids` exercises
`verify_signature` against a scheme that does not match the cert's
public key and asserts both algorithm-id payloads.
Member
|
Hi, I addressed this in #6355 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Replace
webpki::Error::UnsupportedSignatureAlgorithmandUnsupportedSignatureAlgorithmForPublicKey(parameterless variants) with thecontext-bearing
UnsupportedSignatureAlgorithmContext/UnsupportedSignatureAlgorithmForPublicKeyContextforms at every return sitein
transports/tls/src/certificate.rs.Today, a libp2p TLS handshake that rejects a certificate's signature scheme
surfaces a bare enum variant with no payload — diagnosing why two peers fail
to handshake requires reproducing the error path in a debugger. With this
change, the error carries the offending signature-algorithm OID (and the
public-key-algorithm OID where applicable), so logs and bug reports can name
the algorithm directly.
The
signature_algorithm_idbytes follow the convention already used byrustls-webpki's own population sites and therustls_pki_types::alg_id::*constants: the DER contents of the
AlgorithmIdentifierSEQUENCE (OIDfollowed by parameters), without the outer SEQUENCE tag/length.
The
*Contextvariants were added inrustls-webpki v0.103.9, so thecrate's dep range is tightened from
"0.103"to"0.103.9"and theworkspace lockfile is bumped accordingly.
Notes & open questions
SUPPORTED_SIGNATURE_ALGORITHMSis hardcoded to mirror whatsignature_scheme()already accepts (RSA-PKCS1 SHA-{256,384,512},ECDSA-SHA-{256,384}, RSA-PSS-SHA-{256,384,512}, Ed25519). ECDSA-P521 and
Ed448 are intentionally excluded because they're explicitly rejected
downstream in
verify_signature.payloads are non-empty; they don't decode the OIDs back to dotted form,
because the wire format is the same opaque byte slice that webpki and
rustls consumers compare against
alg_id::*constants.Change checklist