You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The <code>danger_accept_invalid_certs</code> option on TLS connectors and HTTP clients controls whether certificate verification is performed. If this option is set to <code>true</code>, the client will accept any certificate, making it susceptible to man-in-the-middle attacks.
9
+
</p>
10
+
<p>
11
+
Similarly, the <code>danger_accept_invalid_hostnames</code> option controls whether hostname verification is performed. If this option is set to <code>true</code>, the client will accept any valid certificate regardless of the site that certificate is for, again making it susceptible to man-in-the-middle attacks.
12
+
</p>
13
+
</overview>
14
+
15
+
<recommendation>
16
+
<p>
17
+
Do not set <code>danger_accept_invalid_certs</code> or <code>danger_accept_invalid_hostnames</code> to <code>true</code>, except in controlled environments such as tests. In production, always ensure certificate and hostname verification is enabled to prevent security risks.
18
+
</p>
19
+
</recommendation>
20
+
21
+
<example>
22
+
<p>
23
+
The following code snippet shows a function that creates an HTTP client with certificate verification disabled:
24
+
</p>
25
+
<samplesrc="DisabledCertificateCheckBad.rs"/>
26
+
<p>
27
+
In production code, always configure clients to verify certificates:
0 commit comments