python-security

Review and harden Python applications against OWASP Top 10 vulnerabilities.

Updated Mar 30, 2026
One-click install
npx skills add https://github.com/ninthday/skills-base --skill python-security-ninthday
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: python-security
Source: https://github.com/ninthday/skills-base/tree/main/skills/python-security
Command: npx skills add https://github.com/ninthday/skills-base --skill python-security-ninthday

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Python applications frequently ship with preventable vulnerabilities like SQL injection, insecure deserialization, hardcoded secrets, and weak cryptography. This Skill provides a structured secure development lifecycle covering threat modeling, secure implementation, verification, and deployment hardening so security issues are caught before production. ## Core Features & Use Cases - OWASP Top 10:2025 Coverage: Maps each category to Python-specific risks with vulnerable-to-secure code examples for Django, Flask, and FastAPI. - Security Review Workflow: A nine-step procedure for auditing code, from scanning critical prohibitions (eval, pickle, shell=True) to reporting findings with severity ratings. - Verification Tooling: Ready-to-run commands for bandit, semgrep, pip-audit, safety, and detect-secrets, plus checklists for code review, dependency audit, and deployment. - Use Case: Before releasing a FastAPI service, run the review workflow to catch a JWT missing algorithm pinning, an unpinned dependency with a known CVE, and a traceback-leaking error handler, then apply the provided secure code patterns to fix each finding. ## Quick Start Review my Python project for security vulnerabilities following the OWASP Top 10 and report findings with fixes.

Frequently Asked Questions about python-security

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I review Python code for security vulnerabilities?

Follow the nine-step security review workflow: scan for critical prohibitions like eval and pickle, check input validation at entry points, verify authentication and authorization, trace sensitive data handling, audit dependencies with pip-audit, and run bandit and semgrep for static analysis.

What tools should I use for Python security scanning?

Use bandit for Python-specific static analysis, semgrep with p/python and p/owasp-top-ten rulesets for pattern matching, pip-audit or safety for dependency vulnerabilities, and detect-secrets for finding leaked credentials in the codebase.

How do I prevent SQL injection in Python applications?

Always use parameterized queries such as cursor.execute with parameter tuples, or ORM query builders. Never format user input into SQL strings with f-strings or percent formatting, and audit any uses of raw(), extra(), or RawSQL() in Django.

Does this cover Django, Flask, and FastAPI security?

Yes. The references include framework-specific guidance: Django security settings and ORM safety, Flask session configuration and CSRF protection with flask-wtf, and FastAPI dependency-injection auth, CORS configuration, and rate limiting with slowapi.

Why is pickle.loads dangerous with untrusted data?

pickle.loads on untrusted data allows arbitrary code execution because pickled objects can invoke arbitrary Python callables during deserialization. Use json.loads for data interchange or yaml.safe_load for YAML, and validate structured input with Pydantic models.

What are the limitations of static analysis for Python security?

Static analysis tools like bandit detect known patterns but miss business logic flaws, insecure design issues, and runtime misconfigurations. Combine them with manual code review, dependency audits, negative security tests, and the provided architecture and deployment checklists.