agentleFS
michaelalbermichaelalber/ai-toolkit/skills/python-security-review/SKILL.md

python-security-review

Skill3 starsChanged 3 months agoMITView on GitHub

OWASP-based security review of Python apps (FastAPI, Django, Flask). Detects framework and entry points, scans the OWASP Top 10 (2025) mapped to Python patterns (injection, insecure deserialization, SSTI, secrets, auth), runs bandit and pip-audit for evidence, and emits an exec summary plus graded findings. Use to audit Python for vulnerabilities. Not for architecture grading (python-architecture-checklist).

  • Reads credentials

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Evidence or it is not a finding: Run bandit/pip-audit; cite file:line and the OWASP category.

    line 106
  2. Very specific:

    Federal/gov context → escalate: If NIST/FIPS/CUI/DOE applies, run security-review-federal after this base review.

    line 110

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Python Security Review

"Security is not a product, but a process." — Bruce Schneier

Core Philosophy

Shared across the dotnet / python / php / rust security reviews — same values, language-specific threats.

#ValueWhat it means
1Validate at boundariesEvery external input validated and typed at the edge (Pydantic/serializers); never trust client data.
2Parameterized queries onlyNo f-string / %-formatted SQL; bound parameters or the ORM everywhere.
3Secrets out of codeNo hardcoded secrets; env / secret-manager; never logged.
4Authn/authz at every boundaryAuthentication and authorization enforced server-side at each trust boundary; deny by default.
5Least privilege & safe defaultsMinimal permissions; secure defaults; fail closed.
6Protect data in transit & at restNo sensitive data (passwords, tokens, PII) in logs; TLS; encryption at rest.
7Dependencies pinned & auditedVersions pinned; pip-audit in CI; supply chain reviewed.
8Evidence-based, graded findingsEvery finding cites file:line + OWASP category + severity; report is graded and manager-readable.

Workflow

Shared skeleton: DETECT → SCAN → EXECUTIVE SUMMARY → GRADED FINDINGS.

DETECT     Framework (FastAPI/Django/Flask + version), entry points (routes, views, tasks, CLIs),
           and the data stores / external calls in scope.

SCAN       Walk the Python Threat Checklist below, one OWASP category at a time. Gather evidence:
             bandit -r <pkg>            # static security analysis
             pip-audit                  # known CVEs in dependencies
             grep -rn "yaml.load(\|shell=True\|format(.*SELECT" <pkg>
           Every issue becomes a finding with file:line, OWASP category, and severity.

EXEC SUMMARY  Manager-friendly: risk grade, count by severity, top 3 risks in plain language.

FINDINGS      Technical table: severity · location · OWASP · finding · remediation.

Python Threat Checklist (language-specific)

OWASP (2025)Python checkSeverity signal
A01 Broken Access ControlAuth dependencies/decorators on every protected route; object-level checks (no IDOR); deny by defaultCritical
A02 Cryptographic Failureshashlib SHA-256+ (never MD5/SHA1 for security); secrets/os.urandom for tokens (not random); passlib/bcrypt for passwordsHigh
A03 InjectionORM or bound params (no f-string/% SQL); no shell-command execution on input (subprocess(..., shell=True), shell helpers); no dynamic eval/exec on inputCritical
A04 Insecure DesignServer-Side Template Injection (Jinja2 rendering user input); open redirectsHigh
A05 MisconfigurationDEBUG=False in prod; ALLOWED_HOSTS/CORS locked down; secure cookie flags; SECRET_KEY from envHigh
A06 Vulnerable Componentspip-audit clean; versions pinned in pyproject.toml; no abandoned packagesHigh
A08 Integrity FailuresNo insecure deserialization of untrusted input (native object deserialization, yaml.load without SafeLoader)Critical
A09 Logging FailuresNo passwords/tokens/PII in logs; auth and access failures loggedMedium
A10 SSRFOutbound URLs from user input validated/allow-listed; no raw requests.get(user_url)High

Full per-category checklist + grounding query map: owasp python checklist.

State Block

<security-review-state>
language: python
mode: DETECT | SCAN | EXEC-SUMMARY | FINDINGS | COMPLETE
detected: [framework+version | entry points | data stores]
owasp_covered: [A01..A10 progress]
findings: [critical:N high:N medium:N low:N]
last_action: [what was just done]
next_action: [what should happen next]
</security-review-state>

Output Template

Shared across all four security reviews. Executive summary template: executive summary.

## Security Review: [project] (Python)
**Framework**: [FastAPI/Django/Flask] | **Scope**: [paths] | **Risk grade**: [A–F]

### Executive Summary (manager-friendly)
[2–3 sentences: overall posture, the most serious risk in plain language, recommended next step.]
Findings: Critical [N] · High [N] · Medium [N] · Low [N]

### Technical Findings
| Severity | Location | OWASP | Finding | Remediation |
|----------|----------|-------|---------|-------------|
| CRITICAL | file:line | A03 | [pattern] | [fix] |

**Top 3 priorities**: 1. … 2. … 3. …

Risk grade: A no critical/high · B no critical, ≤2 high · C no critical, multiple high · D 1+ critical · F systemic (injection + secrets in code + broken access control).

AI Discipline Rules

  • Evidence or it is not a finding. Run bandit/pip-audit; cite file:line and the OWASP category. No speculative findings.
  • Detect the framework first. Django escapes templates and ships CSRF; FastAPI validates via Pydantic — confirm these are used, not bypassed, before flagging.
  • Severity reflects exploitability + impact, not how unusual the pattern looks.
  • Architecture, not here. Structural/maintainability issues belong to python-architecture-checklist — note and route.
  • Federal/gov context → escalate. If NIST/FIPS/CUI/DOE applies, run security-review-federal after this base review.

Integration with Other Skills

  • security-review-federal — Federal/gov overlay (NIST 800-53, FIPS, CUI, POA&M) applied on top of this base review.
  • python-architecture-checklist — Companion for structure/maintainability; run first for context.
  • supply-chain-audit — Deeper dependency/CVE and license analysis beyond pip-audit.
  • dotnet / php / rust-security-review — Sibling skills sharing this exact Core Values + workflow + output.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.