The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu
Go agent-ai-cliagent-harnessesagent-securitybrowser-extensionciclaude-codecloudcodexcursordetection-engineeringjevknowledge-basememorymobile-device-managementobservabilitysecuritysecurity-information-and-event-managementsecurity-toolstelemetrytraces
rules: leave .env template sources out of the cp read branch
Claude5cde1b7bc30e
diff --git a/pkg/asymptoteobserve/rulestore/baseline/secret-read-then-egress.rule.yaml b/pkg/asymptoteobserve/rulestore/baseline/secret-read-then-egress.rule.yamlindex e049dd23..98e1d009 100644--- a/pkg/asymptoteobserve/rulestore/baseline/secret-read-then-egress.rule.yaml+++ b/pkg/asymptoteobserve/rulestore/baseline/secret-read-then-egress.rule.yaml@@ -29,7 +29,7 @@ correlation:e.file.path.matches("(\\.env|credentials|id_rsa|\\.aws/|\\.ssh/|secrets?)")) || (e.event.action == "command.executed" &&- (e.command.command.matches("(?i)(^|[;&|(`]|\\$\\()\\s*(sudo\\s+)?(cat|tac|head|tail|less|more|bat|nl|strings|xxd|od|hexdump|base64)\\b[^;&|>\\n]*?[\\s/'\"=](\\.env(\\.[\\w.-]+)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)($|[\\s'\";|&)<>])") || e.command.command.matches("(^|[;&|(`]|\\$\\()\\s*(sudo\\s+)?(tar|zip)(?:\\s+(?:(?:[^\\s;&|>-][^\\s;&|>]*|-|-[^\\s;&|>x-][^\\s;&|>]*|-x[^\\s;&|>]+|--(?:|[^\\s;&|>e][^\\s;&|>]*|e|e[^\\s;&|>x][^\\s;&|>]*|ex|ex[^\\s;&|>c][^\\s;&|>]*|exc|exc[^\\s;&|>l][^\\s;&|>]*|excl|excl[^\\s;&|>u][^\\s;&|>]*|exclu|exclu[^\\s;&|>d][^\\s;&|>]*|exclud|exclud[^\\s;&|>e][^\\s;&|>]*|exclude[^\\s;&|>]+))|--exclude(?:=[^\\s;&|>]*|\\s+[^\\s;&|>]+)|-x(?:\\s+[^\\s;&|>-][^\\s;&|>]*)*\\s+(?:-|-[^\\s;&|>x-][^\\s;&|>]*|-x[^\\s;&|>]+|--(?:|[^\\s;&|>e][^\\s;&|>]*|e|e[^\\s;&|>x][^\\s;&|>]*|ex|ex[^\\s;&|>c][^\\s;&|>]*|exc|exc[^\\s;&|>l][^\\s;&|>]*|excl|excl[^\\s;&|>u][^\\s;&|>]*|exclu|exclu[^\\s;&|>d][^\\s;&|>]*|exclud|exclud[^\\s;&|>e][^\\s;&|>]*|exclude[^\\s;&|>]+))))*?\\s+['\"]?(?:[^\\s;&|>'\"=-][^\\s;&|>'\"]*/)?(?i:\\.env(\\.[\\w.-]+)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)($|[\\s'\";|&)<>])") || e.command.command.matches("(?i)(^|[;&|(`]|\\$\\()\\s*(sudo\\s+)?cp\\b[^;&|>\\n]*?[\\s/'\"=](\\.env(\\.[\\w.-]+)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)['\"]?\\s+[^\\s;&|<>]") || e.command.command.matches("(?i)(^|[;&|(`]|\\$\\()\\s*(sudo\\s+)?(grep|egrep|fgrep|rg|awk|sed|jq)\\b[^;&|>\\n]*?(\\s['\"]?[^\\s;&|'\"]*/(\\.env(\\.[\\w.-]+)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)($|[\\s'\";|&)<>])|\\s[^\\s-][^\\s;&|>]*\\s+(\\.env(\\.[\\w.-]+)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)\\s*($|[;&|)]))")) && !e.command.command.matches("(?i)^\\s*cp\\s+(-\\S+\\s+)*['\"]?[^\\s;&|'\"]*\\.env\\.(example|sample|template|dist)['\"]?\\s+['\"]?[^\\s;&|'\"]*\\.env['\"]?\\s*$")+ (e.command.command.matches("(?i)(^|[;&|(`]|\\$\\()\\s*(sudo\\s+)?(cat|tac|head|tail|less|more|bat|nl|strings|xxd|od|hexdump|base64)\\b[^;&|>\\n]*?[\\s/'\"=](\\.env(\\.[\\w.-]+)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)($|[\\s'\";|&)<>])") || e.command.command.matches("(^|[;&|(`]|\\$\\()\\s*(sudo\\s+)?(tar|zip)(?:\\s+(?:(?:[^\\s;&|>-][^\\s;&|>]*|-|-[^\\s;&|>x-][^\\s;&|>]*|-x[^\\s;&|>]+|--(?:|[^\\s;&|>e][^\\s;&|>]*|e|e[^\\s;&|>x][^\\s;&|>]*|ex|ex[^\\s;&|>c][^\\s;&|>]*|exc|exc[^\\s;&|>l][^\\s;&|>]*|excl|excl[^\\s;&|>u][^\\s;&|>]*|exclu|exclu[^\\s;&|>d][^\\s;&|>]*|exclud|exclud[^\\s;&|>e][^\\s;&|>]*|exclude[^\\s;&|>]+))|--exclude(?:=[^\\s;&|>]*|\\s+[^\\s;&|>]+)|-x(?:\\s+[^\\s;&|>-][^\\s;&|>]*)*\\s+(?:-|-[^\\s;&|>x-][^\\s;&|>]*|-x[^\\s;&|>]+|--(?:|[^\\s;&|>e][^\\s;&|>]*|e|e[^\\s;&|>x][^\\s;&|>]*|ex|ex[^\\s;&|>c][^\\s;&|>]*|exc|exc[^\\s;&|>l][^\\s;&|>]*|excl|excl[^\\s;&|>u][^\\s;&|>]*|exclu|exclu[^\\s;&|>d][^\\s;&|>]*|exclud|exclud[^\\s;&|>e][^\\s;&|>]*|exclude[^\\s;&|>]+))))*?\\s+['\"]?(?:[^\\s;&|>'\"=-][^\\s;&|>'\"]*/)?(?i:\\.env(\\.[\\w.-]+)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)($|[\\s'\";|&)<>])") || e.command.command.matches("(?i)(^|[;&|(`]|\\$\\()\\s*(sudo\\s+)?cp\\b[^;&|>\\n]*?[\\s/'\"=](\\.env(\\.(?:[-0-9_abcfghijklmnopqruvwxyz][\\w-]*|d|d[-0-9_abcdefghjklmnopqrstuvwxyz][\\w-]*|di|di[-0-9_abcdefghijklmnopqrtuvwxyz][\\w-]*|dis|dis[-0-9_abcdefghijklmnopqrsuvwxyz][\\w-]*|dist[\\w-]+|e|e[-0-9_abcdefghijklmnopqrstuvwyz][\\w-]*|ex|ex[-0-9_bcdefghijklmnopqrstuvwxyz][\\w-]*|exa|exa[-0-9_abcdefghijklnopqrstuvwxyz][\\w-]*|exam|exam[-0-9_abcdefghijklmnoqrstuvwxyz][\\w-]*|examp|examp[-0-9_abcdefghijkmnopqrstuvwxyz][\\w-]*|exampl|exampl[-0-9_abcdfghijklmnopqrstuvwxyz][\\w-]*|example[\\w-]+|s|s[-0-9_bcdefghijklmnopqrstuvwxyz][\\w-]*|sa|sa[-0-9_abcdefghijklnopqrstuvwxyz][\\w-]*|sam|sam[-0-9_abcdefghijklmnoqrstuvwxyz][\\w-]*|samp|samp[-0-9_abcdefghijkmnopqrstuvwxyz][\\w-]*|sampl|sampl[-0-9_abcdfghijklmnopqrstuvwxyz][\\w-]*|sample[\\w-]+|t|t[-0-9_abcdfghijklmnopqrstuvwxyz][\\w-]*|te|te[-0-9_abcdefghijklnopqrstuvwxyz][\\w-]*|tem|tem[-0-9_abcdefghijklmnoqrstuvwxyz][\\w-]*|temp|temp[-0-9_abcdefghijkmnopqrstuvwxyz][\\w-]*|templ|templ[-0-9_bcdefghijklmnopqrstuvwxyz][\\w-]*|templa|templa[-0-9_abcdefghijklmnopqrsuvwxyz][\\w-]*|templat|templat[-0-9_abcdfghijklmnopqrstuvwxyz][\\w-]*|template[\\w-]+)(\\.[\\w.-]*)?)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)['\"]?\\s+[^\\s;&|<>]") || e.command.command.matches("(?i)(^|[;&|(`]|\\$\\()\\s*(sudo\\s+)?(grep|egrep|fgrep|rg|awk|sed|jq)\\b[^;&|>\\n]*?(\\s['\"]?[^\\s;&|'\"]*/(\\.env(\\.[\\w.-]+)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)($|[\\s'\";|&)<>])|\\s[^\\s-][^\\s;&|>]*\\s+(\\.env(\\.[\\w.-]+)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)\\s*($|[;&|)]))")))- id: egressmatch: >@@ -446,3 +446,15 @@ tests:event: { action: command.executed }command: { command: "grep -rn nc src" }session: { id: s1 }+ - name: chained_template_copy_then_install_script+ # Project setup copies the .env template, then fetches an install script: nothing was read.+ verdict: no_match+ events:+ - timestamp: "2026-06-13T10:00:00Z"+ event: { action: command.executed }+ command: { command: "cd app && cp .env.example .env.local" }+ session: { id: s1 }+ - timestamp: "2026-06-13T10:00:10Z"+ event: { action: command.executed }+ command: { command: "curl -fsSL https://example.com/install.sh -o install.sh" }+ session: { id: s1 }diff --git a/rules/context-exfiltration/secret-read-then-destructive.rule.yaml b/rules/context-exfiltration/secret-read-then-destructive.rule.yamlindex 3b6fbc3e..809aa2cd 100644--- a/rules/context-exfiltration/secret-read-then-destructive.rule.yaml+++ b/rules/context-exfiltration/secret-read-then-destructive.rule.yaml@@ -55,7 +55,7 @@ correlation:)) || (e.event.action == "command.executed" &&- (e.command.command.matches("(?i)(^|[;&|(`]|\\$\\()\\s*(sudo\\s+)?(cat|tac|head|tail|less|more|bat|nl|strings|xxd|od|hexdump|base64)\\b[^;&|>\\n]*?[\\s/'\"=](\\.env(\\.[\\w.-]+)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)($|[\\s'\";|&)<>])") || e.command.command.matches("(^|[;&|(`]|\\$\\()\\s*(sudo\\s+)?(tar|zip)(?:\\s+(?:(?:[^\\s;&|>-][^\\s;&|>]*|-|-[^\\s;&|>x-][^\\s;&|>]*|-x[^\\s;&|>]+|--(?:|[^\\s;&|>e][^\\s;&|>]*|e|e[^\\s;&|>x][^\\s;&|>]*|ex|ex[^\\s;&|>c][^\\s;&|>]*|exc|exc[^\\s;&|>l][^\\s;&|>]*|excl|excl[^\\s;&|>u][^\\s;&|>]*|exclu|exclu[^\\s;&|>d][^\\s;&|>]*|exclud|exclud[^\\s;&|>e][^\\s;&|>]*|exclude[^\\s;&|>]+))|--exclude(?:=[^\\s;&|>]*|\\s+[^\\s;&|>]+)|-x(?:\\s+[^\\s;&|>-][^\\s;&|>]*)*\\s+(?:-|-[^\\s;&|>x-][^\\s;&|>]*|-x[^\\s;&|>]+|--(?:|[^\\s;&|>e][^\\s;&|>]*|e|e[^\\s;&|>x][^\\s;&|>]*|ex|ex[^\\s;&|>c][^\\s;&|>]*|exc|exc[^\\s;&|>l][^\\s;&|>]*|excl|excl[^\\s;&|>u][^\\s;&|>]*|exclu|exclu[^\\s;&|>d][^\\s;&|>]*|exclud|exclud[^\\s;&|>e][^\\s;&|>]*|exclude[^\\s;&|>]+))))*?\\s+['\"]?(?:[^\\s;&|>'\"=-][^\\s;&|>'\"]*/)?(?i:\\.env(\\.[\\w.-]+)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)($|[\\s'\";|&)<>])") || e.command.command.matches("(?i)(^|[;&|(`]|\\$\\()\\s*(sudo\\s+)?cp\\b[^;&|>\\n]*?[\\s/'\"=](\\.env(\\.[\\w.-]+)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)['\"]?\\s+[^\\s;&|<>]") || e.command.command.matches("(?i)(^|[;&|(`]|\\$\\()\\s*(sudo\\s+)?(grep|egrep|fgrep|rg|awk|sed|jq)\\b[^;&|>\\n]*?(\\s['\"]?[^\\s;&|'\"]*/(\\.env(\\.[\\w.-]+)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)($|[\\s'\";|&)<>])|\\s[^\\s-][^\\s;&|>]*\\s+(\\.env(\\.[\\w.-]+)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)\\s*($|[;&|)]))")) && !e.command.command.matches("(?i)^\\s*cp\\s+(-\\S+\\s+)*['\"]?[^\\s;&|'\"]*\\.env\\.(example|sample|template|dist)['\"]?\\s+['\"]?[^\\s;&|'\"]*\\.env['\"]?\\s*$")+ (e.command.command.matches("(?i)(^|[;&|(`]|\\$\\()\\s*(sudo\\s+)?(cat|tac|head|tail|less|more|bat|nl|strings|xxd|od|hexdump|base64)\\b[^;&|>\\n]*?[\\s/'\"=](\\.env(\\.[\\w.-]+)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)($|[\\s'\";|&)<>])") || e.command.command.matches("(^|[;&|(`]|\\$\\()\\s*(sudo\\s+)?(tar|zip)(?:\\s+(?:(?:[^\\s;&|>-][^\\s;&|>]*|-|-[^\\s;&|>x-][^\\s;&|>]*|-x[^\\s;&|>]+|--(?:|[^\\s;&|>e][^\\s;&|>]*|e|e[^\\s;&|>x][^\\s;&|>]*|ex|ex[^\\s;&|>c][^\\s;&|>]*|exc|exc[^\\s;&|>l][^\\s;&|>]*|excl|excl[^\\s;&|>u][^\\s;&|>]*|exclu|exclu[^\\s;&|>d][^\\s;&|>]*|exclud|exclud[^\\s;&|>e][^\\s;&|>]*|exclude[^\\s;&|>]+))|--exclude(?:=[^\\s;&|>]*|\\s+[^\\s;&|>]+)|-x(?:\\s+[^\\s;&|>-][^\\s;&|>]*)*\\s+(?:-|-[^\\s;&|>x-][^\\s;&|>]*|-x[^\\s;&|>]+|--(?:|[^\\s;&|>e][^\\s;&|>]*|e|e[^\\s;&|>x][^\\s;&|>]*|ex|ex[^\\s;&|>c][^\\s;&|>]*|exc|exc[^\\s;&|>l][^\\s;&|>]*|excl|excl[^\\s;&|>u][^\\s;&|>]*|exclu|exclu[^\\s;&|>d][^\\s;&|>]*|exclud|exclud[^\\s;&|>e][^\\s;&|>]*|exclude[^\\s;&|>]+))))*?\\s+['\"]?(?:[^\\s;&|>'\"=-][^\\s;&|>'\"]*/)?(?i:\\.env(\\.[\\w.-]+)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)($|[\\s'\";|&)<>])") || e.command.command.matches("(?i)(^|[;&|(`]|\\$\\()\\s*(sudo\\s+)?cp\\b[^;&|>\\n]*?[\\s/'\"=](\\.env(\\.(?:[-0-9_abcfghijklmnopqruvwxyz][\\w-]*|d|d[-0-9_abcdefghjklmnopqrstuvwxyz][\\w-]*|di|di[-0-9_abcdefghijklmnopqrtuvwxyz][\\w-]*|dis|dis[-0-9_abcdefghijklmnopqrsuvwxyz][\\w-]*|dist[\\w-]+|e|e[-0-9_abcdefghijklmnopqrstuvwyz][\\w-]*|ex|ex[-0-9_bcdefghijklmnopqrstuvwxyz][\\w-]*|exa|exa[-0-9_abcdefghijklnopqrstuvwxyz][\\w-]*|exam|exam[-0-9_abcdefghijklmnoqrstuvwxyz][\\w-]*|examp|examp[-0-9_abcdefghijkmnopqrstuvwxyz][\\w-]*|exampl|exampl[-0-9_abcdfghijklmnopqrstuvwxyz][\\w-]*|example[\\w-]+|s|s[-0-9_bcdefghijklmnopqrstuvwxyz][\\w-]*|sa|sa[-0-9_abcdefghijklnopqrstuvwxyz][\\w-]*|sam|sam[-0-9_abcdefghijklmnoqrstuvwxyz][\\w-]*|samp|samp[-0-9_abcdefghijkmnopqrstuvwxyz][\\w-]*|sampl|sampl[-0-9_abcdfghijklmnopqrstuvwxyz][\\w-]*|sample[\\w-]+|t|t[-0-9_abcdfghijklmnopqrstuvwxyz][\\w-]*|te|te[-0-9_abcdefghijklnopqrstuvwxyz][\\w-]*|tem|tem[-0-9_abcdefghijklmnoqrstuvwxyz][\\w-]*|temp|temp[-0-9_abcdefghijkmnopqrstuvwxyz][\\w-]*|templ|templ[-0-9_bcdefghijklmnopqrstuvwxyz][\\w-]*|templa|templa[-0-9_abcdefghijklmnopqrsuvwxyz][\\w-]*|templat|templat[-0-9_abcdfghijklmnopqrstuvwxyz][\\w-]*|template[\\w-]+)(\\.[\\w.-]*)?)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)['\"]?\\s+[^\\s;&|<>]") || e.command.command.matches("(?i)(^|[;&|(`]|\\$\\()\\s*(sudo\\s+)?(grep|egrep|fgrep|rg|awk|sed|jq)\\b[^;&|>\\n]*?(\\s['\"]?[^\\s;&|'\"]*/(\\.env(\\.[\\w.-]+)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)($|[\\s'\";|&)<>])|\\s[^\\s-][^\\s;&|>]*\\s+(\\.env(\\.[\\w.-]+)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)\\s*($|[;&|)]))")))- id: recursive_deletematch: >diff --git a/rules/context-exfiltration/secret-read-then-egress.rule.yaml b/rules/context-exfiltration/secret-read-then-egress.rule.yamlindex e049dd23..98e1d009 100644--- a/rules/context-exfiltration/secret-read-then-egress.rule.yaml+++ b/rules/context-exfiltration/secret-read-then-egress.rule.yaml@@ -29,7 +29,7 @@ correlation:e.file.path.matches("(\\.env|credentials|id_rsa|\\.aws/|\\.ssh/|secrets?)")) || (e.event.action == "command.executed" &&- (e.command.command.matches("(?i)(^|[;&|(`]|\\$\\()\\s*(sudo\\s+)?(cat|tac|head|tail|less|more|bat|nl|strings|xxd|od|hexdump|base64)\\b[^;&|>\\n]*?[\\s/'\"=](\\.env(\\.[\\w.-]+)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)($|[\\s'\";|&)<>])") || e.command.command.matches("(^|[;&|(`]|\\$\\()\\s*(sudo\\s+)?(tar|zip)(?:\\s+(?:(?:[^\\s;&|>-][^\\s;&|>]*|-|-[^\\s;&|>x-][^\\s;&|>]*|-x[^\\s;&|>]+|--(?:|[^\\s;&|>e][^\\s;&|>]*|e|e[^\\s;&|>x][^\\s;&|>]*|ex|ex[^\\s;&|>c][^\\s;&|>]*|exc|exc[^\\s;&|>l][^\\s;&|>]*|excl|excl[^\\s;&|>u][^\\s;&|>]*|exclu|exclu[^\\s;&|>d][^\\s;&|>]*|exclud|exclud[^\\s;&|>e][^\\s;&|>]*|exclude[^\\s;&|>]+))|--exclude(?:=[^\\s;&|>]*|\\s+[^\\s;&|>]+)|-x(?:\\s+[^\\s;&|>-][^\\s;&|>]*)*\\s+(?:-|-[^\\s;&|>x-][^\\s;&|>]*|-x[^\\s;&|>]+|--(?:|[^\\s;&|>e][^\\s;&|>]*|e|e[^\\s;&|>x][^\\s;&|>]*|ex|ex[^\\s;&|>c][^\\s;&|>]*|exc|exc[^\\s;&|>l][^\\s;&|>]*|excl|excl[^\\s;&|>u][^\\s;&|>]*|exclu|exclu[^\\s;&|>d][^\\s;&|>]*|exclud|exclud[^\\s;&|>e][^\\s;&|>]*|exclude[^\\s;&|>]+))))*?\\s+['\"]?(?:[^\\s;&|>'\"=-][^\\s;&|>'\"]*/)?(?i:\\.env(\\.[\\w.-]+)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)($|[\\s'\";|&)<>])") || e.command.command.matches("(?i)(^|[;&|(`]|\\$\\()\\s*(sudo\\s+)?cp\\b[^;&|>\\n]*?[\\s/'\"=](\\.env(\\.[\\w.-]+)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)['\"]?\\s+[^\\s;&|<>]") || e.command.command.matches("(?i)(^|[;&|(`]|\\$\\()\\s*(sudo\\s+)?(grep|egrep|fgrep|rg|awk|sed|jq)\\b[^;&|>\\n]*?(\\s['\"]?[^\\s;&|'\"]*/(\\.env(\\.[\\w.-]+)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)($|[\\s'\";|&)<>])|\\s[^\\s-][^\\s;&|>]*\\s+(\\.env(\\.[\\w.-]+)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)\\s*($|[;&|)]))")) && !e.command.command.matches("(?i)^\\s*cp\\s+(-\\S+\\s+)*['\"]?[^\\s;&|'\"]*\\.env\\.(example|sample|template|dist)['\"]?\\s+['\"]?[^\\s;&|'\"]*\\.env['\"]?\\s*$")+ (e.command.command.matches("(?i)(^|[;&|(`]|\\$\\()\\s*(sudo\\s+)?(cat|tac|head|tail|less|more|bat|nl|strings|xxd|od|hexdump|base64)\\b[^;&|>\\n]*?[\\s/'\"=](\\.env(\\.[\\w.-]+)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)($|[\\s'\";|&)<>])") || e.command.command.matches("(^|[;&|(`]|\\$\\()\\s*(sudo\\s+)?(tar|zip)(?:\\s+(?:(?:[^\\s;&|>-][^\\s;&|>]*|-|-[^\\s;&|>x-][^\\s;&|>]*|-x[^\\s;&|>]+|--(?:|[^\\s;&|>e][^\\s;&|>]*|e|e[^\\s;&|>x][^\\s;&|>]*|ex|ex[^\\s;&|>c][^\\s;&|>]*|exc|exc[^\\s;&|>l][^\\s;&|>]*|excl|excl[^\\s;&|>u][^\\s;&|>]*|exclu|exclu[^\\s;&|>d][^\\s;&|>]*|exclud|exclud[^\\s;&|>e][^\\s;&|>]*|exclude[^\\s;&|>]+))|--exclude(?:=[^\\s;&|>]*|\\s+[^\\s;&|>]+)|-x(?:\\s+[^\\s;&|>-][^\\s;&|>]*)*\\s+(?:-|-[^\\s;&|>x-][^\\s;&|>]*|-x[^\\s;&|>]+|--(?:|[^\\s;&|>e][^\\s;&|>]*|e|e[^\\s;&|>x][^\\s;&|>]*|ex|ex[^\\s;&|>c][^\\s;&|>]*|exc|exc[^\\s;&|>l][^\\s;&|>]*|excl|excl[^\\s;&|>u][^\\s;&|>]*|exclu|exclu[^\\s;&|>d][^\\s;&|>]*|exclud|exclud[^\\s;&|>e][^\\s;&|>]*|exclude[^\\s;&|>]+))))*?\\s+['\"]?(?:[^\\s;&|>'\"=-][^\\s;&|>'\"]*/)?(?i:\\.env(\\.[\\w.-]+)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)($|[\\s'\";|&)<>])") || e.command.command.matches("(?i)(^|[;&|(`]|\\$\\()\\s*(sudo\\s+)?cp\\b[^;&|>\\n]*?[\\s/'\"=](\\.env(\\.(?:[-0-9_abcfghijklmnopqruvwxyz][\\w-]*|d|d[-0-9_abcdefghjklmnopqrstuvwxyz][\\w-]*|di|di[-0-9_abcdefghijklmnopqrtuvwxyz][\\w-]*|dis|dis[-0-9_abcdefghijklmnopqrsuvwxyz][\\w-]*|dist[\\w-]+|e|e[-0-9_abcdefghijklmnopqrstuvwyz][\\w-]*|ex|ex[-0-9_bcdefghijklmnopqrstuvwxyz][\\w-]*|exa|exa[-0-9_abcdefghijklnopqrstuvwxyz][\\w-]*|exam|exam[-0-9_abcdefghijklmnoqrstuvwxyz][\\w-]*|examp|examp[-0-9_abcdefghijkmnopqrstuvwxyz][\\w-]*|exampl|exampl[-0-9_abcdfghijklmnopqrstuvwxyz][\\w-]*|example[\\w-]+|s|s[-0-9_bcdefghijklmnopqrstuvwxyz][\\w-]*|sa|sa[-0-9_abcdefghijklnopqrstuvwxyz][\\w-]*|sam|sam[-0-9_abcdefghijklmnoqrstuvwxyz][\\w-]*|samp|samp[-0-9_abcdefghijkmnopqrstuvwxyz][\\w-]*|sampl|sampl[-0-9_abcdfghijklmnopqrstuvwxyz][\\w-]*|sample[\\w-]+|t|t[-0-9_abcdfghijklmnopqrstuvwxyz][\\w-]*|te|te[-0-9_abcdefghijklnopqrstuvwxyz][\\w-]*|tem|tem[-0-9_abcdefghijklmnoqrstuvwxyz][\\w-]*|temp|temp[-0-9_abcdefghijkmnopqrstuvwxyz][\\w-]*|templ|templ[-0-9_bcdefghijklmnopqrstuvwxyz][\\w-]*|templa|templa[-0-9_abcdefghijklmnopqrsuvwxyz][\\w-]*|templat|templat[-0-9_abcdfghijklmnopqrstuvwxyz][\\w-]*|template[\\w-]+)(\\.[\\w.-]*)?)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)['\"]?\\s+[^\\s;&|<>]") || e.command.command.matches("(?i)(^|[;&|(`]|\\$\\()\\s*(sudo\\s+)?(grep|egrep|fgrep|rg|awk|sed|jq)\\b[^;&|>\\n]*?(\\s['\"]?[^\\s;&|'\"]*/(\\.env(\\.[\\w.-]+)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)($|[\\s'\";|&)<>])|\\s[^\\s-][^\\s;&|>]*\\s+(\\.env(\\.[\\w.-]+)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)\\s*($|[;&|)]))")))- id: egressmatch: >@@ -446,3 +446,15 @@ tests:event: { action: command.executed }command: { command: "grep -rn nc src" }session: { id: s1 }+ - name: chained_template_copy_then_install_script+ # Project setup copies the .env template, then fetches an install script: nothing was read.+ verdict: no_match+ events:+ - timestamp: "2026-06-13T10:00:00Z"+ event: { action: command.executed }+ command: { command: "cd app && cp .env.example .env.local" }+ session: { id: s1 }+ - timestamp: "2026-06-13T10:00:10Z"+ event: { action: command.executed }+ command: { command: "curl -fsSL https://example.com/install.sh -o install.sh" }+ session: { id: s1 }diff --git a/rules/context-exfiltration/secret-read-then-external-mcp.rule.yaml b/rules/context-exfiltration/secret-read-then-external-mcp.rule.yamlindex cc784f6e..ca2ba3df 100644--- a/rules/context-exfiltration/secret-read-then-external-mcp.rule.yaml+++ b/rules/context-exfiltration/secret-read-then-external-mcp.rule.yaml@@ -31,7 +31,7 @@ correlation:)) || (e.event.action == "command.executed" &&- (e.command.command.matches("(?i)(^|[;&|(`]|\\$\\()\\s*(sudo\\s+)?(cat|tac|head|tail|less|more|bat|nl|strings|xxd|od|hexdump|base64)\\b[^;&|>\\n]*?[\\s/'\"=](\\.env(\\.[\\w.-]+)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)($|[\\s'\";|&)<>])") || e.command.command.matches("(^|[;&|(`]|\\$\\()\\s*(sudo\\s+)?(tar|zip)(?:\\s+(?:(?:[^\\s;&|>-][^\\s;&|>]*|-|-[^\\s;&|>x-][^\\s;&|>]*|-x[^\\s;&|>]+|--(?:|[^\\s;&|>e][^\\s;&|>]*|e|e[^\\s;&|>x][^\\s;&|>]*|ex|ex[^\\s;&|>c][^\\s;&|>]*|exc|exc[^\\s;&|>l][^\\s;&|>]*|excl|excl[^\\s;&|>u][^\\s;&|>]*|exclu|exclu[^\\s;&|>d][^\\s;&|>]*|exclud|exclud[^\\s;&|>e][^\\s;&|>]*|exclude[^\\s;&|>]+))|--exclude(?:=[^\\s;&|>]*|\\s+[^\\s;&|>]+)|-x(?:\\s+[^\\s;&|>-][^\\s;&|>]*)*\\s+(?:-|-[^\\s;&|>x-][^\\s;&|>]*|-x[^\\s;&|>]+|--(?:|[^\\s;&|>e][^\\s;&|>]*|e|e[^\\s;&|>x][^\\s;&|>]*|ex|ex[^\\s;&|>c][^\\s;&|>]*|exc|exc[^\\s;&|>l][^\\s;&|>]*|excl|excl[^\\s;&|>u][^\\s;&|>]*|exclu|exclu[^\\s;&|>d][^\\s;&|>]*|exclud|exclud[^\\s;&|>e][^\\s;&|>]*|exclude[^\\s;&|>]+))))*?\\s+['\"]?(?:[^\\s;&|>'\"=-][^\\s;&|>'\"]*/)?(?i:\\.env(\\.[\\w.-]+)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)($|[\\s'\";|&)<>])") || e.command.command.matches("(?i)(^|[;&|(`]|\\$\\()\\s*(sudo\\s+)?cp\\b[^;&|>\\n]*?[\\s/'\"=](\\.env(\\.[\\w.-]+)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)['\"]?\\s+[^\\s;&|<>]") || e.command.command.matches("(?i)(^|[;&|(`]|\\$\\()\\s*(sudo\\s+)?(grep|egrep|fgrep|rg|awk|sed|jq)\\b[^;&|>\\n]*?(\\s['\"]?[^\\s;&|'\"]*/(\\.env(\\.[\\w.-]+)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)($|[\\s'\";|&)<>])|\\s[^\\s-][^\\s;&|>]*\\s+(\\.env(\\.[\\w.-]+)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)\\s*($|[;&|)]))")) && !e.command.command.matches("(?i)^\\s*cp\\s+(-\\S+\\s+)*['\"]?[^\\s;&|'\"]*\\.env\\.(example|sample|template|dist)['\"]?\\s+['\"]?[^\\s;&|'\"]*\\.env['\"]?\\s*$")+ (e.command.command.matches("(?i)(^|[;&|(`]|\\$\\()\\s*(sudo\\s+)?(cat|tac|head|tail|less|more|bat|nl|strings|xxd|od|hexdump|base64)\\b[^;&|>\\n]*?[\\s/'\"=](\\.env(\\.[\\w.-]+)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)($|[\\s'\";|&)<>])") || e.command.command.matches("(^|[;&|(`]|\\$\\()\\s*(sudo\\s+)?(tar|zip)(?:\\s+(?:(?:[^\\s;&|>-][^\\s;&|>]*|-|-[^\\s;&|>x-][^\\s;&|>]*|-x[^\\s;&|>]+|--(?:|[^\\s;&|>e][^\\s;&|>]*|e|e[^\\s;&|>x][^\\s;&|>]*|ex|ex[^\\s;&|>c][^\\s;&|>]*|exc|exc[^\\s;&|>l][^\\s;&|>]*|excl|excl[^\\s;&|>u][^\\s;&|>]*|exclu|exclu[^\\s;&|>d][^\\s;&|>]*|exclud|exclud[^\\s;&|>e][^\\s;&|>]*|exclude[^\\s;&|>]+))|--exclude(?:=[^\\s;&|>]*|\\s+[^\\s;&|>]+)|-x(?:\\s+[^\\s;&|>-][^\\s;&|>]*)*\\s+(?:-|-[^\\s;&|>x-][^\\s;&|>]*|-x[^\\s;&|>]+|--(?:|[^\\s;&|>e][^\\s;&|>]*|e|e[^\\s;&|>x][^\\s;&|>]*|ex|ex[^\\s;&|>c][^\\s;&|>]*|exc|exc[^\\s;&|>l][^\\s;&|>]*|excl|excl[^\\s;&|>u][^\\s;&|>]*|exclu|exclu[^\\s;&|>d][^\\s;&|>]*|exclud|exclud[^\\s;&|>e][^\\s;&|>]*|exclude[^\\s;&|>]+))))*?\\s+['\"]?(?:[^\\s;&|>'\"=-][^\\s;&|>'\"]*/)?(?i:\\.env(\\.[\\w.-]+)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)($|[\\s'\";|&)<>])") || e.command.command.matches("(?i)(^|[;&|(`]|\\$\\()\\s*(sudo\\s+)?cp\\b[^;&|>\\n]*?[\\s/'\"=](\\.env(\\.(?:[-0-9_abcfghijklmnopqruvwxyz][\\w-]*|d|d[-0-9_abcdefghjklmnopqrstuvwxyz][\\w-]*|di|di[-0-9_abcdefghijklmnopqrtuvwxyz][\\w-]*|dis|dis[-0-9_abcdefghijklmnopqrsuvwxyz][\\w-]*|dist[\\w-]+|e|e[-0-9_abcdefghijklmnopqrstuvwyz][\\w-]*|ex|ex[-0-9_bcdefghijklmnopqrstuvwxyz][\\w-]*|exa|exa[-0-9_abcdefghijklnopqrstuvwxyz][\\w-]*|exam|exam[-0-9_abcdefghijklmnoqrstuvwxyz][\\w-]*|examp|examp[-0-9_abcdefghijkmnopqrstuvwxyz][\\w-]*|exampl|exampl[-0-9_abcdfghijklmnopqrstuvwxyz][\\w-]*|example[\\w-]+|s|s[-0-9_bcdefghijklmnopqrstuvwxyz][\\w-]*|sa|sa[-0-9_abcdefghijklnopqrstuvwxyz][\\w-]*|sam|sam[-0-9_abcdefghijklmnoqrstuvwxyz][\\w-]*|samp|samp[-0-9_abcdefghijkmnopqrstuvwxyz][\\w-]*|sampl|sampl[-0-9_abcdfghijklmnopqrstuvwxyz][\\w-]*|sample[\\w-]+|t|t[-0-9_abcdfghijklmnopqrstuvwxyz][\\w-]*|te|te[-0-9_abcdefghijklnopqrstuvwxyz][\\w-]*|tem|tem[-0-9_abcdefghijklmnoqrstuvwxyz][\\w-]*|temp|temp[-0-9_abcdefghijkmnopqrstuvwxyz][\\w-]*|templ|templ[-0-9_bcdefghijklmnopqrstuvwxyz][\\w-]*|templa|templa[-0-9_abcdefghijklmnopqrsuvwxyz][\\w-]*|templat|templat[-0-9_abcdfghijklmnopqrstuvwxyz][\\w-]*|template[\\w-]+)(\\.[\\w.-]*)?)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)['\"]?\\s+[^\\s;&|<>]") || e.command.command.matches("(?i)(^|[;&|(`]|\\$\\()\\s*(sudo\\s+)?(grep|egrep|fgrep|rg|awk|sed|jq)\\b[^;&|>\\n]*?(\\s['\"]?[^\\s;&|'\"]*/(\\.env(\\.[\\w.-]+)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)($|[\\s'\";|&)<>])|\\s[^\\s-][^\\s;&|>]*\\s+(\\.env(\\.[\\w.-]+)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)\\s*($|[;&|)]))")))- id: external_mcpmatch: >diff --git a/rules/context-exfiltration/secret-read-then-mcp-tool-handoff.rule.yaml b/rules/context-exfiltration/secret-read-then-mcp-tool-handoff.rule.yamlindex 178934f5..cb7efab9 100644--- a/rules/context-exfiltration/secret-read-then-mcp-tool-handoff.rule.yaml+++ b/rules/context-exfiltration/secret-read-then-mcp-tool-handoff.rule.yaml@@ -45,7 +45,7 @@ correlation:)) || (e.event.action == "command.executed" &&- (e.command.command.matches("(?i)(^|[;&|(`]|\\$\\()\\s*(sudo\\s+)?(cat|tac|head|tail|less|more|bat|nl|strings|xxd|od|hexdump|base64)\\b[^;&|>\\n]*?[\\s/'\"=](\\.env(\\.[\\w.-]+)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)($|[\\s'\";|&)<>])") || e.command.command.matches("(^|[;&|(`]|\\$\\()\\s*(sudo\\s+)?(tar|zip)(?:\\s+(?:(?:[^\\s;&|>-][^\\s;&|>]*|-|-[^\\s;&|>x-][^\\s;&|>]*|-x[^\\s;&|>]+|--(?:|[^\\s;&|>e][^\\s;&|>]*|e|e[^\\s;&|>x][^\\s;&|>]*|ex|ex[^\\s;&|>c][^\\s;&|>]*|exc|exc[^\\s;&|>l][^\\s;&|>]*|excl|excl[^\\s;&|>u][^\\s;&|>]*|exclu|exclu[^\\s;&|>d][^\\s;&|>]*|exclud|exclud[^\\s;&|>e][^\\s;&|>]*|exclude[^\\s;&|>]+))|--exclude(?:=[^\\s;&|>]*|\\s+[^\\s;&|>]+)|-x(?:\\s+[^\\s;&|>-][^\\s;&|>]*)*\\s+(?:-|-[^\\s;&|>x-][^\\s;&|>]*|-x[^\\s;&|>]+|--(?:|[^\\s;&|>e][^\\s;&|>]*|e|e[^\\s;&|>x][^\\s;&|>]*|ex|ex[^\\s;&|>c][^\\s;&|>]*|exc|exc[^\\s;&|>l][^\\s;&|>]*|excl|excl[^\\s;&|>u][^\\s;&|>]*|exclu|exclu[^\\s;&|>d][^\\s;&|>]*|exclud|exclud[^\\s;&|>e][^\\s;&|>]*|exclude[^\\s;&|>]+))))*?\\s+['\"]?(?:[^\\s;&|>'\"=-][^\\s;&|>'\"]*/)?(?i:\\.env(\\.[\\w.-]+)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)($|[\\s'\";|&)<>])") || e.command.command.matches("(?i)(^|[;&|(`]|\\$\\()\\s*(sudo\\s+)?cp\\b[^;&|>\\n]*?[\\s/'\"=](\\.env(\\.[\\w.-]+)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)['\"]?\\s+[^\\s;&|<>]") || e.command.command.matches("(?i)(^|[;&|(`]|\\$\\()\\s*(sudo\\s+)?(grep|egrep|fgrep|rg|awk|sed|jq)\\b[^;&|>\\n]*?(\\s['\"]?[^\\s;&|'\"]*/(\\.env(\\.[\\w.-]+)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)($|[\\s'\";|&)<>])|\\s[^\\s-][^\\s;&|>]*\\s+(\\.env(\\.[\\w.-]+)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)\\s*($|[;&|)]))")) && !e.command.command.matches("(?i)^\\s*cp\\s+(-\\S+\\s+)*['\"]?[^\\s;&|'\"]*\\.env\\.(example|sample|template|dist)['\"]?\\s+['\"]?[^\\s;&|'\"]*\\.env['\"]?\\s*$")+ (e.command.command.matches("(?i)(^|[;&|(`]|\\$\\()\\s*(sudo\\s+)?(cat|tac|head|tail|less|more|bat|nl|strings|xxd|od|hexdump|base64)\\b[^;&|>\\n]*?[\\s/'\"=](\\.env(\\.[\\w.-]+)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)($|[\\s'\";|&)<>])") || e.command.command.matches("(^|[;&|(`]|\\$\\()\\s*(sudo\\s+)?(tar|zip)(?:\\s+(?:(?:[^\\s;&|>-][^\\s;&|>]*|-|-[^\\s;&|>x-][^\\s;&|>]*|-x[^\\s;&|>]+|--(?:|[^\\s;&|>e][^\\s;&|>]*|e|e[^\\s;&|>x][^\\s;&|>]*|ex|ex[^\\s;&|>c][^\\s;&|>]*|exc|exc[^\\s;&|>l][^\\s;&|>]*|excl|excl[^\\s;&|>u][^\\s;&|>]*|exclu|exclu[^\\s;&|>d][^\\s;&|>]*|exclud|exclud[^\\s;&|>e][^\\s;&|>]*|exclude[^\\s;&|>]+))|--exclude(?:=[^\\s;&|>]*|\\s+[^\\s;&|>]+)|-x(?:\\s+[^\\s;&|>-][^\\s;&|>]*)*\\s+(?:-|-[^\\s;&|>x-][^\\s;&|>]*|-x[^\\s;&|>]+|--(?:|[^\\s;&|>e][^\\s;&|>]*|e|e[^\\s;&|>x][^\\s;&|>]*|ex|ex[^\\s;&|>c][^\\s;&|>]*|exc|exc[^\\s;&|>l][^\\s;&|>]*|excl|excl[^\\s;&|>u][^\\s;&|>]*|exclu|exclu[^\\s;&|>d][^\\s;&|>]*|exclud|exclud[^\\s;&|>e][^\\s;&|>]*|exclude[^\\s;&|>]+))))*?\\s+['\"]?(?:[^\\s;&|>'\"=-][^\\s;&|>'\"]*/)?(?i:\\.env(\\.[\\w.-]+)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)($|[\\s'\";|&)<>])") || e.command.command.matches("(?i)(^|[;&|(`]|\\$\\()\\s*(sudo\\s+)?cp\\b[^;&|>\\n]*?[\\s/'\"=](\\.env(\\.(?:[-0-9_abcfghijklmnopqruvwxyz][\\w-]*|d|d[-0-9_abcdefghjklmnopqrstuvwxyz][\\w-]*|di|di[-0-9_abcdefghijklmnopqrtuvwxyz][\\w-]*|dis|dis[-0-9_abcdefghijklmnopqrsuvwxyz][\\w-]*|dist[\\w-]+|e|e[-0-9_abcdefghijklmnopqrstuvwyz][\\w-]*|ex|ex[-0-9_bcdefghijklmnopqrstuvwxyz][\\w-]*|exa|exa[-0-9_abcdefghijklnopqrstuvwxyz][\\w-]*|exam|exam[-0-9_abcdefghijklmnoqrstuvwxyz][\\w-]*|examp|examp[-0-9_abcdefghijkmnopqrstuvwxyz][\\w-]*|exampl|exampl[-0-9_abcdfghijklmnopqrstuvwxyz][\\w-]*|example[\\w-]+|s|s[-0-9_bcdefghijklmnopqrstuvwxyz][\\w-]*|sa|sa[-0-9_abcdefghijklnopqrstuvwxyz][\\w-]*|sam|sam[-0-9_abcdefghijklmnoqrstuvwxyz][\\w-]*|samp|samp[-0-9_abcdefghijkmnopqrstuvwxyz][\\w-]*|sampl|sampl[-0-9_abcdfghijklmnopqrstuvwxyz][\\w-]*|sample[\\w-]+|t|t[-0-9_abcdfghijklmnopqrstuvwxyz][\\w-]*|te|te[-0-9_abcdefghijklnopqrstuvwxyz][\\w-]*|tem|tem[-0-9_abcdefghijklmnoqrstuvwxyz][\\w-]*|temp|temp[-0-9_abcdefghijkmnopqrstuvwxyz][\\w-]*|templ|templ[-0-9_bcdefghijklmnopqrstuvwxyz][\\w-]*|templa|templa[-0-9_abcdefghijklmnopqrsuvwxyz][\\w-]*|templat|templat[-0-9_abcdfghijklmnopqrstuvwxyz][\\w-]*|template[\\w-]+)(\\.[\\w.-]*)?)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)['\"]?\\s+[^\\s;&|<>]") || e.command.command.matches("(?i)(^|[;&|(`]|\\$\\()\\s*(sudo\\s+)?(grep|egrep|fgrep|rg|awk|sed|jq)\\b[^;&|>\\n]*?(\\s['\"]?[^\\s;&|'\"]*/(\\.env(\\.[\\w.-]+)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)($|[\\s'\";|&)<>])|\\s[^\\s-][^\\s;&|>]*\\s+(\\.env(\\.[\\w.-]+)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)\\s*($|[;&|)]))")))- id: mcp_handoffmatch: >diff --git a/rules/credential-access/credential-file-read.rule.yaml b/rules/credential-access/credential-file-read.rule.yamlindex c49f608a..8ad65dd7 100644--- a/rules/credential-access/credential-file-read.rule.yaml+++ b/rules/credential-access/credential-file-read.rule.yaml@@ -39,7 +39,7 @@ match: >)) || (e.event.action == "command.executed" &&- (e.command.command.matches("(?i)(^|[;&|(`]|\\$\\()\\s*(sudo\\s+)?(cat|tac|head|tail|less|more|bat|nl|strings|xxd|od|hexdump|base64)\\b[^;&|>\\n]*?[\\s/'\"=](\\.env(\\.[\\w.-]+)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)($|[\\s'\";|&)<>])") || e.command.command.matches("(^|[;&|(`]|\\$\\()\\s*(sudo\\s+)?(tar|zip)(?:\\s+(?:(?:[^\\s;&|>-][^\\s;&|>]*|-|-[^\\s;&|>x-][^\\s;&|>]*|-x[^\\s;&|>]+|--(?:|[^\\s;&|>e][^\\s;&|>]*|e|e[^\\s;&|>x][^\\s;&|>]*|ex|ex[^\\s;&|>c][^\\s;&|>]*|exc|exc[^\\s;&|>l][^\\s;&|>]*|excl|excl[^\\s;&|>u][^\\s;&|>]*|exclu|exclu[^\\s;&|>d][^\\s;&|>]*|exclud|exclud[^\\s;&|>e][^\\s;&|>]*|exclude[^\\s;&|>]+))|--exclude(?:=[^\\s;&|>]*|\\s+[^\\s;&|>]+)|-x(?:\\s+[^\\s;&|>-][^\\s;&|>]*)*\\s+(?:-|-[^\\s;&|>x-][^\\s;&|>]*|-x[^\\s;&|>]+|--(?:|[^\\s;&|>e][^\\s;&|>]*|e|e[^\\s;&|>x][^\\s;&|>]*|ex|ex[^\\s;&|>c][^\\s;&|>]*|exc|exc[^\\s;&|>l][^\\s;&|>]*|excl|excl[^\\s;&|>u][^\\s;&|>]*|exclu|exclu[^\\s;&|>d][^\\s;&|>]*|exclud|exclud[^\\s;&|>e][^\\s;&|>]*|exclude[^\\s;&|>]+))))*?\\s+['\"]?(?:[^\\s;&|>'\"=-][^\\s;&|>'\"]*/)?(?i:\\.env(\\.[\\w.-]+)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)($|[\\s'\";|&)<>])") || e.command.command.matches("(?i)(^|[;&|(`]|\\$\\()\\s*(sudo\\s+)?cp\\b[^;&|>\\n]*?[\\s/'\"=](\\.env(\\.[\\w.-]+)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)['\"]?\\s+[^\\s;&|<>]") || e.command.command.matches("(?i)(^|[;&|(`]|\\$\\()\\s*(sudo\\s+)?(grep|egrep|fgrep|rg|awk|sed|jq)\\b[^;&|>\\n]*?(\\s['\"]?[^\\s;&|'\"]*/(\\.env(\\.[\\w.-]+)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)($|[\\s'\";|&)<>])|\\s[^\\s-][^\\s;&|>]*\\s+(\\.env(\\.[\\w.-]+)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)\\s*($|[;&|)]))")) && !e.command.command.matches("(?i)^\\s*cp\\s+(-\\S+\\s+)*['\"]?[^\\s;&|'\"]*\\.env\\.(example|sample|template|dist)['\"]?\\s+['\"]?[^\\s;&|'\"]*\\.env['\"]?\\s*$")+ (e.command.command.matches("(?i)(^|[;&|(`]|\\$\\()\\s*(sudo\\s+)?(cat|tac|head|tail|less|more|bat|nl|strings|xxd|od|hexdump|base64)\\b[^;&|>\\n]*?[\\s/'\"=](\\.env(\\.[\\w.-]+)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)($|[\\s'\";|&)<>])") || e.command.command.matches("(^|[;&|(`]|\\$\\()\\s*(sudo\\s+)?(tar|zip)(?:\\s+(?:(?:[^\\s;&|>-][^\\s;&|>]*|-|-[^\\s;&|>x-][^\\s;&|>]*|-x[^\\s;&|>]+|--(?:|[^\\s;&|>e][^\\s;&|>]*|e|e[^\\s;&|>x][^\\s;&|>]*|ex|ex[^\\s;&|>c][^\\s;&|>]*|exc|exc[^\\s;&|>l][^\\s;&|>]*|excl|excl[^\\s;&|>u][^\\s;&|>]*|exclu|exclu[^\\s;&|>d][^\\s;&|>]*|exclud|exclud[^\\s;&|>e][^\\s;&|>]*|exclude[^\\s;&|>]+))|--exclude(?:=[^\\s;&|>]*|\\s+[^\\s;&|>]+)|-x(?:\\s+[^\\s;&|>-][^\\s;&|>]*)*\\s+(?:-|-[^\\s;&|>x-][^\\s;&|>]*|-x[^\\s;&|>]+|--(?:|[^\\s;&|>e][^\\s;&|>]*|e|e[^\\s;&|>x][^\\s;&|>]*|ex|ex[^\\s;&|>c][^\\s;&|>]*|exc|exc[^\\s;&|>l][^\\s;&|>]*|excl|excl[^\\s;&|>u][^\\s;&|>]*|exclu|exclu[^\\s;&|>d][^\\s;&|>]*|exclud|exclud[^\\s;&|>e][^\\s;&|>]*|exclude[^\\s;&|>]+))))*?\\s+['\"]?(?:[^\\s;&|>'\"=-][^\\s;&|>'\"]*/)?(?i:\\.env(\\.[\\w.-]+)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)($|[\\s'\";|&)<>])") || e.command.command.matches("(?i)(^|[;&|(`]|\\$\\()\\s*(sudo\\s+)?cp\\b[^;&|>\\n]*?[\\s/'\"=](\\.env(\\.(?:[-0-9_abcfghijklmnopqruvwxyz][\\w-]*|d|d[-0-9_abcdefghjklmnopqrstuvwxyz][\\w-]*|di|di[-0-9_abcdefghijklmnopqrtuvwxyz][\\w-]*|dis|dis[-0-9_abcdefghijklmnopqrsuvwxyz][\\w-]*|dist[\\w-]+|e|e[-0-9_abcdefghijklmnopqrstuvwyz][\\w-]*|ex|ex[-0-9_bcdefghijklmnopqrstuvwxyz][\\w-]*|exa|exa[-0-9_abcdefghijklnopqrstuvwxyz][\\w-]*|exam|exam[-0-9_abcdefghijklmnoqrstuvwxyz][\\w-]*|examp|examp[-0-9_abcdefghijkmnopqrstuvwxyz][\\w-]*|exampl|exampl[-0-9_abcdfghijklmnopqrstuvwxyz][\\w-]*|example[\\w-]+|s|s[-0-9_bcdefghijklmnopqrstuvwxyz][\\w-]*|sa|sa[-0-9_abcdefghijklnopqrstuvwxyz][\\w-]*|sam|sam[-0-9_abcdefghijklmnoqrstuvwxyz][\\w-]*|samp|samp[-0-9_abcdefghijkmnopqrstuvwxyz][\\w-]*|sampl|sampl[-0-9_abcdfghijklmnopqrstuvwxyz][\\w-]*|sample[\\w-]+|t|t[-0-9_abcdfghijklmnopqrstuvwxyz][\\w-]*|te|te[-0-9_abcdefghijklnopqrstuvwxyz][\\w-]*|tem|tem[-0-9_abcdefghijklmnoqrstuvwxyz][\\w-]*|temp|temp[-0-9_abcdefghijkmnopqrstuvwxyz][\\w-]*|templ|templ[-0-9_bcdefghijklmnopqrstuvwxyz][\\w-]*|templa|templa[-0-9_abcdefghijklmnopqrsuvwxyz][\\w-]*|templat|templat[-0-9_abcdfghijklmnopqrstuvwxyz][\\w-]*|template[\\w-]+)(\\.[\\w.-]*)?)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)['\"]?\\s+[^\\s;&|<>]") || e.command.command.matches("(?i)(^|[;&|(`]|\\$\\()\\s*(sudo\\s+)?(grep|egrep|fgrep|rg|awk|sed|jq)\\b[^;&|>\\n]*?(\\s['\"]?[^\\s;&|'\"]*/(\\.env(\\.[\\w.-]+)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)($|[\\s'\";|&)<>])|\\s[^\\s-][^\\s;&|>]*\\s+(\\.env(\\.[\\w.-]+)?|\\.aws/credentials|id_(rsa|ed25519|ecdsa|dsa)|\\.git-credentials|\\.netrc|\\.pgpass|credentials(\\.json|\\.toml)?|\\.npmrc|\\.pypirc|\\.docker/config\\.json|\\.config/gh/hosts\\.yml|application_default_credentials\\.json|\\.config/gcloud/(credentials|access_tokens)\\.db|\\.azure/(msal_token_cache|accesstokens)\\.json|[\\w.-]*\\.tfstate(\\.backup)?|\\.terraform\\.d/credentials\\.tfrc\\.json)\\s*($|[;&|)]))")))emit:@@ -346,3 +346,33 @@ tests:- event: { action: command.executed }command: { command: "zip -r out.zip . -x .env credentials.json" }session: { id: s1 }+ - name: chained_cp_template_to_dotenv_not_read+ verdict: no_match+ events:+ - event: { action: command.executed }+ command: { command: "cd app && cp .env.example .env" }+ session: { id: s1 }+ - name: cp_template_to_dotenv_local_not_read+ verdict: no_match+ events:+ - event: { action: command.executed }+ command: { command: "cp .env.example .env.local" }+ session: { id: s1 }+ - name: cp_sample_template_variants_not_read+ verdict: no_match+ events:+ - event: { action: command.executed }+ command: { command: "cp -n .env.sample .env; cp .env.template .env.production" }+ session: { id: s1 }+ - name: chained_cp_dotenv_out_is_read+ verdict: match+ events:+ - event: { action: command.executed }+ command: { command: "cd app && cp .env .env.bak" }+ session: { id: s1 }+ - name: cp_dotenv_local_out_is_read+ verdict: match+ events:+ - event: { action: command.executed }+ command: { command: "cp .env.local /tmp/x" }+ session: { id: s1 }