Skip to content

feat: add sql_injection and hardcoded_secret patterns to security-guidance#53204

Open
gugli4ifenix-design wants to merge 2 commits intoanthropics:mainfrom
gugli4ifenix-design:feat/security-guidance-sql-secrets
Open

feat: add sql_injection and hardcoded_secret patterns to security-guidance#53204
gugli4ifenix-design wants to merge 2 commits intoanthropics:mainfrom
gugli4ifenix-design:feat/security-guidance-sql-secrets

Conversation

@gugli4ifenix-design
Copy link
Copy Markdown

Summary

Adds two commonly requested security patterns to the security-guidance plugin, bringing the total from 9 to 11.

New Patterns

sql_injection

Detects SQL queries built with f-strings or string concatenation:

  • f"SELECT ...", f"INSERT ...", etc.
  • "SELECT " + ...

Suggests parameterized queries (SQLite ?, PostgreSQL/MySQL %s) or ORM usage.

hardcoded_secret

Detects hardcoded passwords, API keys, and secret keys:

  • password = "...", api_key = "...", API_KEY = "..."

Suggests environment variables (os.environ, process.env) or secrets managers.

Why These Two

SQL injection and hardcoded secrets are consistently ranked in the OWASP Top 10 and CWE Top 25. The existing 9 patterns cover XSS and code injection well, but these two common vulnerability classes were missing.

Testing

Verified the hook loads correctly with all 11 patterns and produces no syntax errors.

The security-guidance plugin was the only plugin in the directory
missing a README. This adds documentation covering:

- Overview of the PreToolUse hook
- Table of all 9 security patterns monitored
- How the hook works (detection, blocking, dedup)
- Configuration (ENABLE_SECURITY_REMINDER env var)
- Installation instructions
…dance

Adds two commonly requested security patterns:

- sql_injection: Detects SQL queries built with f-strings or string
  concatenation. Suggests parameterized queries instead.
- hardcoded_secret: Detects hardcoded passwords, API keys, and secret
  keys. Suggests environment variables or secrets managers.

This brings the total from 9 to 11 monitored patterns.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant