T09 · Insecure Skill Coding Practices
- Location
scripts/send_email.py:22- Finding
AppleScript Injection Through Unsafely Interpolated Email Fields
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This macOS Mail.app email skill is mostly purpose-aligned, but its ready-to-use helpers build executable AppleScript from insufficiently validated fields, creating a real review concern before installation.
Install only if you understand that this can silently send mail from a configured macOS Mail.app account. Treat recipient, sender, subject, body, and attachment path values as trusted-only unless the helper is rewritten to pass values as data rather than AppleScript source, validate addresses and paths, and require explicit confirmation before sending or attaching files.
scripts/send_email.py:22AppleScript Injection Through Unsafely Interpolated Email Fields
references/attachments.md:22AppleScript Injection in Documented Attachment Helper
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
end tell
return "sent"'''
result = subprocess.run(
["osascript", "-e", script],
capture_output=True,
text=True
Skill requests more permissions than appear necessary for its stated functionality. Review if elevated access is justified.
| Email lands in Drafts | `send m` not reached (script errored before) | Check escape characters |
| `execution error: Mail got an error: Invalid recipient` | Address typo | Verify recipient address |
| Email sends but empty body | Newline escape issue in content string | Use Python helper instead |
| `returncode != 0` with no stderr | osascript permission denied | Grant Automation permission: **macOS Ventura+**: System Settings → Privacy & Security → Automation; **older macOS**: System Preferences → Security & Privacy → Automation |
---