Code review python

From NoorQureshi/security-skills · View interactive version

Code review python is an AI agent skill from the GitHub repository NoorQureshi/security-skills. Security review of Python code — dangerous sinks and framework-specific pitfalls (Django/Flask/ FastAPI). Load when reviewing a Python codebase/PR, on .py source in scope, or "review this Python". Signals: requirements.txt/pyproject, Django/Flask/FastAPI, ORMs, pickle/yaml, subprocess.

How to use this skill

Skill file

Python security code review

When it applies

You're reading Python source (a repo, a PR, a service). This is the language-specific companion to

code-review-methodology — the exact sinks and framework gotchas to grep and trace.

Why it works

Most severe Python bugs come from a known set of sinks plus framework misuse. Grep the sinks, trace

each argument to a user source, and check the framework's safe-vs-unsafe API was used.

Sinks & patterns (grep, then trace to user input)

Framework specifics

SECRET_KEY exposure (session forgery), missing @login_required/object-level checks (IDOR),

ALLOWED_HOSTS='*', pickle session serializer.

(session tampering — flask-unsign), send_file traversal.

server-side authz (BOLA at the data layer).

Method

rg -n "shell=True|eval\(|exec\(|pickle.loads|yaml.load\(|render_template_string|\.raw\(|\.extra\(";

run bandit -r . and semgrep --config auto; triage by exploitable source→sink.

Gotchas

References

Bandit; Semgrep Python rules; OWASP Django/Flask cheat sheets.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.