T09 · Insecure Skill Coding Practices
- Location
scripts/chart-generator.py:113- Finding
Path Traversal Through Dataset-Controlled Chart Filenames
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill is a coherent spreadsheet analysis tool, but it has unsafe local output handling that could write files outside the intended folder or create risky HTML reports from untrusted data.
Review before installing, especially if you may analyze spreadsheets from other people. Run it only in a contained working directory, avoid untrusted datasets until chart filename sanitization and HTML escaping are fixed, review generated reports before sharing, and prefer pinned dependencies or a lockfile for reproducible installs.
scripts/chart-generator.py:113Path Traversal Through Dataset-Controlled Chart Filenames
scripts/report-generator.py:99Stored HTML Injection Through Unescaped Dataset Column Names
The package description is written entirely in Chinese, which signals a language-specific skill presentation without any indication that users can choose another language or that the skill is intentionally limited to Chinese-speaking users. Under the policy, language or locale constraints should be opt-in or clearly justified.
The example trigger phrases are broad natural-language requests like '帮我分析这份销售数据' and '看看有没有异常数据', which could cause the skill to be invoked in contexts the user did not specifically intend. In an agent environment, overly generic invocation examples can increase accidental execution of analysis pipelines, potentially causing unintended file reads, processing, and report generation on local data.
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
def run_script(script_path, args_list):
cmd = [sys.executable, str(script_path)] + args_list
result = subprocess.run(cmd, capture_output=True, text=True, cwd=Path(script_path).parent.parent)
if result.returncode != 0:
return {"error": result.stderr}
try:
The default value for --charts includes "correlation", but generate_charts only supports the key "heatmap". This directly contradicts the documented supported chart behavior and causes the default invocation to silently skip correlation heatmap generation.
The script can persist analysis output to any user-specified path, and that output may include sensitive dataset contents such as categorical top values, cross-tabulated labels, sheet-derived metadata, and statistical summaries that can reveal private information. In an agent/skill context, users may not realize that analysis results are being written to disk, which increases the risk of unintended data retention or disclosure through insecure locations, shared workspaces, or later exfiltration.
The HTML template sets lang="zh-CN", which imposes a specific language/locale setting on generated output. The file does not provide a user opt-in, configuration option, or documented region-specific justification for this locale choice.
The interface and documentation present this as a report generator supporting "html", "markdown", and "pdf" formats, but execution always calls generate_html_report and writes HTML content regardless of the selected format. This is an active intent/code mismatch because the declared option implies behavior the implementation does not provide.
The README describes ingesting spreadsheet and tabular files, generating charts, and producing reports, but it does not warn users that sensitive business or personal data may be read, transformed, and reproduced in derivative outputs. This can lead to accidental exposure when users process confidential datasets and then share generated charts or reports without realizing sensitive fields may be retained or inferred.
The user-facing documentation is entirely in Chinese, including usage guidance and feature descriptions, with no indication that this language choice is optional or tied to a justified regional requirement. This can violate language/locale policy where skills should not force a specific language without user opt-in.
The skill explicitly describes generating charts and reports into an output directory but does not warn users that uploaded dataset contents may be reproduced in derived artifacts such as markdown reports and PNG chart files. This can lead to unintended persistence or wider exposure of sensitive data, especially if the output directory is shared, synced, or later inspected by other tools or users.
The document declares lang="zh-CN", which fixes the content to a specific language/locale. The file does not indicate that this is optional, user-selected, or justified as a region-specific skill, so it may conflict with language-choice policy expectations.
This is a markdown file, so SQP-2 applies to omissions in user-facing warnings about behaviors affecting user data or system integrity. The walkthrough states that running the pipeline will produce analysis files, charts, and an HTML report under output/, but it does not warn users that executing the commands will create or overwrite local files.
The dependency is specified with a lower bound only, so installs can vary over time and across environments. This weakens reproducibility and can inadvertently pull in a newly introduced vulnerable or incompatible pandas release through the supply chain.
pandas>=2.0.0
numpy>=1.24.0
openpyxl>=3.1.0
matplotlib>=3.7.0
pandas has at least one historical advisory, but because the manifest does not pin an exact version, it is impossible to verify from this file alone whether an affected release would be installed. The danger is uncertainty: environments may resolve to a vulnerable version if version constraints and transitive dependencies are not tightly controlled.
The numpy requirement is not pinned to an exact version, which allows different environments to resolve to different releases. That increases supply-chain risk and makes it harder to ensure that only tested and non-vulnerable versions are installed.
pandas>=2.0.0
numpy>=1.24.0
openpyxl>=3.1.0
matplotlib>=3.7.0
seaborn>=0.12.0
numpy has multiple known advisories, and the unpinned manifest prevents confirming whether the eventual installed version is safe. While this file does not prove exploitation, it leaves a verifiable gap in dependency security assurance and could allow vulnerable versions into the environment.
Using openpyxl>=3.1.0 permits any newer version, including versions not yet reviewed for security or compatibility. This creates a low-severity supply-chain and reproducibility risk rather than an immediately exploitable flaw in the file itself.
pandas>=2.0.0
numpy>=1.24.0
openpyxl>=3.1.0
matplotlib>=3.7.0
seaborn>=0.12.0
tabulate>=0.9.0
openpyxl has known historical security issues, and the lack of exact version pinning means the manifest cannot demonstrate that a safe version will always be used. In a skill that may process spreadsheets, this uncertainty is more relevant because vulnerable parsing libraries can increase exposure when handling untrusted files.
matplotlib is not pinned exactly, so dependency resolution may change over time and introduce untested code into deployments. This undermines deterministic builds and can expose the environment to avoidable supply-chain issues.
pandas>=2.0.0
numpy>=1.24.0
openpyxl>=3.1.0
matplotlib>=3.7.0
seaborn>=0.12.0
tabulate>=0.9.0
The seaborn dependency is version-ranged instead of fixed, allowing future installs to pull in different releases. That increases the chance of accidental adoption of vulnerable or breaking upstream changes.
numpy>=1.24.0
openpyxl>=3.1.0
matplotlib>=3.7.0
seaborn>=0.12.0
tabulate>=0.9.0
tabulate is also unpinned, so builds are not reproducible and may consume new upstream releases without review. This is a classic low-severity dependency hygiene issue with supply-chain implications.
openpyxl>=3.1.0
matplotlib>=3.7.0
seaborn>=0.12.0
tabulate>=0.9.0
This code creates an output directory and writes analysis and report artifacts, but it does not include a clear warning that running the pipeline will create files under the chosen output path. The status prints show progress and destinations after the fact, but they do not function as a user-facing disclosure before the write occurs.
The module docstring says the tool supports a "correlation heatmap", but the implementation only recognizes the chart type key "heatmap" in the dispatch table. This is an active documentation mismatch because a user following the documented name would not get the intended behavior.
This code creates parent directories and writes an HTML report to the specified output path, which is a file-system modifying operation. Although the CLI exposes an --output argument, there is no confirmation prompt, warning comment/docstring near the write, or user-facing log message disclosing that the script will create directories and write files.