BETA Shoulder is in beta — Findings may sometimes be wrong. Your feedback shapes what we fix next. Share feedback

Authentication Bypass Vulnerability

Description

Detects authentication checks that can be bypassed due to missing return statements or weak boolean logic.

How to fix

Use early returns for authentication failures to prevent bypass.

```python
if not user or not check_password_hash(user.password_hash, password):
    return jsonify({'error': 'Invalid credentials'}), 401
```

Learn more: https://shoulder.dev/learn/python/cwe-287/authentication-bypass

Applies to

Languages

Frameworks

flask django fastapi

References

Scan for this issue

Detect with Shoulder CLI
npx @shoulderdev/cli trust --rule=python-authentication-bypass .

Related rules