T09 · Insecure Skill Coding Practices
- Location
scripts/ofd_to_text.py:29- Finding
Unbounded Processing of Untrusted OFD Archives
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This is a straightforward OFD document conversion skill with disclosed local file output and an optional dependency installer, and I found no hidden persistence, exfiltration, or deceptive behavior.
Install only if you are comfortable using a local converter on OFD files. Avoid running the optional dependency installer unless needed, process only trusted OFD documents when possible, and write output to a deliberate workspace path so existing files are not overwritten.
scripts/ofd_to_text.py:29Unbounded Processing of Untrusted OFD Archives
scripts/install_dependencies.py:11Unpinned Third-Party Package Installation
声明描述包含两项核心能力:1)提取纯文本;2)转换为 Markdown,并保留基本格式如标题、段落、表格。代码确实实现了基础的 OFD 文本提取,但没有任何 Markdown 生成逻辑,也没有对文档结构、段落层级、标题识别或表格解析的处理。它只是扫描部分 XML 文件中的 TextCode/TextContent 文本并拼接输出。因此,描述对该 skill 的能力有实质性夸大,尤其是“转换为 Markdown 格式”和“处理基本版式结构”并未在代码中体现,构成描述与行为不一致。
The skill documents shell execution of local Python scripts and writing output files, but it does not declare any explicit tool scope such as allowed-tools or permissions. This creates an authorization gap where the runtime capabilities required by the skill are broader than what the manifest transparently communicates, increasing the chance of unintended command execution or file writes when the skill is invoked.
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
for package in dependencies:
print(f"安装 {package}...")
try:
subprocess.check_call([sys.executable, "-m", "pip", "install", package])
print(f" {package} 安装成功")
except subprocess.CalledProcessError as e:
print(f" 警告: {package} 安装失败: {e}")
This script fetches and installs packages from pip at runtime, which introduces a software supply-chain risk unrelated to the core document-reading logic. If package resolution is tampered with, a malicious or compromised dependency could execute code during installation, expanding the skill from local file processing into network-backed code acquisition and execution.
Manifest 描述该 skill 支持从 OFD 提取文本并转换为 Markdown,且可处理标题、段落、表格等基本格式;但此文件只提取 TextCode/TextContent 并输出纯文本,没有任何 Markdown 结构化转换逻辑。与此同时,main() 还提供将结果写入任意输出路径的能力,这比“读取”更接近通用文件导出行为。
The script accepts an arbitrary output path and writes extracted content there without constraining the destination. In an agent/tooling context, this expands a document-reading skill into a local file write primitive, which can be abused to overwrite user files, place data in sensitive locations, or enable follow-on attacks if the caller can influence the path.
The entire reference file is written in Chinese and presents the material solely in that language, with no indication that users can select another language or that the localization is optional. Under the policy for natural-language violations, forcing a specific language without user opt-in can be a concern unless the locale constraint is clearly documented and justified.
The docstring, function docstring, and all printed user-facing messages are in Chinese, which imposes a specific language on users. The file does not indicate that the skill is region-specific or provide any opt-in or fallback language behavior.
This is a code file, so SQP-3 applies to natural-language text in docstrings and messages. The file presents its description and usage entirely in Chinese and does not offer an alternative language or indicate that the tool is intentionally region-specific, which can violate language/locale policy requirements.
The top-level docstring presents the tool as converting OFD to Markdown while preserving basic structure, implying faithful processing. However, _process_document suppresses all exceptions with pass, which can silently skip document content and produce incomplete output without indicating that preservation/conversion failed.
The manifest emphasizes extracting text from OFD and converting it to Markdown, which suggests a reader/converter role. The code also performs filesystem write operations to a user-specified output path, adding a persistence side effect not stated in the manifest description.
文件头和函数 docstring 都将该脚本描述为 OFD 文本提取工具,强调的是读取/提取语义。实际 main() 除了提取外,还会在提供第二个参数时执行文件写入,这与“仅提取”的表述存在意图层面的偏差。
The file’s docstrings and CLI messages are written exclusively in Chinese, including usage and error output. This imposes a specific language on users without any opt-in or indication that the tool is intended only for a Chinese-speaking or region-specific context.
No suspicious patterns detected.