T09 · Insecure Skill Coding Practices
- Location
workspace-template/scripts/write_memory_entry.py:30- Finding
Path Traversal Allows Modification of Persistent Agent Instruction Files
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill is mostly a disclosed review-first Xiaohongshu workflow, but it reads broad local records for externally sent drafts and has unsafe persistent memory handling that needs review before use.
Review this skill before installing. Use it only if you are comfortable with the agent reading local sessions, logs, and workspace artifacts and sending draft summaries to the configured Feishu recipient. Validate XHS_REVIEW_OPEN_ID, restrict what local files the workflow may inspect, avoid storing untrusted or multiline memory entries, and patch write_memory_entry.py to validate --date before relying on persistent memory or cron-driven use.
workspace-template/scripts/write_memory_entry.py:30Path Traversal Allows Modification of Persistent Agent Instruction Files
workspace-template/scripts/write_memory_entry.py:39Untrusted Content Is Persisted and Reloaded as Agent Memory
workspace-template/SOUL.md:12Broad Local Record Access May Expose Sensitive Information Through Feishu Review
The declared purpose presents a narrow, review-first Xiaohongshu workflow, but the detected behavior includes local filesystem writes and generic memory logging not clearly disclosed in the skill contract. This mismatch can mislead operators about what the skill actually does, causing them to authorize execution under false assumptions and increasing the risk of unauthorized data persistence or unintended side effects.
Code enumerates, copies, or searches environment variables for secrets. Bulk environment access can collect credentials unrelated to the skill's stated purpose.
root = toolkit_root()
cmd = build_command(root, payload)
env = os.environ.copy()
env["XHS_CHROME_USER_DATA_DIR"] = tempfile.mkdtemp(prefix="xhs-publish-profile-")
raise SystemExit(subprocess.run(cmd, cwd=root, env=env).returncode)
The skill declares no explicit tool scope while instructing use of bundled scripts and implying file and shell-capable operations. In an agent environment, missing permission boundaries increases the chance the skill can access environment data, read/write arbitrary files, or invoke commands beyond what users expect from a review-first content workflow.
The default prompt uses a broad invocation phrase that can cause the skill to be triggered in situations beyond the author's intended scope. Because implicit invocation is enabled, ambiguous wording increases the chance of accidental activation for content-generation tasks, which could bypass expected user intent boundaries and start review/publish workflows unexpectedly.
The operational instructions in this file are written entirely in Chinese and implicitly require the agent workflow to operate in that language. There is no indication that users may choose another language or that the locale restriction is intentionally justified as a region-specific skill, which creates a natural-language policy concern.
The document provides a concrete deletion command for removing a note by title and timestamp, but it does not require confirmation, preview, or any operator safety checks. In a workflow skill that may be reused operationally, this increases the chance of accidental or socially engineered destructive actions, especially if an agent treats the command examples as approved execution patterns.
Lines L3-L4 are written as prescriptive instructions in Chinese and provide no indication that other languages are allowed. This creates a natural-language locale policy concern because it effectively forces a specific language without user opt-in or a documented regional justification.
The purpose statement is written to operate specifically in Chinese context and references producing a Xiaohongshu publishing package, but it does not offer the user a language or locale choice. Under the policy, forcing a specific language or locale without opt-in is a natural-language policy violation unless clearly justified as region-specific.
The file’s operative instructions are written as mandatory guidance in Chinese for producing Xiaohongshu content, which effectively constrains the skill to a specific language/locale. The policy allows such constraints only when the user is offered a language choice or the locale limitation is clearly documented and justified; neither appears here.
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
cmd = build_command(root, payload)
env = os.environ.copy()
env["XHS_CHROME_USER_DATA_DIR"] = tempfile.mkdtemp(prefix="xhs-publish-profile-")
raise SystemExit(subprocess.run(cmd, cwd=root, env=env).returncode)
if __name__ == "__main__":
The documented commands and interaction patterns are entirely in Chinese, which may imply the skill expects or forces a specific language without stating that this is optional or region-specific. The file does not clarify that Chinese is merely an example language or that users may interact in another language.
The name 'Xiaohongshu Ops Copilot' hard-codes a specific language/locale/platform context in the skill identity. Because the file does not indicate that this locale is optional, user-selectable, or justified as region-specific, it may conflict with a policy requiring language or locale choice.
The script writes supplied JSON content into a markdown file under the memory directory and only prints the resulting path afterward. There is no confirmation prompt, warning comment, or docstring explaining that user input will be persisted to disk, which is relevant because the content may include personal notes or preferences.