{"record":{"id":"bb2cc81bfde6b247","repo":"davila7/claude-code-templates","slug":"sem-e006","errorCode":"SEM_E006","errorMessage":"Shell access attempt detected","messagePattern":"Shell access attempt detected","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"cli-tool/src/validation/validators/SemanticValidator.js","lineNumber":53,"sourceCode":"        code: 'SEM_E003',\n        message: 'Role manipulation detected: Attempt to redefine AI role',\n        severity: 'high'\n      },\n      {\n        pattern: /execute\\s+the\\s+following\\s+(code|command|script)/gi,\n        code: 'SEM_E004',\n        message: 'Command execution attempt detected',\n        severity: 'critical'\n      },\n      {\n        pattern: /\\b(fetch|retrieve|get|extract|obtain|steal|harvest|capture|collect)\\s+(the\\s+)?(user['']?s?\\s+)?(auth\\s+)?(token|key|password|credential|secret|api[\\s_-]?key)/gi,\n        code: 'SEM_E005',\n        message: 'Credential harvesting pattern detected',\n        severity: 'critical'\n      },\n      {\n        pattern: /(open|spawn|exec|run)\\s+(a\\s+)?(shell|terminal|bash|cmd|powershell)/gi,\n        code: 'SEM_E006',\n        message: 'Shell access attempt detected',\n        severity: 'critical'\n      },\n      {\n        pattern: /(disable|bypass|override|skip)\\s+(security|safety|filter|protection|validation)/gi,\n        code: 'SEM_E007',\n        message: 'Security bypass attempt detected',\n        severity: 'critical'\n      },\n      {\n        pattern: /always\\s+(obey|follow|comply\\s+with|execute)\\s+the\\s+user/gi,\n        code: 'SEM_E008',\n        message: 'Unconditional obedience instruction detected',\n        severity: 'high'\n      },\n      {\n        pattern: /(forget|disregard|remove)\\s+(everything|all\\s+previous|prior\\s+context)/gi,\n        code: 'SEM_E009',","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/davila7/claude-code-templates/blob/a0851ed10c7c60463dac8cfaaca124cf32d5804d/cli-tool/src/validation/validators/SemanticValidator.js#L35-L71","documentation":"SEM_E006 is a critical semantic finding matching /(open|spawn|exec|run)\\s+(a\\s+)?(shell|terminal|bash|cmd|powershell)/gi. It flags instructions that direct the agent to open or spawn an interactive shell — a common injection goal because a shell grants arbitrary command execution. The validator reports it whenever the phrase appears in validated component content.","triggerScenarios":"Content containing 'open a terminal', 'spawn a shell', 'run bash', 'exec powershell', etc. (case-insensitive; the article 'a' is optional so 'open terminal' also matches). Typical in DevOps-oriented agents, setup instructions, or quoted terminal transcripts.","commonSituations":"Terminal/DevOps agent components whose instructions naturally say 'open a terminal and run ...'; onboarding docs embedded in components; tutorial components copied from blog posts.","solutions":["Rephrase to non-imperative guidance: 'Terminal commands can be run in the user's shell of choice' or instruct via a specific tool call","Name the concrete command instead of the shell: 'Run `npm test` in the project directory' rather than 'open a bash shell'","Paraphrase quoted transcripts that contain the exact phrase","Waive via review pipeline if shell access is the component's documented, intended purpose"],"exampleFix":"// before\nOpen a terminal and navigate to the project directory.\n\n// after\nRun commands from the project directory (e.g. `cd ~/project && npm test`).","handlingStrategy":"validation","validationCode":"const SHELL_RE = /(open|spawn|exec|run)\\s+(a\\s+)?(shell|terminal|bash|cmd|powershell)/i;\nfunction requestsShell(text) { return SHELL_RE.test(text); }\nif (requestsShell(content)) warn('Describe concrete commands instead of spawning shells.');","typeGuard":"function isSafeShellText(text) { return !/(open|spawn|exec|run)\\s+(a\\s+)?(shell|terminal|bash|cmd|powershell)/i.test(text); }","tryCatchPattern":null,"preventionTips":["Instruct with concrete commands ('npm test') rather than 'open a terminal'","Delegate execution to declared tools/hooks","Paraphrase terminal transcripts before embedding them in components"],"tags":["shell-execution","prompt-injection","semantic-validation"],"backgroundTag":"prompt-injection-detected","analyzedSha":"a0851ed10c7c60463dac8cfaaca124cf32d5804d","analyzedAt":"2026-08-28T14:11:56.058Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}