feat(rules): core threat detection rules for coding agents#7
Open
MiguelHzBz wants to merge 2 commits intoleogr:mainfrom
Open
feat(rules): core threat detection rules for coding agents#7MiguelHzBz wants to merge 2 commits intoleogr:mainfrom
MiguelHzBz wants to merge 2 commits intoleogr:mainfrom
Conversation
Adds rules/default/threat_rules.yaml covering the primary threat categories for AI coding agent abuse: Credential access, dangerous commands (rm -rf, chmod 777, etc.), pipe-to-shell execution, encoded payload execution, data exfiltration via curl/wget, MCP tool call confirmation, writes to temp/staging paths, reverse shell patterns, and supply chain attack indicators. Includes test_threat_rules.sh with comprehensive test coverage (R1-R16).
b479d13 to
eb5fba6
Compare
- Add 'rm --recursive' to is_dangerous_command (T1: long-form flags bypass rm -rf/-fr string match) - Add absolute shell paths | /bin/bash, | /bin/sh, | /usr/bin/bash, | /usr/bin/sh to is_pipe_to_shell (T2: absolute path bypass) - Add node -e, node --eval, php -r to is_encoded_exec (T3: Node.js/PHP one-liners not covered) - Add IMDS numeric IP variants (2852039166, 0xa9fea9fe, 0251.0376.0251.0376) to is_imds_access (T4: encoded IP forms bypass literal 169.254.169.254) - Add is_read_credential_path macro and Deny credential file access via Read tool rule covering ~/.aws, ~/.ssh, ~/.gnupg, ~/.netrc, ~/.docker/config.json (T5: Bash-only credential rule misses direct Read tool calls) - Add test_threat_bypass.sh covering all 5 bypass sections (~20 test cases)
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
rules/user/threat_rules.yamlcovering the primary threat categories for AI coding agent abuse:/etc/passwd,~/.ssh/, AWS credentials, etc.)rm -rf,chmod 777,dd if=/dev/, etc.)curl | bash,wget | sh, etc.)base64 -d | bash,echo ... | python, etc.)/tmp/,/dev/shm/)Test plan
bash tests/test_threat_rules.sh— comprehensive test suite covering R1–R16