python-security-misconfiguration

python-security-misconfiguration is a cursor rule for Cursor from ivangrynenko/cursorrules. It costs 0 tokens per session (2,913 once invoked), scanned A, original, MIT.

A set of checks for unsafe Python application settings, including debug mode, cookies, CSRF protection, and CORS. CSRF protection helps stop unwanted actions from another site, while CORS controls which websites may call a server from a browser.

In plain words
What is it for?
Use it to review Python production settings for debug output, session cookies, CSRF, and cross-origin request rules.
Why use it?
It helps find configuration choices that can expose sensitive information, weaken browser protections, or allow unwanted cross-site access.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it to review Python production settings for debug output, session cookies, CSRF, and cross-origin request rules.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/ivangrynenko/cursorrules/python-security-misconfiguration
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.

Clone the repo
git clone --depth 1 https://github.com/ivangrynenko/cursorrules

Made for: Cursor.

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-misconfiguration

README.md
[![agentmods](https://agentmods.dev/badge/rules/ivangrynenko/cursorrules/python-security-misconfiguration/github.svg)](https://agentmods.dev/rules/ivangrynenko/cursorrules/python-security-misconfiguration)
Your own site
<a href="https://agentmods.dev/rules/ivangrynenko/cursorrules/python-security-misconfiguration"><img src="https://agentmods.dev/badge/rules/ivangrynenko/cursorrules/python-security-misconfiguration/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-misconfiguration

Your own site · 80×15
<a href="https://agentmods.dev/rules/ivangrynenko/cursorrules/python-security-misconfiguration"><img src="https://agentmods.dev/badge/rules/ivangrynenko/cursorrules/python-security-misconfiguration.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 2,913 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. 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.00000 $0.02913
Opus 5.5 $0.00000 $0.01165
Sonnet 5.5 $0.00000 $0.00583
Haiku 4.5 $0.00000 $0.00291

Measured 1mo ago against content hash 2b928829bdb8, 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-misconfiguration scanned grade A with 1 finding 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 1mo 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.

response = requests.get('https://api.example.com', timeout=(3.05, 27))
Origin

Copies of this mod

1 near-identical copy found in the catalogue:

.cursor/rules/python-security-misconfiguration.mdc · 276 lines

How it starts

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

Python Security Misconfiguration Standards (OWASP A05:2021)

This rule enforces security best practices to prevent security misconfigurations in Python applications, as defined in OWASP Top 10:2021-A05.

actions:

  • type: enforce conditions:

    Pattern 1: Debug mode enabled in production settings

    • pattern: "DEBUG\s*=\sTrue|debug\s=\strue|"debug"\s:\strue|debug:\strue" message: "Debug mode appears to be enabled. This should be disabled in production environments as it can expose sensitive information."
    • pattern: "SESSION_COOKIE_SECURE\s*=\sFalse|session_cookie_secure\s=\sfalse|"session_cookie_secure"\s:\sfalse|session_cookie_secure:\sfalse" message: "Insecure cookie configuration detected. Set SESSION_COOKIE_SECURE to True in production environments."

    Pattern 3: Missing CSRF protection

    • pattern: "CSRF_ENABLED\s*=\sFalse|csrf_enabled\s=\sfalse|"csrf_enabled"\s:\sfalse|csrf_enabled:\sfalse|WTF_CSRF_ENABLED\s*=\s*False" message: "CSRF protection appears to be disabled. Enable CSRF protection to prevent cross-site request forgery attacks."

    Pattern 4: Insecure CORS settings

    • pattern: "CORS_ORIGIN_ALLOW_ALL\s*=\sTrue|cors_origin_allow_all\s=\strue|"cors_origin_allow_all"\s:\strue|cors_origin_allow_all:\strue|Access-Control-Allow-Origin:\s*\*" message: "Overly permissive CORS configuration detected. Restrict CORS to specific origins rather than allowing all origins."

    Pattern 5: Default or weak secret keys

    • pattern: "SECRET_KEY\s*=\s*['"]default|SECRET_KEY\s*=\s*['"][a-zA-Z0-9]{1,32}['"]|secret_key\s*=\s*['"]default|"secret_key"\s*:\s*"default|secret_key:\s*default" message: "Default or potentially weak secret key detected. Use a strong, randomly generated secret key and store it securely."

    Pattern 6: Exposed sensitive information in error messages

    • pattern: "DEBUG_PROPAGATE_EXCEPTIONS\s*=\sTrue|debug_propagate_exceptions\s=\strue|"debug_propagate_exceptions"\s:\strue|debug_propagate_exceptions:\strue" message: "Exception propagation in debug mode is enabled. This can expose sensitive information in error messages."

    Pattern 7: Insecure SSL/TLS configuration

    • pattern: "SECURE_SSL_REDIRECT\s*=\sFalse|secure_ssl_redirect\s=\sfalse|"secure_ssl_redirect"\s:\sfalse|secure_ssl_redirect:\sfalse" message: "SSL redirection appears to be disabled. Enable SSL redirection to ensure secure communications."

    Pattern 8: Missing security headers

    • pattern: "SECURE_HSTS_SECONDS\s*=\s0|secure_hsts_seconds\s=\s0|"secure_hsts_seconds"\s:\s0|secure_hsts_seconds:\s0" message: "HTTP Strict Transport Security (HSTS) appears to be disabled. Enable HSTS to enforce secure communications."

    Pattern 9: Exposed sensitive directories

    • pattern: "@app\.route\(['"]/(admin|console|management|config|settings|system)['"]" message: "Potentially sensitive endpoint exposed without access controls. Ensure proper authentication and authorization for administrative endpoints."

    Pattern 10: Default accounts or credentials

    • pattern: "username\s*=\s*['"]admin['"]|password\s*=\s*['"]admin|password\s*=\s*['"]password|password\s*=\s*['"]123|user\s*=\s*['"]root['"]" message: "Default or weak credentials detected. Never use default or easily guessable credentials in any environment."

    Pattern 11: Insecure file permissions

    • pattern: "os\.chmod\([^,]+,\s0o777\)|os\.chmod\([^,]+,\s777\)" message: "Overly permissive file permissions detected. Use the principle of least privilege for file permissions."

Read the full file on GitHub · 276 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. 1mo ago First seen · 276 lines · 2,913 tokens per session scan A 2b928829bdb8

Subscribe to this mod's changes

python-security-misconfiguration is a cursor rule published in the GitHub repository ivangrynenko/cursorrules (88 stars, last pushed 11mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,913 tokens. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.