T09 · Insecure Skill Coding Practices
- Location
scripts/add_event.py:51- Finding
Unescaped User Input Permits iCalendar Content Injection
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill does what it says in broad terms, but it handles iCloud credentials and calendar writes in ways users should review carefully before installing.
Review this before installing. Use only an Apple app-specific password, do not put credentials directly in source code, and be aware that the skill can write events to your iCloud Calendar and send event details to Apple's CalDAV service. The script should be fixed so help or invalid invocations never create calendar entries, and user-provided calendar text should be escaped or serialized with a proper iCalendar library.
scripts/add_event.py:51Unescaped User Input Permits iCalendar Content Injection
scripts/add_event.py:142Invalid Invocation Triggers an Unexpected Authenticated Calendar Write
README.md:25Documentation Encourages Storing iCloud Credentials in Source Code
The documented behavior does not fully match the reported code behavior: it accesses local credential files and environment variables without declared permissions, and may include automatic/demo execution paths not disclosed in the high-level description. Mismatches like this are dangerous because users may grant trust based on incomplete documentation while the code handles secrets or performs actions unexpectedly.
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
Usage: python3 add_event.py "Event Title" "2026-03-06T10:00:00" "2026-03-06T11:00:00" "Description"
Setup:
1. Copy secrets/.env.example to secrets/.env
2. Fill in your iCloud credentials in secrets/.env
"""
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
Usage: python3 add_event.py "Event Title" "2026-03-06T10:00:00" "2026-03-06T11:00:00" "Description"
Setup:
1. Copy secrets/.env.example to secrets/.env
2. Fill in your iCloud credentials in secrets/.env
"""
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
Usage: python3 add_event.py "Event Title" "2026-03-06T10:00:00" "2026-03-06T11:00:00" "Description"
Setup:
1. Copy secrets/.env.example to secrets/.env
2. Fill in your iCloud credentials in secrets/.env
"""
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
Usage: python3 add_event.py "Event Title" "2026-03-06T10:00:00" "2026-03-06T11:00:00" "Description"
Setup:
1. Copy secrets/.env.example to secrets/.env
2. Fill in your iCloud credentials in secrets/.env
"""
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
Usage: python3 add_event.py "Event Title" "2026-03-06T10:00:00" "2026-03-06T11:00:00" "Description"
Setup:
1. Copy secrets/.env.example to secrets/.env
2. Fill in your iCloud credentials in secrets/.env
"""
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
Usage: python3 add_event.py "Event Title" "2026-03-06T10:00:00" "2026-03-06T11:00:00" "Description"
Setup:
1. Copy secrets/.env.example to secrets/.env
2. Fill in your iCloud credentials in secrets/.env
"""
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
Usage: python3 add_event.py "Event Title" "2026-03-06T10:00:00" "2026-03-06T11:00:00" "Description"
Setup:
1. Copy secrets/.env.example to secrets/.env
2. Fill in your iCloud credentials in secrets/.env
"""
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# Load credentials from .env file
def load_credentials():
env_path = os.path.join(os.path.dirname(__file__), '..', 'secrets', '.env')
if os.path.exists(env_path):
with open(env_path) as f:
for line in f:
The description says the skill adds events to iCloud Calendar but does not clearly warn that event titles, descriptions, and reminder metadata are transmitted to Apple's iCloud CalDAV service. This can cause users to unknowingly send sensitive personal or business scheduling data to a third-party cloud provider, creating privacy and compliance risk.
The README tells users to hardcode iCloud credentials directly into the script, which encourages insecure secret handling and makes accidental disclosure via source control, backups, logs, or screenshots much more likely. Because these are valid iCloud app-specific credentials tied to a real account, exposure can allow unauthorized calendar access and misuse of the connected Apple account capability.
The skill declares that it requires environment variables and performs network communication, but it does not declare an explicit tool scope such as permissions or allowed-tools. This weakens reviewability and sandbox enforcement because consumers cannot clearly see or constrain the skill's access to secrets and outbound network use.
The manifest requires ICLOUD_EMAIL and ICLOUD_PASSWORD but does not present any user-facing warning that highly sensitive personal credentials are needed to operate the skill. This creates a real risk of users supplying primary iCloud credentials without understanding the trust boundary, account sensitivity, or need for safer alternatives such as app-specific passwords, increasing the chance of credential exposure or misuse.
The documented usage implies the script adds an event only when called with the required arguments, but the actual help/error path triggers a test event creation. This mismatch increases the chance of accidental execution and makes the behavior deceptive from a safety perspective, especially because it uses stored credentials to write to a remote calendar.
This code sends event data and stored credentials to a remote CalDAV endpoint using an HTTP PUT request, which changes the user's calendar state. Although success and error messages are printed after the fact, there is no pre-action confirmation prompt or explicit warning before transmitting data and creating the event.
When invoked with too few arguments, the script does not stop after printing usage; instead it creates and uploads a demo event to the user's iCloud calendar. This is dangerous because a help or error path should never perform an authenticated write action, and an accidental invocation can cause unintended remote state changes without user consent.
The usage examples and natural-language invocation examples are written in Chinese, while the rest of the README is in English, which may signal an implicit language expectation for interacting with the skill. The file does not clarify that other languages are supported or that Chinese input is merely illustrative, so this creates a possible language/locale policy concern.
This manifest provides a broad capability description but does not specify when the skill should or should not be invoked, nor any limiting trigger context. Without explicit scope, an agent could match generic calendar-related requests too broadly.
The manifest describes a calendar-writing skill, but does not mention credential-file or environment access as part of its scope. While authentication is needed for CalDAV, this code adds a local secret-loading capability that is not stated in the skill description and goes beyond the user-facing purpose.
The string literal "马上开始" forces a specific language for reminder content regardless of the user's locale or preference. The file does not offer a language selection mechanism or explain why Chinese-only output is required.
When run with insufficient arguments, the script creates a demo event using mixed Chinese/English text and a Chinese description. This imposes a language choice on the user without any configuration, opt-in, or documented region-specific purpose.