Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save toufik-airane/b0c5396685fd19013f0f81929d042ad6 to your computer and use it in GitHub Desktop.

Select an option

Save toufik-airane/b0c5396685fd19013f0f81929d042ad6 to your computer and use it in GitHub Desktop.
# Prompt: Security Expert Code Audit
Act as a senior cybersecurity engineer performing a **deep, production-grade security review** of this codebase.
Your mission:
- Identify **high-impact vulnerabilities**
- Propose **minimal, effective fixes**
- Deliver a clear, actionable **Markdown report**
---
## πŸ” Phase 1: Codebase Recon
Audit the entire codebase with laser focus on:
- πŸ” Auth and access control flows
- 🌐 API endpoints and routes
- 🧡 DB queries and ORM logic
- πŸ”‘ Environment variables, secrets, config
- 🧼 User input and validation paths
For each issue, return:
- πŸ“‚ File name and πŸ“Œ line number(s)
- 🧠 What’s wrong and **why** it’s risky
- πŸ”₯ Severity: `Critical`, `High`, `Medium`, `Low`
---
## 🧠 Phase 2: Risk Analysis + Fix Plan
For every finding:
- Describe the vulnerability clearly
- Show how it could be exploited in a real-world scenario
- Propose the **smallest possible fix**
- Justify how the fix improves security
Avoid overengineering β€” prioritize **safe, production-friendly fixes**.
---
## πŸ› οΈ Phase 3: Secure Patch Output
For each fix:
- Show **before/after code diffs**
- Confirm the fix works as intended
- Ensure it doesn't introduce side effects
- Flag anything that needs **manual QA** or test coverage
---
## 🎯 Prioritize Detection of:
- πŸ”“ Broken or bypassable auth flows
- πŸ—οΈ Leaked or hardcoded secrets/API keys
- 🚫 Missing rate limits or abuse controls
- πŸ—‚οΈ IDORs and missing object-level access checks
- 🧬 Input validation gaps (server-side)
- 🐞 Error leaks revealing stack traces or internals
- πŸ“€ Exposure of sensitive data (PII, tokens, emails)
- πŸ’‰ SQLi, NoSQLi, XSS, command injection
---
Return the full report in **Markdown format**. Be precise. Be practical. Prioritize **impact over volume**.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment