python-sast

A Python security scanner based on Bandit, a tool that examines Python source without running it for common unsafe coding patterns.

In plain words
What is it for?
Use it in Python repositories to scan source, review findings with nearby code, trace where inputs come from, and prioritize medium- or high-confidence issues.
Why use it?
It can reveal risks such as injection, unsafe deserialization, dangerous code execution, weak cryptography, and credentials embedded in code.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/vladkesler/initrunner/python-sast
Any agent
npx skills add vladkesler/initrunner --skill python-sast
Clone the repo
git clone --depth 1 https://github.com/vladkesler/initrunner

Made for: Claude Code, Codex.

Per session 34 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 589 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00034 $0.00589
Opus 5 $0.00017 $0.00295
Sonnet 5 $0.00007 $0.00118
Haiku 4.5 $0.00003 $0.00059

Measured 2d ago against content hash 6a337a6ad38d, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

python-sast scanned grade A with 0 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 2d 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

examples/roles/security-scanner/skills/python-sast/SKILL.md · 73 lines

How it starts

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

Python static analysis skill using bandit.

When to activate

Use this skill when the repository contains Python code: pyproject.toml, setup.py, requirements.txt, or .py files in the source tree.

Scanner command

bandit -r . -f json -ll --exclude .venv,tests,node_modules

The -ll flag filters to medium and higher confidence. The -f json flag returns structured output for parsing.

Parsing output

Bandit JSON output has a results array. Each result contains:

  • filename -- path to the file
  • line_number -- line of the finding
  • issue_severity -- HIGH, MEDIUM, LOW
  • issue_confidence -- HIGH, MEDIUM, LOW
  • issue_text -- description of the issue
  • test_id -- bandit test identifier (e.g. B301)

Key test IDs

Test ID Category
B101 assert used (usually test-only)
B102 exec() used
B301-B324 Deserialization, SQL injection, unsafe YAML
B501-B507 SSL/TLS issues
B601-B612 Shell injection, subprocess

Verification steps

For each finding:

  1. Read 10 lines of context around the flagged line using read_file.
  2. Trace backwards: where does the input come from? Follow the variable to its source (function parameter, request object, file read, etc.).
  3. If the input comes from user/network input (request.args, sys.argv, file read, socket, etc.), classify as HIGH confidence.
  4. If the input comes from a constant, config file, or environment variable, classify as MEDIUM or skip.

MUST flag

  • eval() or exec() with non-constant arguments
  • pickle.loads() on network or file input
  • yaml.load() without Loader=SafeLoader
  • subprocess with shell=True and string formatting (f"", .format(), %)
  • SQL queries with f-strings or .format() using external input

MUST NOT flag

  • assert statements in test files (B101)
  • Binding to 0.0.0.0 in development configs
  • hashlib used for checksums (not security hashing)
  • subprocess with shell=True and hardcoded constant strings
  • random module used for non-security purposes (shuffling, sampling)

Read the full file on GitHub · 73 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. 2d ago First seen · 73 lines · 34 tokens per session scan A 6a337a6ad38d

Subscribe to this mod's changes

python-sast is a skill published in the GitHub repository vladkesler/initrunner (41 stars, last pushed 4d ago), licensed Apache-2.0. It adds 34 tokens to every session and 589 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.