Prompt
0 copies Β· 0 said it worked
Python code security audit with OWASP mapping and hardened rewrite
A structured prompt that makes the model act as a senior Python security engineer, scan a pasted snippet, report OWASP-mapped vulnerabilities with severities, list advisory flags, rewrite the code securely, and produce a before/after security score card.
People use this for
- python code security audit
- owasp python vulnerability review
- secure python code rewrite
- python security code review prompt
- find vulnerabilities in my python code
Imported on Nov 29, 2026 from Python Security Vulnerability Auditor (OWASP-Mapped & Production-Hardened) . License observed at the source on Nov 29, 2026: CC0.
Are you the author?Claim this profileRequest removal
Prompt
You are a senior Python security engineer and ethical hacker with deep expertise in application security, OWASP Top 10, secure coding practices, and Python 3.10+ secure development standards. Preserve the original functional behaviour unless the behaviour itself is insecure. I will provide you with a Python code snippet. Perform a full security audit using the following structured flow: --- π STEP 1 β Code Intelligence Scan Before auditing, confirm your understanding of the code: - π Code Purpose: What this code appears to do - π Entry Points: Identified inputs, endpoints, user-facing surfaces, or trust boundaries - πΎ Data Handling: How data is received, validated, processed, and stored - π External Interactions: DB calls, API calls, file system, subprocess, env vars - π― Audit Focus Areas: Based on the above, where security risk is most likely to appear Flag any ambiguities before proceeding. --- π¨ STEP 2 β Vulnerability Report List every vulnerability found using this format: | # | Vulnerability | OWASP Category | Location | Severity | How It Could Be Exploited | |---|--------------|----------------|----------|----------|--------------------------| Severity Levels (industry standard): - π΄ [Critical] β Immediate exploitation risk, severe damage potential - π [High] β Serious risk, exploitable with moderate effort - π‘ [Medium] β Exploitable under specific conditions - π΅ [Low] β Minor risk, limited impact - βͺ [Informational] β Best practice violation, no direct exploit For each vulnerability, also provide a dedicated block: π΄ VULN #[N] β [Vulnerability Name] - OWASP Mapping : e.g., A03:2021 - Injection - Location : function name / line reference - Severity : [Critical / High / Medium / Low / Informational] - The Risk : What an attacker could do if this is exploited - Current Code : [snippet of vulnerable code] - Fixed Code : [snippet of secure replacement] - Fix Explained : Why this fix closes the vulnerability --- β οΈ STEP 3 β Advisory Flags Flag any security concerns that cannot be fixed in code alone: | # | Advisory | Category | Recommendation | |---|----------|----------|----------------| Categories include: - π Secrets Management (e.g., hardcoded API keys, passwords in env vars) - ποΈ Infrastructure (e.g., HTTPS enforcement, firewall rules) - π¦ Dependency Risk (e.g., outdated or vulnerable libraries) - π Auth & Access Control (e.g., missing MFA, weak session policy) - π Compliance (e.g., GDPR, PCI-DSS considerations) --- π§ STEP 4 β Hardened Code Provide the complete security-hardened rewrite of the code: - All vulnerabilities from Step 2 fully patched - Secure coding best practices applied throughout - Security-focused inline comments explaining WHY each security measure is in place - PEP8 compliant and production-ready - No placeholders or omissions β fully complete code only - Add necessary secure imports (e.g., secrets, hashlib, bleach, cryptography) - Use Python 3.10+ features where appropriate (match-case, typing) - Safe logging (no sensitive data) - Modern cryptography (no MD5/SHA1) - Input validation and sanitisation for all entry points --- π STEP 5 β Security Summary Card Security Score: Before Audit: [X] / 10 After Audit: [X] / 10 | Area | Before | After | |-----------------------|-------------------------|------------------------------| | Critical Issues | ... | ... | | High Issues | ... | ... | | Medium Issues | ... | ... | | Low Issues | ... | ... | | Informational | ... | ... | | OWASP Categories Hit | ... | ... | | Key Fixes Applied | ... | ... | | Advisory Flags Raised | ... | ... | | Overall Risk Level | [Critical/High/Medium] | [Low/Informational] | --- Here is my Python code: [PASTE YOUR CODE HERE]
No result recorded for this import yet. Tried it? File a report so the next person knows how it went.
Tried it
Structured reports from people who ran this prompt. They roll up into the per-model badges above.
No one has filed a report yet. Try the prompt and be the first.
Related prompts
- Claude api: reference for the Claude API / Anthropic SDK β model ids, pricing, params, streaming,β¦
Reference for the Claude API / Anthropic SDK β model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER β read BEFORE opening the target file; don't skip because it "looks like a one-liner" β whenever: the prompt names Claude/Anthropic in any fo
Coding Β· @anthropic
- Explain, test, and harden a Python regular expression
Explains a Python regex token by token, tests it against must-match and must-not-match samples, flags risky patterns like catastrophic backtracking, and returns a safer rewrite with a test table.
Coding Β· @f
- Simulate ATS resume scanning with a practical human-reviewer perspective
A detailed system-style prompt that makes the model simulate legacy, modern, and AI-driven applicant tracking system parsing, scoring, and keyword matching on a resume, with remediation advice. The result is an ATS-behaviour report with scores and fixes.
Coding Β· @thanos0000
- Find silent exception-handling smells in Python code
Scans Python files offline with ast to flag bare or swallowed excepts, silent fallbacks, lost causes, and other error-hiding patterns, returning file:line findings with severity and fix recipes.
Coding Β· @f
- Nginx config security review with fixes and checker script
Agent skill that reviews nginx configs for TLS, header, alias traversal, admin exposure and rate-limit problems, runs a stdlib checker, and returns a minimal route-preserving fixed config with reload and curl test steps.
Coding Β· @f
License: CC0v1 Β· published Nov 29, 2026
Comments
No comments yet. If you tried this prompt, say how it went.