T09 · Insecure Skill Coding Practices
Error
- Location
- scripts/migrate.py:139
- Finding
- Private and third-party data is bundled into distributable archives## Vulnerability Details **File Location**: `scripts/migrate.py:139-161`; affected data includes `EXAMPLES/xiaoyi-example/owner.json:3-33`, `EXAMPLES/xiaoyi-example/memory.json:5-93`, and `EXAMPLES/xiaoyi-example/relations.json:5-133` **Vulnerability Type**: Sensitive-data exposure through unsafe archive inclusion **Risk Level**: High ### Vulnerable Code ```python include_patterns = [ "README.md", "MIGRATION-GUIDE.md", "CHANGES.md", "manifest.toml", "TEMPLATE/", "EXAMPLES/", "scripts/" ] exclude_files = [] print(f"\nSource directory: {root_dir}") print(f"Output file: {output_name}") with zipfile.ZipFile(output_path, 'w', zipfile.ZIP_DEFLATED) as zipf: for pattern in include_patterns: full_path = root_dir / pattern if full_path.exists(): if full_path.is_file(): arcname = full_path.name zipf.write(full_path, arcname) else: for file_path in full_path.rglob("*"): if file_path.is_file(): arcname = str(file_path.relative_to(root_dir)) if file_path.name not in exclude_files: zipf.write(file_path, arcname) ``` The recursively included example files contain plaintext records marked as private or sensitive, including an owner's name, location, profession, family details, recurring schedule, business strategy, investment positions, third-party email addresses, relationship histories, and communication summaries. ### Technical Analysis The `pack_zip()` function uses a fixed inclusion list that contains the entire `EXAMPLES/` directory. It then recursively archives every regular file because `exclude_files` is empty. There is no data classification enforcement, redaction, sensitive-data scan, user confirmation, or allowlist of approved example files. This behavior conflicts with the se ...[truncated 1836 chars]
- Remediation
- ## Remediation Suggestions 1. Remove all real personal and third-party information from the repository and replace it with clearly synthetic example data. 2. Exclude `EXAMPLES/` from production archives by default. 3. If examples are needed, require an explicit option such as `--include-examples`. 4. Replace recursive directory inclusion with a strict allowlist of files selected for the current migration. 5. Add a pre-pack scan for email addresses, phone numbers, credentials, financial positions, schedules, and other personal data. 6. Block packaging when private or sensitive files are detected unless the user explicitly reviews and approves each file. 7. Display the final archive inventory and sensitivity classification before creating the ZIP. 8. Add automated tests confirming that private example files cannot enter default release archives. 9. Obtain consent before distributing any third-party contact or relationship information.
