Ensure JWT signatures are verified

このページは日本語には対応しておりません。随時翻訳に取り組んでいます。翻訳に関してご質問やご意見ございましたら、お気軽にご連絡ください。

Metadata

ID: python-security/insecure-jwt

Language: Python

Severity: Notice

Category: Security

CWE: 287

Description

Use "verify_signature": False when decoding a JWT bypasses security and may authenticate users that should not be authenticated.

See Also

Non-Compliant Code Examples

import jwt

def insecure_verify(token):
    decoded = jwt.decode(token, verify=False)
    print decoded
    return True
import jwt

jwt.decode(encoded, options={"verify_signature": False})

Compliant Code Examples

import jwt

jwt.decode(encoded, bla={"verify_signature": False})

jwt.decode(encoded, options={"foobar": False})
import jwt

jwt.decode(encoded, options={"verify_signature": True})
jwt.decode(encoded, options={"verify_signature": False})
https://static.datadoghq.com/static/images/logos/github_avatar.svg https://static.datadoghq.com/static/images/logos/vscode_avatar.svg jetbrains

Seamless integrations. Try Datadog Code Analysis