python-security-pitfalls

python-security-pitfalls is a skill for Claude Code, Codex from makifbaysal/tasktrooper. It costs 48 tokens per session (1,700 once invoked), scanned A, original, Apache-2.0.

A security review guide for Python applications and data or machine-learning code. It covers common dangerous operations in Django, Flask, FastAPI, subprocesses, databases, templates, and model or data loading.

In plain words
What is it for?
Use it to review web handlers, subprocess calls, SQL, Jinja templates, format strings, pickle and model files, notebooks, YAML configuration, and remote model code.
Why use it?
Python code can execute untrusted instructions through tools such as pickle, eval, shell commands, unsafe SQL, or unsafe configuration loading. The guide helps trace those operations back to their sources.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to review web handlers, subprocess calls, SQL, Jinja templates, format strings, pickle and model files, notebooks, YAML configuration, and remote model code.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/makifbaysal/tasktrooper/python-security-pitfalls
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add makifbaysal/tasktrooper --skill python-security-pitfalls
Clone the repo
git clone --depth 1 https://github.com/makifbaysal/tasktrooper

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for python-security-pitfalls

README.md
[![agentmods](https://agentmods.dev/badge/skills/makifbaysal/tasktrooper/python-security-pitfalls/github.svg)](https://agentmods.dev/skills/makifbaysal/tasktrooper/python-security-pitfalls)
Your own site
<a href="https://agentmods.dev/skills/makifbaysal/tasktrooper/python-security-pitfalls"><img src="https://agentmods.dev/badge/skills/makifbaysal/tasktrooper/python-security-pitfalls/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for python-security-pitfalls

Your own site · 80×15
<a href="https://agentmods.dev/skills/makifbaysal/tasktrooper/python-security-pitfalls"><img src="https://agentmods.dev/badge/skills/makifbaysal/tasktrooper/python-security-pitfalls.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 48 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,700 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 2 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00048 $0.01700
Opus 5.5 $0.00019 $0.00680
Sonnet 5.5 $0.00010 $0.00340
Haiku 4.5 $0.00005 $0.00170

Measured 4d ago against content hash b670f54496f7, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

python-security-pitfalls scanned grade A with 2 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

- `requests.get(..., verify=False)`, `ssl._create_unverified_context()`.

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

os.system(f"zip -r {out} {folder}")
catalog/agents/security-agent/skills/python-security-pitfalls/SKILL.md · 116 lines

How it starts

The opening of the file, as written. The whole thing — 116 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Python Security Pitfalls (services, data and ML)

Overview

Python's dangerous calls are few and well known — pickle, eval, shell=True, f-string SQL — but data and ML code uses them as everyday tools: models are pickles, configs are YAML, notebooks evaluate whatever they are given. The question is always where the bytes come from.

1. Model and Data Loading (CWE-502) — the data/ML hot spot

Loading a pickle-based file runs code chosen by whoever wrote the file.

# ❌ an uploaded or downloaded model file executes code on load
model = torch.load(path, weights_only=False)
clf = joblib.load(user_upload)
df = pd.read_pickle(s3_key_from_request)
arr = np.load(path, allow_pickle=True)
cfg = yaml.load(text, Loader=yaml.Loader)

# ✅
model.load_state_dict(safetensors.torch.load_file(path))
arr = np.load(path)                    # allow_pickle defaults to False
cfg = yaml.safe_load(text)
  • torch.load defaults to weights_only=True from PyTorch 2.6; on an older pinned torch the plain call is unsafe.
  • Hugging Face from_pretrained(..., trust_remote_code=True) runs Python from the model repository; with a user-chosen repo id it is remote code execution.
  • Keras load_model(..., safe_mode=False) allows Lambda-layer code.
  • Celery or Kombu with accept_content=["pickle"], pickled values in a shared Redis or cache, shelve, dill, cloudpickle on data another party writes.
  • Prefer safetensors, ONNX, skops, JSON, Parquet.

A finding when the file can come from outside the trust boundary: an upload, a URL, a user-chosen hub id, a shared bucket other tenants write. A model the team trains and ships in its own artifact store is not attacker input.

2. Code Evaluation

  • eval, exec, compile, __import__/importlib.import_module with input.
  • DataFrame.query(expr) / pd.eval(expr) with a user-built expression — evaluation, not filtering.
  • Format-string injection: a user-supplied format string can walk attributes.
# ❌ template = "{user.__class__.__init__.__globals__[SECRET_KEY]}"
message = template.format(user=user)
# ✅ user text is the value, never the format
message = "Hello {name}".format(name=user.name)

Read the full file on GitHub · 116 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 116 lines · 48 tokens per session scan A b670f54496f7

Subscribe to this mod's changes

python-security-pitfalls is a skill published in the GitHub repository makifbaysal/tasktrooper (113 stars, last pushed yesterday), licensed Apache-2.0. It adds 48 tokens to every session and 1,700 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 2 findings (makes network calls, runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-10-09.