Architecture and design: Prefer library calls over external processes when they can provide the required functionality. Implementation: If external commands are necessary, create them statically whenever possible. Validate input using an accept-known-good allowlist that strictly follows the required specification, including length, type, permitted values, syntax, missing or extra fields, relationships between fields, and business rules; reject or transform nonconforming input. Do not rely only on denylists of malicious patterns, although denylists can help detect attacks or reject clearly malformed input. Operation: Enforce an allowlist of sanctioned commands at runtime. System configuration: Assign permissions so users cannot access or open privileged files.