agentleFS
shdra06shdra06/ai-mind-map/.agents/skills/codebase-security-audit/SKILL.md

codebase-security-audit

Skill3 starsChanged 25 days agoMITView on GitHub

Automated static security analysis (SAST) and secrets audit engine. Use this skill whenever scanning code for leaked API keys, tokens, private keys, SQL injections, command injections, eval execution, XSS vulnerabilities, insecure CORS, or prior to committing code and creating pull requests.

  • Reads credentials

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Run automated static security scans across files and repositories to eliminate exposed credentials, unparameterized queries, command …

    line 15
  2. Distinctive:

    Pre-Commit Scan: Never report a feature or fix complete without running a security scan on all modified files.

    line 21
  3. Very specific:

    No Raw Shell Interpolation: Avoid child_process.exec(...) or os.system(...) with concatenated strings.

    line 24

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Codebase Security & Secrets Audit Skill

Run automated static security scans across files and repositories to eliminate exposed credentials, unparameterized queries, command injections, and common web security vulnerabilities before code is merged.


🛡️ The 5 Non-Negotiable Security Rules

  1. Pre-Commit Scan: Never report a feature or fix complete without running a security scan on all modified files.
  2. Zero Hardcoded Secrets: Secrets, JWT keys, API keys, and database passwords must NEVER be committed to source code—always verify environment variable extraction (process.env.*, os.environ[*]).
  3. Always Parameterize Queries: Raw string concatenation or template literals in database queries (query(...), execute(...), raw(...)) are prohibited.
  4. No Raw Shell Interpolation: Avoid child_process.exec(...) or os.system(...) with concatenated strings; use execFile or spawn with argument arrays.
  5. Sanitize Dynamic HTML: Prohibit unsanitized innerHTML or dangerouslySetInnerHTML. Use textContent or DOMPurify.

⚡ Quick Scan Workflows

Method A: Via AI Mind Map MCP Tool

// Scan the entire indexed project for vulnerabilities
mindmap_security_scan({
  "severity": "high" // 'critical' | 'high' | 'medium' | 'all'
})

// Or scan a specific edited file
mindmap_security_scan({
  "filePath": "src/controllers/auth.ts",
  "severity": "all"
})

Method B: Via Standalone CLI Scanner

# Scan whole repository
node .agents/skills/codebase-security-audit/scripts/security-audit.mjs

# Scan specific file
node .agents/skills/codebase-security-audit/scripts/security-audit.mjs --file src/auth.ts

# Filter by severity
node .agents/skills/codebase-security-audit/scripts/security-audit.mjs --severity critical

🔍 Vulnerability Checks & Detection Rules

SeverityVulnerability RuleTypical Pattern DetectedSafe Remediation
CRITICALgoogle_api_keyAIza[0-9A-Za-z-_]{35}Move to GOOGLE_MAPS_API_KEY env var.
CRITICALopenai_api_keysk-[a-zA-Z0-9]{48}Move to OPENAI_API_KEY env var.
CRITICALanthropic_api_keysk-ant-[a-zA-Z0-9_-]{32,}Move to ANTHROPIC_API_KEY env var.
CRITICALaws_access_keyAKIA[0-9A-Z]{16}Use IAM instance roles or AWS_ACCESS_KEY_ID.
CRITICALgithub_tokenghp_* / github_pat_*Revoke token and inject via CI/CD secrets.
CRITICALprivate_keyBEGIN RSA/EC PRIVATE KEYStore private keys in Secrets Manager or Vault.
CRITICALjwt_secret_tokenjwt.sign(..., 'secret123')Use process.env.JWT_SECRET.
HIGHsql_injectionquery("SELECT " + input)Use parameterized queries: query("SELECT $1", [input]).
HIGHcommand_injectionexec("git " + branch)Use execFile('git', [branch]).
HIGHeval_usageeval(code) / new Function()Use JSON.parse or safe AST parser.
HIGHxss_inner_htmlelement.innerHTML = inputUse element.textContent or DOMPurify.sanitize(input).
HIGHinsecure_corsorigin: '*', credentials: trueSpecify explicit allowed origins.
HIGHunvalidated_redirectres.redirect(req.query.url)Validate redirect against allowed URL whitelist.

See references/vulnerability-patterns.md for full regex details and attack vectors.


✅ Self-Verification Checklist Before Merging Code

  • Did you run mindmap_security_scan on all edited files?
  • Are any new API keys or credentials extracted into .env.example?
  • Are all database operations parameterized?
  • Are shell command executions isolated to argument arrays?
  • Are CORS headers restricted to trusted origins?

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.