T09 · Insecure Skill Coding Practices
- Location
scripts/apple_notes.py:67- Finding
AppleScript Injection Through Unescaped Account and Folder Values
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This Apple Notes skill mostly matches its stated purpose, but it can read and overwrite personal notes and contains unsafe AppleScript construction that could execute unintended local automation commands.
Install only if you are comfortable granting a local automation skill access to Apple Notes. Treat note titles, folder names, account names, and note IDs as sensitive inputs; avoid using untrusted text for them until the AppleScript interpolation is fixed. Use explicit confirmation before writes or updates, especially update-by-ID, and be aware the skill can read and list existing notes as well as create them.
scripts/apple_notes.py:67AppleScript Injection Through Unescaped Account and Folder Values
REFERENCE.md:32Documentation Promotes Unsafe AppleScript String Interpolation
PUBLISH.md:30Unpinned Global npm Package Installation in Publishing Instructions
The declared purpose emphasizes writing formatted notes, but the content also exposes undeclared read and list capabilities for Notes. That mismatch is dangerous because users and reviewers may consent to a write-only skill while the actual behavior can enumerate or retrieve note contents, increasing privacy risk and expanding the skill's effective access beyond expectations.
The manifest description says the skill supports Markdown conversion and multi-folder management, but the documented implementation only accepts content_html and always targets folder "Notes" of account "iCloud". No Markdown parsing/conversion logic or selectable folder parameter is present in the code sample, so the stated capabilities are not reflected by actual behavior.
The guidance states that < should become < and > should become >, yet the core function is explicitly designed to pass HTML tags such as <h1>, <p>, and <div> into Apple Notes unchanged. Escaping angle brackets as documented would prevent the advertised HTML formatting behavior, so the documentation directly contradicts the code's intended operation.
The trigger list uses broad, everyday phrases that could cause the skill to activate when a user is only discussing note-taking rather than authorizing a system write action. In this context, broad invocation is more dangerous because the skill performs real side effects on the host by launching AppleScript and modifying Apple Notes.
The skill automates local system actions that create or overwrite Apple Notes via osascript, but the documentation does not clearly warn that using it modifies data on the user's macOS system. That increases the risk of users invoking it without informed consent, leading to unintended note creation, overwrites, or data integrity issues.
The skill documents shell and file-reading style capabilities through example commands and code, but it does not declare any explicit tool scope such as allowed-tools or permissions. This creates an authorization and review gap: an agent may invoke broader capabilities than users or platform policy expect, especially when the skill includes subprocess/osascript usage and file-based Markdown input.
The natural-language content of the skill, including description, usage, triggers, and workflow, is presented exclusively in Chinese. There is no indication that the user can choose another language or that this language restriction is required for a region-specific purpose.
The trigger phrases are broad and map to common note-taking language without exclusions or confirmation constraints. This can cause unintended invocation of a shell-capable macOS automation skill for ordinary user requests, increasing the chance of writing, updating, or reading Notes when the user did not explicitly intend to use this integration.
The manifest description emphasizes writing to Apple Notes with formatting support, but this example also enumerates existing notes and reads note contents. Those are additional read capabilities that go beyond a purely write-focused skill description.
This Python file performs a data-modifying write to Apple Notes, including update_existing=True, which can overwrite existing note content. While there is a progress print statement, there is no user-facing warning about the data modification risk or overwrite behavior in comments, docstrings, or a confirmation prompt.
The write path creates or updates user notes immediately with no confirmation, preview, or safety notice. In an agent skill, state-changing operations against personal data should be clearly signaled because mistakes, prompt misuse, or malicious upstream inputs can cause unintended data modification.
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
# 构建并执行AppleScript
script = self._build_applescript(title, content, folder, update_existing)
result = subprocess.run(
['osascript', '-e', script],
capture_output=True,
text=True
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
# 构建并执行AppleScript
script = self._build_applescript(title, content, folder, update_existing)
result = subprocess.run(
['osascript', '-e', script],
capture_output=True,
text=True
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
# 构建并执行AppleScript
script = self._build_applescript(title, content, folder, update_existing)
result = subprocess.run(
['osascript', '-e', script],
capture_output=True,
text=True
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
# 构建并执行AppleScript
script = self._build_applescript(title, content, folder, update_existing)
result = subprocess.run(
['osascript', '-e', script],
capture_output=True,
text=True
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
# 构建并执行AppleScript
script = self._build_applescript(title, content, folder, update_existing)
result = subprocess.run(
['osascript', '-e', script],
capture_output=True,
text=True
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
# 构建并执行AppleScript
script = self._build_applescript(title, content, folder, update_existing)
result = subprocess.run(
['osascript', '-e', script],
capture_output=True,
text=True
The skill is presented as an Apple Notes writer, but it also reads note bodies, lists note titles, and exposes note identifiers. That mismatch increases the risk of unintended data access and exfiltration because a caller may grant or invoke the skill expecting write-only behavior while it can also inspect existing personal notes.
The combination of get_note_id and update_by_id enables arbitrary modification of existing notes once an identifier is known. In skill context, this is more dangerous than a normal note-writer because it permits targeting preexisting user data outside the expected create/update-by-title workflow, making silent overwrite or tampering easier.
Updating by note ID overwrites note content directly and is especially risky because IDs enable precise targeting of existing notes. In the context of a personal-notes integration, lack of user confirmation or versioning can lead to irreversible loss or tampering of sensitive data.
This markdown file contains user-facing instructions exclusively in Chinese, and there is no indication that the skill is intended only for a Chinese-speaking audience or that users may choose another language. That can violate a language/locale policy requiring opt-in or documented justification for language constraints.
The primary skill description is written in Chinese with no indication that other languages are supported or that the language choice is intentional for a region-specific audience. This can violate language/locale policy when a skill imposes a specific language without user opt-in.
This code file contains user-facing natural language in Chinese throughout the docstring, comments, and printed output. Under the policy, forcing a specific language without user opt-in can be a natural-language policy violation, and there is no indication here that the skill is region-specific or that users can choose another language.
The file’s user-facing natural-language content and labels are entirely in Chinese, which may impose a language choice on users without opt-in. The policy allows locale constraints when explicitly offered as a choice or clearly justified, which is not present here.
This code writes content into Apple Notes, which affects user data by creating a note. Although the script prints status messages, it does not explicitly disclose that it will persist content into the user's Notes account or local Notes store.