T09 · Insecure Skill Coding Practices
- Location
src/index.ts:39- Finding
Unrestricted File Paths Permit Renaming Files Outside the Intended Download Directory
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This skill has a legitimate file-renaming purpose, but it can rename arbitrary accessible local files from loosely parsed message text and writes logs to a predictable shared temp path.
Review before installing. Use this only in a tightly scoped working directory or sandbox, and avoid feeding it untrusted Feishu messages until it validates paths, uses explicit command triggers, previews planned renames, requires confirmation, and writes logs to a unique private location.
src/index.ts:39Unrestricted File Paths Permit Renaming Files Outside the Intended Download Directory
src/index.ts:248Predictable Shared Temporary Log Path Permits Symlink-Based File Overwrite
brace-expansion 1.1.13 has multiple reported denial-of-service issues related to pathological expansion causing excessive CPU or memory consumption. Here it is a transitive dependency under glob/minimatch in development tooling, so context reduces direct product exposure, but it remains a genuine vulnerability that could impact CI jobs or local tooling if attacker-controlled patterns are ever evaluated.
browserslist 4.28.2 is reported vulnerable to crash/prototype-write and unbounded memory growth when handling untrusted stats or many distinct queries. Because this is a dev-tool dependency, the main risk is disruption or unsafe behavior in build environments rather than end-user runtime compromise, but it is still a real vulnerability if CI or local scripts ingest untrusted configuration or stats data.
js-yaml 3.14.2 has multiple parser-related CPU exhaustion issues, making crafted YAML capable of causing significant denial of service during parsing. Although it is present only as a transitive dev dependency here, YAML parsers are commonly exposed to configuration files in CI and developer workflows, so the issue is genuine and relevant when untrusted YAML can be introduced.
The trigger phrases include broad natural-language commands such as '重命名这些文件' and '恢复文件名', which can overlap with ordinary conversation in Feishu chats. In a chat-integrated automation context, ambiguous triggers can cause unintended invocation on user content, leading to unauthorized or surprising file operations and possible data handling against the wrong message context.
The documentation presents automatic detailed log generation as a core feature, including an example markdown log. But the provided batchRename code only accumulates in-memory counts and errors and returns them; there is no file-writing or log-generation behavior in the shown implementation. This is a direct mismatch between documented intent and actual code behavior.
The FAQ states that special characters are automatically filtered and only Chinese, English, numbers, and underscores are retained. However, the only provided renaming implementation at L160-L180 directly derives the new filename from originalName and preserves the extension, with no filtering or sanitization logic shown. This is an active documentation-to-code contradiction, not merely missing detail.
The documentation describes batch renaming and conflict handling but does not warn users that the skill performs filesystem write operations that may modify many files at once. In this skill's context, silent bulk renaming is potentially destructive because mistaken mappings or accidental invocation can alter or disrupt large file sets.
The natural-language triggers are broad and overlap with ordinary conversation, which can cause accidental invocation of a file-renaming skill. In this context, unintended activation may lead to batch file writes or renames without the user clearly intending to perform a destructive filesystem action.
The file defines the interaction style entirely in Chinese and prescribes fixed Chinese phrasing, but does not indicate that the user can choose another language or that the skill is intentionally limited to a Chinese-speaking region. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation.
The manifest lists natural-language triggers such as "重命名文件" and especially "飞书文件" without clarifying the exact activation scope or exclusions. These phrases are broad enough to overlap with ordinary conversation about Feishu files, increasing the risk of unintended invocation.
The batchRename function signature advertises an optional outputDir parameter, and the help text later instructs users to use --output-dir for batch renaming. However, the code never uses outputDir and restoreFileName always renames within dirname(hashFile), so the documented behavior contradicts the actual implementation.
The returned usage documentation claims the skill supports batch renaming via --message-id and data-driven operation from a Feishu bitable, but the handler only parses file mappings from the provided message string and performs local filesystem renames. There is no code that fetches messages by ID, reads bitable data, or integrates with Feishu APIs, so the documentation actively overstates the skill's behavior.
This code performs safety-relevant filesystem changes by batch-renaming files and writing a log file to /tmp, but the execution path contains no confirmation prompt or user-facing warning immediately before those actions. Although the skill purpose is renaming, the code also creates an additional file and directly modifies filenames, so users should be clearly informed that local files will be changed and a log will be written.
The example '@机器人 帮我重命名这些文件' is everyday language and may be interpreted from normal conversation rather than a deliberate command. In a collaborative chat setting, this increases the chance of accidental activation, especially if the bot has access to files in the thread or message history.
该技能说明、触发词、示例输出均默认且仅以中文呈现,没有提供其他语言选项,也未说明这是面向特定中文用户群或区域场景的限定。按语言/地区策略,若强制特定语言而无用户选择或明确合理性说明,属于自然语言层面的策略问题。
The skill states that it integrates with Feishu messages, chats, and bitable data, but it does not disclose the privacy implications of reading message metadata and table contents. While not an exploit by itself, the lack of transparency increases the risk of users exposing sensitive filenames, chat context, or document associations without informed consent.
The file states '数量:无限制' (unlimited quantity), but elsewhere the skill is described as batch-processing 'hundreds of files' and gives performance examples only up to 100 files. This is an intent/documentation inconsistency: the documentation overstates capability beyond what the rest of the file substantiates.
The lockfile pins @babel/core 7.29.0, and the cited advisory indicates an arbitrary file-read condition via sourceMappingURL processing. In this repo it is only a development dependency used through Jest/Babel tooling, so exposure is limited, but it is still a real supply-chain risk if untrusted source files are processed during local development or CI.
baseline-browser-mapping 2.10.16 is flagged for process termination on invalid input, which is a denial-of-service issue. In this package-lock it appears only as a transitive dev dependency of browserslist, so the practical risk is mostly limited to build or test tooling rather than runtime exploitation.
The package description is entirely in Chinese and the manifest metadata also uses Chinese labels, with no indication that other language options are supported. This can be a natural-language policy concern if organizational policy requires user language choice or opt-in rather than a fixed locale.
Dependencies lack version pinning, allowing potential malicious package updates. Consider pinning versions.
"author": "郑宇航",
"license": "MIT",
"devDependencies": {
"@types/jest": "^29.0.0",
"@types/node": "^20.19.39",
"jest": "^29.0.0",
"ts-jest": "^29.0.0",
Dependencies lack version pinning, allowing potential malicious package updates. Consider pinning versions.
"license": "MIT",
"devDependencies": {
"@types/jest": "^29.0.0",
"@types/node": "^20.19.39",
"jest": "^29.0.0",
"ts-jest": "^29.0.0",
"typescript": "^5.9.3"
Dependencies lack version pinning, allowing potential malicious package updates. Consider pinning versions.
"devDependencies": {
"@types/jest": "^29.0.0",
"@types/node": "^20.19.39",
"jest": "^29.0.0",
"ts-jest": "^29.0.0",
"typescript": "^5.9.3"
},
Dependencies lack version pinning, allowing potential malicious package updates. Consider pinning versions.
"@types/jest": "^29.0.0",
"@types/node": "^20.19.39",
"jest": "^29.0.0",
"ts-jest": "^29.0.0",
"typescript": "^5.9.3"
},
"clawhub": {
Dependencies lack version pinning, allowing potential malicious package updates. Consider pinning versions.
"@types/node": "^20.19.39",
"jest": "^29.0.0",
"ts-jest": "^29.0.0",
"typescript": "^5.9.3"
},
"clawhub": {
"category": "效率",