T09 · Insecure Skill Coding Practices
- Location
scripts/generate_xmind.py:287- Finding
Arbitrary File Overwrite Through an Unvalidated Output Path
- Content
View full analysis
2 else "测试用例.xmind" if input_file: with open(input_file, 'r', encoding='utf-8') as f: test_data = json.load(f) else: test_data = DEFAULT_TEST_DATA result = generate_xmind(test_data, output_file) ``` ### Technical Analysis The `output_file` value is used without path normalization, directory confinement, extension validation, symlink checks, or overwrite authorization. Python's `zipfile.ZipFile` with mode `'w'` creates the specified file or truncates an existing file before writing the XMind ZIP archive. Consequently, a caller can supply: - An absolute path. - A relative path containing parent-directory traversal components. - A path to an existing writable file. - Potentially a path resolving through a symbolic link. Although `output_file` is not declared in `skill.yaml`, the Python `run()` func ...[truncated 2082 chars]- Remediation
View remediation
