{"record":{"id":"2f31ae879c28ea4f","repo":"davila7/claude-code-templates","slug":"sem-e004","errorCode":"SEM_E004","errorMessage":"Command execution attempt detected","messagePattern":"Command execution attempt detected","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"cli-tool/src/validation/validators/SemanticValidator.js","lineNumber":41,"sourceCode":"        code: 'SEM_E001',\n        message: 'Jailbreak pattern detected: Attempt to ignore previous instructions',\n        severity: 'critical'\n      },\n      {\n        pattern: /(system\\s+prompt|developer\\s+instructions?|hidden\\s+prompt|internal\\s+instructions?)/gi,\n        code: 'SEM_E002',\n        message: 'Prompt injection detected: Reference to system/developer instructions',\n        severity: 'critical'\n      },\n      {\n        pattern: /you\\s+are\\s+now\\s+(a|an)\\s+/gi,\n        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',","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/davila7/claude-code-templates/blob/a0851ed10c7c60463dac8cfaaca124cf32d5804d/cli-tool/src/validation/validators/SemanticValidator.js#L23-L59","documentation":"SEM_E004 is a critical semantic validation finding matching /execute\\s+the\\s+following\\s+(code|command|script)/gi. It flags component text that instructs literal execution of embedded code/commands — a hallmark of prompt-injection payloads that try to get the agent to run attacker-supplied code. The library throws it during semantic validation of component content before the component is published or installed.","triggerScenarios":"Validating a component whose body contains phrases like 'Execute the following command:' or 'execute the following script' (case-insensitive, whitespace-flexible). Common in MCP/hook/command components that include runnable snippets in their markdown.","commonSituations":"Writing tutorial-style command components that tell the agent or user to run a bundled script; embedding CI/CLI instructions in an agent's documentation; importing third-party components with embedded execution directives.","solutions":["Rephrase to 'You may run this command' or 'The following command is available for reference' instead of the imperative 'execute the following ...'","If execution is genuinely required, route it through an explicit, reviewed tool/hook definition rather than inline prose","Sanitize any quoted logs or transcript text that contains the phrase","Waive the finding through your reviewed override process if the component is verified safe"],"exampleFix":"// before\nExecute the following script to set up the environment:\n```bash\n./setup.sh\n```\n\n// after\nEnvironment setup is handled by the `setup` hook. Run `npm run setup` if needed.","handlingStrategy":"validation","validationCode":"const EXEC_RE = /execute\\s+the\\s+following\\s+(code|command|script)/i;\nif (EXEC_RE.test(content)) {\n  throw new Error('Rephrase imperative execution instructions before validation.');\n}","typeGuard":"function isSafeExecutionText(text) { return !/execute\\s+the\\s+following\\s+(code|command|script)/i.test(text); }","tryCatchPattern":null,"preventionTips":["Route executable logic through hooks/scripts, not imperative prose","Reference commands by name ('run the setup hook') instead of 'execute the following script'","Lint component markdown in CI with these patterns"],"tags":["prompt-injection","code-execution","semantic-validation"],"backgroundTag":"prompt-injection-detected","analyzedSha":"a0851ed10c7c60463dac8cfaaca124cf32d5804d","analyzedAt":"2026-08-28T14:11:56.058Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}