Authorization Code Interception
Concept
Vulnerable Scenario
Example Code (Vulnerable)
# Redirect the user to the authorization server
redirect_uri = "http://example.com/callback"
authorization_url = f"https://auth-server.com/authorize?response_type=code&client_id=CLIENT_ID&redirect_uri={redirect_uri}"
return redirect(authorization_url)
# Receive the authorization code
def callback():
authorization_code = request.args.get("code")
# Exchange the authorization code for an access token
# ...Explanation
Prevention
Example Code (Secure)
Conclusion
Semgrep Rule
Last updated