T09 · Insecure Skill Coding Practices
- Location
scripts/kb-retrieval.js:29- Finding
Shell Command Injection Through Email-Derived Knowledge-Base Queries
- Content
View full analysis
- Remediation
View remediation
0 && limit <= 20 ? limit : 3; const result = execFileSync( CONFIG.venvPython, [searchScript, query, '--limit', String(safeLimit)], { encoding: 'utf8', timeout: 10000, stdio: ['pipe', 'pipe', 'ignore'], shell: false } ); ``` Additional hardening should include: 1. Resolve the Python executable to an administrator-approved absolute path rather than accepting an unrestricted `PYTHON_PATH`. 2. Validate that `searchScript` resolves inside the expected vector-store directory. 3. Apply length and character limits to LLM-generated entities before using them. 4. Treat all LLM output as untrusted input, even when the model is instructed to return structured JSON. 5. Run the pipeline under a dedicated least-privileged account with access only to required mailbox, draft, and knowledge-base resources. 6. Avoid passing unnecessary secrets in the child process environment. 7. Add regression tests containing shell metacharacters and command-substitution syntax to verify that values are passed as literal arguments. ]]>
