T09 · Insecure Skill Coding Practices
- Location
references/codegen-patterns.md:78- Finding
Untrusted DSL Code Nodes Are Preserved Without Sandbox Controls
- Content
View full analysis
dict` | | `variables[]` / `inputs` | 入参映射:`{variable: 形参名, value_selector: [...]}` | | `outputs` | 出参声明:`{key: {type, children}}` | 代码化铁律:**原样搬运,禁止重写逻辑**;javascript 代码需 Node 运行时或征得用户同意后改写。 ``` ### Technical Analysis The Skill treats a user-supplied Dify DSL as a source of executable Python or JavaScript and explicitly requires inline code to be copied without modifying its logic. Dify code nodes are expected to run under Dify's sandbox model, but the standalone FastAPI and Express templates do not provide an equivalent sandbox, capability boundary, filesystem restriction, network restriction, execution timeout, or resource quota. Consequently, preserving code verbatim does not preserve its original security context. A code node that was constrained inside Dify may receive the full privileges of the generated service process after conversion. The bundled example code nodes are benign text-processing routines, so this finding does not assert that the examples themselves are malicious. The vulnerability arises from the handling policy for arbitrary user-supplied DSL files. ### Attack Path 1. An attacker supplies or modifies a Dify DSL file. 2. The DSL contains a Python or JavaScript code node with a malicious `main` implementation. 3. The Skill follows its documented rule and copies the implementation into a generated handler without ...[truncated 950 chars]- Remediation
View remediation
