python-security

Identify Python security footguns and provide safe patterns for subprocess, deserialization, and input handling.

1|1|Updated Apr 6, 2026
One-click install
npx skills add https://github.com/Jylhis/skills --skill python-security-jylhis
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: python-security
Source: https://github.com/Jylhis/skills/tree/main/skills/python-security
Command: npx skills add https://github.com/Jylhis/skills --skill python-security-jylhis

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Python developers routinely encounter security footguns such as unsafe subprocess usage, unsafe deserialization, risky YAML loading, SSRF, SQL injection, secret handling, and unsafe path handling when dealing with untrusted input or external services.

Core Features & Use Cases

  • Safer subprocess patterns: shows when to avoid shell=True and prefer list-based calls with proper quoting.
  • Safe deserialization and YAML handling: guidance on using safe_load equivalents and avoiding unsafe loaders.
  • Input validation & defense-in-depth: best practices to validate inputs and defend against SSRF, SQL injection, and path traversal.
  • Use Case: Imagine a web service that validates user input before making external requests and stores results securely.

Quick Start

Ask me to audit a Python project for insecure patterns and propose safe alternatives.

Frequently Asked Questions about python-security

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

FAQPage Schema
How do I find and fix unsafe subprocess usage in Python?

To fix unsafe subprocess usage in Python, replace `shell=True` with list-based argument calls and apply proper input quoting. This prevents shell injection risks by explicitly separating the command from untrusted arguments.

Why is yaml.load insecure and what is the safe alternative?

The yaml.load function is insecure because it allows arbitrary object instantiation, leading to code execution. The safe alternative is using safe_load equivalents to parse YAML without executing embedded Python objects.

How do I prevent SSRF and SQL injection when handling untrusted input in Python?

Prevent SSRF and SQL injection in Python by applying defense-in-depth input validation before making external requests or database queries. Validate and sanitize all untrusted inputs to block malicious payloads and unauthorized service interactions.

What is the best way to audit a Python project for path traversal and deserialization vulnerabilities?

The best way to audit a Python project for path traversal and deserialization vulnerabilities is to scan for unsafe file path concatenation and unsafe deserialization patterns. Replace them with validated path handling and secure loading functions.

Does this Python security guidance apply to small scripts and large web services?

Yes, this Python security guidance applies to projects of varying sizes, from small scripts to large web services. It provides explicit safe patterns and validation checks that secure untrusted input handling and external service interactions across any scale.