A reqwest client is built with danger_accept_invalid_hostnames(true), which turns off TLS hostname verification.
Why AI tools produce this: AI coding tools generate this anti-pattern by default, it appears in a large share of AI-written auth code.
Why this matters
The certificate chain is still checked, but a certificate valid for any other domain is accepted for this connection, so an attacker holding a valid certificate for a host they control can intercept the connection and read or tamper with the traffic, a man-in-the-middle hole. For OAuth/OIDC this leaks authorization codes, access tokens, and client secrets in transit.
Never accept invalid hostnames. Leave hostname verification on (the default). To trust a private CA in development, add it explicitly with ClientBuilder::add_root_certificate(cert) instead.
Suppressing this rule
If a finding is a genuine false positive, scope the suppression to the exact line and leave a reason, never disable the rule project-wide. Disable directives are line-scoped by design.
// oauthlint-disable-next-line auth.rust.tls.accept-invalid-hostnames -- <reason>