This vulnerability isn't a library bug—it's a design assumption failure that will reproduce in your codebase if you only patch the symptom. The core issue: PIA's code checked the JWT iss claim against an allowlist using Python's urlparse, then performed OIDC discovery using the requests library against the same URL. These two libraries extract the authority (hostname) differently when the URL contains backslashes. The check passed; the request went to a different host.

The fix must address the architectural flaw, not just this instance. Ask two questions of any patch: First, does it normalize the issuer URL to a canonical form before any security-relevant operation uses it—meaning canonicalize once, then use the result in both the allowlist check and the network request? Or does it just close the backslash gap between these two specific libraries? Second, does the patch normalize consistently, or will the next library update or refactor reintroduce the discrepancy?

Also examine your threat model: if requests makes an outbound connection to an attacker-controlled host based on an unverified JWT claim, you have SSRF. But this is worse than typical SSRF—the attacker controls the JWKS endpoint, meaning they can serve a key they control, then sign a token with any iss claim that passes your allowlist. In cloud environments, this blind SSRF to metadata services (169.254.169.254) becomes full IAM token extraction. The attack isn't just probing internal services; it's credential retrieval.

Finally, scrutinize the validation order. Checking iss before signature verification is checking an attacker-controlled input before you've established trust. Whether this was an intentional optimization to avoid network calls for obviously-invalid tokens or a misunderstanding of JWT validation order, the result is the same: network-external inputs are making routing decisions before cryptographic verification. The fix requires reordering—verify first, then check claims—but also requires recognizing that no untrusted input should drive security decisions before verification.