rustls/webpki/client_verifier.rs
1use alloc::vec::Vec;
2
3use pki_types::CertificateRevocationListDer;
4use webpki::{
5 CertRevocationList, ExpirationPolicy, ExtendedKeyUsage, RevocationCheckDepth,
6 UnknownStatusPolicy,
7};
8
9use super::{VerifierBuilderError, pki_error};
10#[cfg(doc)]
11use crate::ConfigBuilder;
12#[cfg(doc)]
13use crate::crypto;
14use crate::crypto::{CryptoProvider, Identity, SignatureScheme, WebPkiSupportedAlgorithms};
15use crate::error::ApiMisuse;
16#[cfg(doc)]
17use crate::server::ServerConfig;
18use crate::sync::Arc;
19use crate::verify::{
20 ClientIdentity, ClientVerifier, DistinguishedName, HandshakeSignatureValid, NoClientAuth,
21 PeerVerified, SignatureVerificationInput,
22};
23use crate::webpki::parse_crls;
24use crate::webpki::verify::{ParsedCertificate, verify_tls12_signature, verify_tls13_signature};
25use crate::{Error, RootCertStore};
26
27/// A builder for configuring a `webpki` client certificate verifier.
28///
29/// For more information, see the [`WebPkiClientVerifier`] documentation.
30#[derive(Debug, Clone)]
31pub struct ClientVerifierBuilder {
32 roots: Arc<RootCertStore>,
33 root_hint_subjects: Vec<DistinguishedName>,
34 crls: Vec<CertificateRevocationListDer<'static>>,
35 revocation_check_depth: RevocationCheckDepth,
36 unknown_revocation_policy: UnknownStatusPolicy,
37 revocation_expiration_policy: ExpirationPolicy,
38 anon_policy: AnonymousClientPolicy,
39 supported_algs: WebPkiSupportedAlgorithms,
40}
41
42impl ClientVerifierBuilder {
43 pub(crate) fn new(
44 roots: Arc<RootCertStore>,
45 supported_algs: WebPkiSupportedAlgorithms,
46 ) -> Self {
47 let root_hint_subjects = roots.subjects();
48 Self {
49 roots,
50 root_hint_subjects,
51 crls: Vec::new(),
52 revocation_check_depth: RevocationCheckDepth::Chain,
53 unknown_revocation_policy: UnknownStatusPolicy::Deny,
54 revocation_expiration_policy: ExpirationPolicy::Ignore,
55 anon_policy: AnonymousClientPolicy::Deny,
56 supported_algs,
57 }
58 }
59
60 /// Clear the list of trust anchor hint subjects.
61 ///
62 /// By default, the client cert verifier will use the subjects provided by the root cert
63 /// store configured for client authentication. Calling this function will remove these
64 /// hint subjects, indicating the client should make a free choice of which certificate
65 /// to send.
66 ///
67 /// See [`ClientVerifier::root_hint_subjects`] for more information on
68 /// circumstances where you may want to clear the default hint subjects.
69 pub fn clear_root_hint_subjects(mut self) -> Self {
70 self.root_hint_subjects = Vec::default();
71 self
72 }
73
74 /// Add additional [`DistinguishedName`]s to the list of trust anchor hint subjects.
75 ///
76 /// By default, the client cert verifier will use the subjects provided by the root cert
77 /// store configured for client authentication. Calling this function will add to these
78 /// existing hint subjects. Calling this function with empty `subjects` will have no
79 /// effect.
80 ///
81 /// See [`ClientVerifier::root_hint_subjects`] for more information on
82 /// circumstances where you may want to override the default hint subjects.
83 pub fn add_root_hint_subjects(
84 mut self,
85 subjects: impl IntoIterator<Item = DistinguishedName>,
86 ) -> Self {
87 self.root_hint_subjects.extend(subjects);
88 self
89 }
90
91 /// Verify the revocation state of presented client certificates against the provided
92 /// certificate revocation lists (CRLs). Calling `with_crls` multiple times appends the
93 /// given CRLs to the existing collection.
94 ///
95 /// By default all certificates in the verified chain built from the presented client
96 /// certificate to a trust anchor will have their revocation status checked. Calling
97 /// [`only_check_end_entity_revocation`][Self::only_check_end_entity_revocation] will
98 /// change this behavior to only check the end entity client certificate.
99 ///
100 /// By default if a certificate's revocation status can not be determined using the
101 /// configured CRLs, it will be treated as an error. Calling
102 /// [`allow_unknown_revocation_status`][Self::allow_unknown_revocation_status] will change
103 /// this behavior to allow unknown revocation status.
104 pub fn with_crls(
105 mut self,
106 crls: impl IntoIterator<Item = CertificateRevocationListDer<'static>>,
107 ) -> Self {
108 self.crls.extend(crls);
109 self
110 }
111
112 /// Only check the end entity certificate revocation status when using CRLs.
113 ///
114 /// If CRLs are provided using [`with_crls`][Self::with_crls] only check the end entity
115 /// certificate's revocation status. Overrides the default behavior of checking revocation
116 /// status for each certificate in the verified chain built to a trust anchor
117 /// (excluding the trust anchor itself).
118 ///
119 /// If no CRLs are provided then this setting has no effect. Neither the end entity certificate
120 /// or any intermediates will have revocation status checked.
121 pub fn only_check_end_entity_revocation(mut self) -> Self {
122 self.revocation_check_depth = RevocationCheckDepth::EndEntity;
123 self
124 }
125
126 /// Allow unauthenticated clients to connect.
127 ///
128 /// Clients that offer a client certificate issued by a trusted root, and clients that offer no
129 /// client certificate will be allowed to connect.
130 pub fn allow_unauthenticated(mut self) -> Self {
131 self.anon_policy = AnonymousClientPolicy::Allow;
132 self
133 }
134
135 /// Allow unknown certificate revocation status when using CRLs.
136 ///
137 /// If CRLs are provided with [`with_crls`][Self::with_crls] and it isn't possible to
138 /// determine the revocation status of a certificate, do not treat it as an error condition.
139 /// Overrides the default behavior where unknown revocation status is considered an error.
140 ///
141 /// If no CRLs are provided then this setting has no effect as revocation status checks
142 /// are not performed.
143 pub fn allow_unknown_revocation_status(mut self) -> Self {
144 self.unknown_revocation_policy = UnknownStatusPolicy::Allow;
145 self
146 }
147
148 /// Enforce the CRL nextUpdate field (i.e. expiration)
149 ///
150 /// If CRLs are provided with [`with_crls`][Self::with_crls] and the verification time is
151 /// beyond the time in the CRL nextUpdate field, it is expired and treated as an error condition.
152 /// Overrides the default behavior where expired CRLs are not treated as an error condition.
153 ///
154 /// If no CRLs are provided then this setting has no effect as revocation status checks
155 /// are not performed.
156 pub fn enforce_revocation_expiration(mut self) -> Self {
157 self.revocation_expiration_policy = ExpirationPolicy::Enforce;
158 self
159 }
160
161 /// Build a client certificate verifier. The built verifier will be used for the server to offer
162 /// client certificate authentication, to control how offered client certificates are validated,
163 /// and to determine what to do with anonymous clients that do not respond to the client
164 /// certificate authentication offer with a client certificate.
165 ///
166 /// If `with_signature_verification_algorithms` was not called on the builder, a default set of
167 /// signature verification algorithms is used, controlled by the selected [`CryptoProvider`].
168 ///
169 /// Once built, the provided `Arc<dyn ClientVerifier>` can be used with a Rustls
170 /// [`ServerConfig`] to configure client certificate validation using
171 /// [`with_client_cert_verifier`][ConfigBuilder<ClientConfig, WantsVerifier>::with_client_cert_verifier].
172 ///
173 /// # Errors
174 /// This function will return a [`VerifierBuilderError`] if:
175 /// 1. No trust anchors have been provided.
176 /// 2. DER encoded CRLs have been provided that can not be parsed successfully.
177 pub fn build(self) -> Result<WebPkiClientVerifier, VerifierBuilderError> {
178 if self.roots.is_empty() {
179 return Err(VerifierBuilderError::NoRootAnchors);
180 }
181
182 Ok(WebPkiClientVerifier::new(
183 self.roots,
184 Arc::from(self.root_hint_subjects),
185 parse_crls(self.crls)?,
186 self.revocation_check_depth,
187 self.unknown_revocation_policy,
188 self.revocation_expiration_policy,
189 self.anon_policy,
190 self.supported_algs,
191 ))
192 }
193}
194
195/// A client certificate verifier that uses the `webpki` crate[^1] to perform client certificate
196/// validation.
197///
198/// It must be created via [`WebPkiClientVerifier::builder()`].
199///
200/// Once built, the provided `Arc<dyn ClientVerifier>` can be used with a Rustls [`ServerConfig`]
201/// to configure client certificate validation using [`with_client_cert_verifier`][ConfigBuilder<ClientConfig, WantsVerifier>::with_client_cert_verifier].
202///
203/// Example:
204///
205/// To require all clients present a client certificate issued by a trusted CA:
206/// ```no_run
207/// # #[cfg(feature = "aws-lc-rs")] {
208/// # use rustls::RootCertStore;
209/// # use rustls::server::WebPkiClientVerifier;
210/// # use rustls::crypto::aws_lc_rs::DEFAULT_PROVIDER;
211/// # let roots = RootCertStore::empty();
212/// let client_verifier = WebPkiClientVerifier::builder(roots.into(), &DEFAULT_PROVIDER)
213/// .build()
214/// .unwrap();
215/// # }
216/// ```
217///
218/// Or, to allow clients presenting a client certificate authenticated by a trusted CA, or
219/// anonymous clients that present no client certificate:
220/// ```no_run
221/// # #[cfg(feature = "aws-lc-rs")] {
222/// # use rustls::RootCertStore;
223/// # use rustls::server::WebPkiClientVerifier;
224/// # #[cfg(feature = "aws-lc-rs")]
225/// # use rustls::crypto::aws_lc_rs::DEFAULT_PROVIDER;
226/// # let roots = RootCertStore::empty();
227/// let client_verifier = WebPkiClientVerifier::builder(roots.into(), &DEFAULT_PROVIDER)
228/// .allow_unauthenticated()
229/// .build()
230/// .unwrap();
231/// # }
232/// ```
233///
234/// If you wish to disable advertising client authentication:
235/// ```no_run
236/// # use rustls::RootCertStore;
237/// # use rustls::server::WebPkiClientVerifier;
238/// # let roots = RootCertStore::empty();
239/// let client_verifier = WebPkiClientVerifier::no_client_auth();
240/// ```
241///
242/// You can also configure the client verifier to check for certificate revocation with
243/// client certificate revocation lists (CRLs):
244/// ```no_run
245/// # #[cfg(feature = "aws-lc-rs")] {
246/// # #[cfg(feature = "aws-lc-rs")]
247/// # use rustls::crypto::aws_lc_rs::DEFAULT_PROVIDER;
248/// # use rustls::RootCertStore;
249/// # use rustls::server::{WebPkiClientVerifier};
250/// # let roots = RootCertStore::empty();
251/// # let crls = Vec::new();
252/// let client_verifier = WebPkiClientVerifier::builder(roots.into(), &DEFAULT_PROVIDER)
253/// .with_crls(crls)
254/// .build()
255/// .unwrap();
256/// # }
257/// ```
258///
259/// [^1]: <https://github.com/rustls/webpki>
260#[derive(Debug)]
261pub struct WebPkiClientVerifier {
262 roots: Arc<RootCertStore>,
263 root_hint_subjects: Arc<[DistinguishedName]>,
264 eku_validator: ExtendedKeyUsage,
265 crls: Vec<CertRevocationList<'static>>,
266 revocation_check_depth: RevocationCheckDepth,
267 unknown_revocation_policy: UnknownStatusPolicy,
268 revocation_expiration_policy: ExpirationPolicy,
269 anonymous_policy: AnonymousClientPolicy,
270 supported_algs: WebPkiSupportedAlgorithms,
271}
272
273impl WebPkiClientVerifier {
274 /// Create a builder for the `webpki` client certificate verifier configuration using
275 /// a specified [`CryptoProvider`].
276 ///
277 /// Client certificate authentication will be offered by the server, and client certificates
278 /// will be verified using the trust anchors found in the provided `roots`. If you
279 /// wish to disable client authentication use [WebPkiClientVerifier::no_client_auth()] instead.
280 ///
281 /// The cryptography used comes from the specified [`CryptoProvider`].
282 ///
283 /// For more information, see the [`ClientVerifierBuilder`] documentation.
284 pub fn builder(roots: Arc<RootCertStore>, provider: &CryptoProvider) -> ClientVerifierBuilder {
285 ClientVerifierBuilder::new(roots, provider.signature_verification_algorithms)
286 }
287
288 /// Create a new `WebPkiClientVerifier` that disables client authentication. The server will
289 /// not offer client authentication and anonymous clients will be accepted.
290 ///
291 /// This is in contrast to using `WebPkiClientVerifier::builder().allow_unauthenticated().build()`,
292 /// which will produce a verifier that will offer client authentication, but not require it.
293 pub fn no_client_auth() -> Arc<dyn ClientVerifier> {
294 Arc::new(NoClientAuth {})
295 }
296
297 /// Construct a new `WebpkiClientVerifier`.
298 ///
299 /// * `roots` is a list of trust anchors to use for certificate validation.
300 /// * `root_hint_subjects` is a list of distinguished names to use for hinting acceptable
301 /// certificate authority subjects to a client.
302 /// * `crls` is a `Vec` of owned certificate revocation lists (CRLs) to use for
303 /// client certificate validation.
304 /// * `revocation_check_depth` controls which certificates have their revocation status checked
305 /// when `crls` are provided.
306 /// * `unknown_revocation_policy` controls how certificates with an unknown revocation status
307 /// are handled when `crls` are provided.
308 /// * `anonymous_policy` controls whether client authentication is required, or if anonymous
309 /// clients can connect.
310 /// * `supported_algs` specifies which signature verification algorithms should be used.
311 pub(crate) fn new(
312 roots: Arc<RootCertStore>,
313 root_hint_subjects: Arc<[DistinguishedName]>,
314 crls: Vec<CertRevocationList<'static>>,
315 revocation_check_depth: RevocationCheckDepth,
316 unknown_revocation_policy: UnknownStatusPolicy,
317 revocation_expiration_policy: ExpirationPolicy,
318 anonymous_policy: AnonymousClientPolicy,
319 supported_algs: WebPkiSupportedAlgorithms,
320 ) -> Self {
321 Self {
322 roots,
323 root_hint_subjects,
324 eku_validator: ExtendedKeyUsage::client_auth(),
325 crls,
326 revocation_check_depth,
327 unknown_revocation_policy,
328 revocation_expiration_policy,
329 anonymous_policy,
330 supported_algs,
331 }
332 }
333}
334
335impl ClientVerifier for WebPkiClientVerifier {
336 fn verify_identity(&self, identity: &ClientIdentity<'_>) -> Result<PeerVerified, Error> {
337 let certificates = match identity.identity {
338 Identity::X509(certificates) => certificates,
339 Identity::RawPublicKey(_) => {
340 return Err(ApiMisuse::UnverifiableCertificateType.into());
341 }
342 };
343
344 let cert = ParsedCertificate::try_from(&certificates.end_entity)?;
345 let crl_refs = self.crls.iter().collect::<Vec<_>>();
346 let revocation = if self.crls.is_empty() {
347 None
348 } else {
349 Some(
350 webpki::RevocationOptionsBuilder::new(&crl_refs)
351 // Note: safe to unwrap here - new is only fallible if no CRLs are provided
352 // and we verify this above.
353 .unwrap()
354 .with_depth(self.revocation_check_depth)
355 .with_status_policy(self.unknown_revocation_policy)
356 .with_expiration_policy(self.revocation_expiration_policy)
357 .build(),
358 )
359 };
360
361 cert.0
362 .verify_for_usage(
363 self.supported_algs.all,
364 &self.roots.roots,
365 &certificates.intermediates,
366 identity.now,
367 &self.eku_validator,
368 revocation,
369 None,
370 )
371 .map_err(pki_error)
372 .map(|_| PeerVerified::assertion())
373 }
374
375 fn verify_tls12_signature(
376 &self,
377 input: &SignatureVerificationInput<'_>,
378 ) -> Result<HandshakeSignatureValid, Error> {
379 verify_tls12_signature(input, &self.supported_algs)
380 }
381
382 fn verify_tls13_signature(
383 &self,
384 input: &SignatureVerificationInput<'_>,
385 ) -> Result<HandshakeSignatureValid, Error> {
386 verify_tls13_signature(input, &self.supported_algs)
387 }
388
389 fn root_hint_subjects(&self) -> Arc<[DistinguishedName]> {
390 self.root_hint_subjects.clone()
391 }
392
393 fn client_auth_mandatory(&self) -> bool {
394 match self.anonymous_policy {
395 AnonymousClientPolicy::Allow => false,
396 AnonymousClientPolicy::Deny => true,
397 }
398 }
399
400 fn offer_client_auth(&self) -> bool {
401 true
402 }
403
404 fn supported_verify_schemes(&self) -> Vec<SignatureScheme> {
405 self.supported_algs.supported_schemes()
406 }
407}
408
409/// Controls how the [WebPkiClientVerifier] handles anonymous clients.
410#[derive(Debug, Clone, Copy, PartialEq, Eq)]
411pub(crate) enum AnonymousClientPolicy {
412 /// Clients that do not present a client certificate are allowed.
413 Allow,
414 /// Clients that do not present a client certificate are denied.
415 Deny,
416}
417
418#[cfg(test)]
419mod tests {
420 use alloc::vec::Vec;
421 use std::{format, println, vec};
422
423 use pki_types::pem::PemObject;
424 use pki_types::{CertificateDer, CertificateRevocationListDer};
425
426 use super::WebPkiClientVerifier;
427 use crate::RootCertStore;
428 use crate::crypto::TEST_PROVIDER;
429 use crate::error::CertRevocationListError;
430 use crate::server::VerifierBuilderError;
431 use crate::sync::Arc;
432
433 fn load_crls(crls_der: &[&[u8]]) -> Vec<CertificateRevocationListDer<'static>> {
434 crls_der
435 .iter()
436 .map(|pem_bytes| CertificateRevocationListDer::from_pem_slice(pem_bytes).unwrap())
437 .collect()
438 }
439
440 fn test_crls() -> Vec<CertificateRevocationListDer<'static>> {
441 load_crls(&[
442 include_bytes!("../../../test-ca/ecdsa-p256/client.revoked.crl.pem").as_slice(),
443 include_bytes!("../../../test-ca/rsa-2048/client.revoked.crl.pem").as_slice(),
444 ])
445 }
446
447 fn load_roots(roots_der: &[&[u8]]) -> Arc<RootCertStore> {
448 let mut roots = RootCertStore::empty();
449 roots_der.iter().for_each(|der| {
450 roots
451 .add(CertificateDer::from(der.to_vec()))
452 .unwrap()
453 });
454 roots.into()
455 }
456
457 fn test_roots() -> Arc<RootCertStore> {
458 load_roots(&[
459 include_bytes!("../../../test-ca/ecdsa-p256/ca.der").as_slice(),
460 include_bytes!("../../../test-ca/rsa-2048/ca.der").as_slice(),
461 ])
462 }
463
464 #[test]
465 fn test_client_verifier_no_auth() {
466 // We should be able to build a verifier that turns off client authentication.
467 WebPkiClientVerifier::no_client_auth();
468 }
469
470 #[test]
471 fn test_client_verifier_required_auth() {
472 // We should be able to build a verifier that requires client authentication, and does
473 // no revocation checking.
474 let builder = WebPkiClientVerifier::builder(test_roots(), &TEST_PROVIDER);
475 // The builder should be Debug.
476 println!("{builder:?}");
477 builder.build().unwrap();
478 }
479
480 #[test]
481 fn test_client_verifier_optional_auth() {
482 // We should be able to build a verifier that allows client authentication, and anonymous
483 // access, and does no revocation checking.
484 let builder =
485 WebPkiClientVerifier::builder(test_roots(), &TEST_PROVIDER).allow_unauthenticated();
486 // The builder should be Debug.
487 println!("{builder:?}");
488 builder.build().unwrap();
489 }
490
491 #[test]
492 fn test_client_verifier_without_crls_required_auth() {
493 // We should be able to build a verifier that requires client authentication, and does
494 // no revocation checking, that hasn't been configured to determine how to handle
495 // unauthenticated clients yet.
496 let builder = WebPkiClientVerifier::builder(test_roots(), &TEST_PROVIDER);
497 // The builder should be Debug.
498 println!("{builder:?}");
499 builder.build().unwrap();
500 }
501
502 #[test]
503 fn test_client_verifier_without_crls_optional_auth() {
504 // We should be able to build a verifier that allows client authentication,
505 // and anonymous access, that does no revocation checking.
506 let builder =
507 WebPkiClientVerifier::builder(test_roots(), &TEST_PROVIDER).allow_unauthenticated();
508 // The builder should be Debug.
509 println!("{builder:?}");
510 builder.build().unwrap();
511 }
512
513 #[test]
514 fn test_with_invalid_crls() {
515 // Trying to build a client verifier with invalid CRLs should error at build time.
516 let result = WebPkiClientVerifier::builder(test_roots(), &TEST_PROVIDER)
517 .with_crls(vec![CertificateRevocationListDer::from(vec![0xFF])])
518 .build();
519 assert!(matches!(result, Err(VerifierBuilderError::InvalidCrl(_))));
520 }
521
522 #[test]
523 fn test_with_crls_multiple_calls() {
524 // We should be able to call `with_crls` on a client verifier multiple times.
525 let initial_crls = test_crls();
526 let extra_crls =
527 load_crls(&[
528 include_bytes!("../../../test-ca/eddsa/client.revoked.crl.pem").as_slice(),
529 ]);
530
531 let builder = WebPkiClientVerifier::builder(test_roots(), &TEST_PROVIDER)
532 .with_crls(initial_crls.clone())
533 .with_crls(extra_crls.clone());
534
535 // There should be the expected number of crls.
536 assert_eq!(builder.crls.len(), initial_crls.len() + extra_crls.len());
537 // The builder should be Debug.
538 println!("{builder:?}");
539 builder.build().unwrap();
540 }
541
542 #[test]
543 fn test_client_verifier_with_crls_required_auth_implicit() {
544 // We should be able to build a verifier that requires client authentication, and that does
545 // revocation checking with CRLs, and that does not allow any anonymous access.
546 let builder =
547 WebPkiClientVerifier::builder(test_roots(), &TEST_PROVIDER).with_crls(test_crls());
548 // The builder should be Debug.
549 println!("{builder:?}");
550 builder.build().unwrap();
551 }
552
553 #[test]
554 fn test_client_verifier_with_crls_optional_auth() {
555 // We should be able to build a verifier that supports client authentication, that does
556 // revocation checking with CRLs, and that allows anonymous access.
557 let builder = WebPkiClientVerifier::builder(test_roots(), &TEST_PROVIDER)
558 .with_crls(test_crls())
559 .allow_unauthenticated();
560 // The builder should be Debug.
561 println!("{builder:?}");
562 builder.build().unwrap();
563 }
564
565 #[test]
566 fn test_client_verifier_ee_only() {
567 // We should be able to build a client verifier that only checks EE revocation status.
568 let builder = WebPkiClientVerifier::builder(test_roots(), &TEST_PROVIDER)
569 .with_crls(test_crls())
570 .only_check_end_entity_revocation();
571 // The builder should be Debug.
572 println!("{builder:?}");
573 builder.build().unwrap();
574 }
575
576 #[test]
577 fn test_client_verifier_allow_unknown() {
578 // We should be able to build a client verifier that allows unknown revocation status
579 let builder = WebPkiClientVerifier::builder(test_roots(), &TEST_PROVIDER)
580 .with_crls(test_crls())
581 .allow_unknown_revocation_status();
582 // The builder should be Debug.
583 println!("{builder:?}");
584 builder.build().unwrap();
585 }
586
587 #[test]
588 fn test_client_verifier_enforce_expiration() {
589 // We should be able to build a client verifier that allows unknown revocation status
590 let builder = WebPkiClientVerifier::builder(test_roots(), &TEST_PROVIDER)
591 .with_crls(test_crls())
592 .enforce_revocation_expiration();
593 // The builder should be Debug.
594 println!("{builder:?}");
595 builder.build().unwrap();
596 }
597
598 #[test]
599 fn test_builder_no_roots() {
600 // Trying to create a client verifier builder with no trust anchors should fail at build time
601 let result =
602 WebPkiClientVerifier::builder(RootCertStore::empty().into(), &TEST_PROVIDER).build();
603 assert!(matches!(result, Err(VerifierBuilderError::NoRootAnchors)));
604 }
605
606 #[test]
607 fn smoke() {
608 let all = vec![
609 VerifierBuilderError::NoRootAnchors,
610 VerifierBuilderError::InvalidCrl(CertRevocationListError::ParseError),
611 ];
612
613 for err in all {
614 let _ = format!("{err:?}");
615 let _ = format!("{err}");
616 }
617 }
618}