feat: add sql_injection and hardcoded_secret patterns to security-guidance#53204
Open
gugli4ifenix-design wants to merge 2 commits intoanthropics:mainfrom
Open
feat: add sql_injection and hardcoded_secret patterns to security-guidance#53204gugli4ifenix-design wants to merge 2 commits intoanthropics:mainfrom
gugli4ifenix-design wants to merge 2 commits intoanthropics:mainfrom
Conversation
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.
This was referenced Apr 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds two commonly requested security patterns to the
security-guidanceplugin, bringing the total from 9 to 11.New Patterns
sql_injectionDetects 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_secretDetects 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.