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
Anyone who can read the source or git history can forge or tamper with tokens, which is a complete authentication bypass.
Load the secret from the environment or a secret manager instead, e.g. key = os.environ["JWT_SECRET"] and jwt.encode(payload, key, ...). Never commit signing keys to source control.
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.