T09 · Insecure Skill Coding Practices
Error
- Location
- scripts/scan.py:73
- Finding
- Unrestricted archival and upload of sensitive files to configurable network endpoints## Vulnerability Details **File Location**: `scripts/scan.py:73-78`, `scripts/scan.py:176-184`, `scripts/scan.py:226`, and `scripts/scan.py:316-324` **Vulnerability Type**: Unrestricted sensitive-data collection and network disclosure **Risk Level**: High ### Vulnerable Code ```python with zipfile.ZipFile(temp_zip.name, 'w', zipfile.ZIP_DEFLATED) as zipf: for root, dirs, files in os.walk(dir_path): for file in files: file_path = os.path.join(root, file) # Calculate relative path for the zip archive arcname = os.path.relpath(file_path, dir_path) zipf.write(file_path, arcname) ``` ```python # Prepare multipart upload with open(file_to_upload, 'rb') as f: file_content = f.read() files = { 'File': (os.path.basename(file_to_upload), file_content, 'application/zip') } data = { 'Name': name, 'Description': description, 'IntegrateType': 'file', 'ScanNow': 'true' } ``` ```python response = requests.post(self.upload_url, headers=v_request.headers, data=prepped.body) ``` ```python base_url = os.environ.get("SCAN_BASE_URL", "") ak = os.environ.get("VOLC_ACCESS_KEY") or os.environ.get("VOLC_ACCESSKEY") or os.environ.get("SCAN_AK") sk = os.environ.get("VOLC_SECRET_KEY") or os.environ.get("VOLC_SECRETKEY") or os.environ.get("SCAN_SK") region = os.environ.get("VOLC_REGION", DEFAULT_REGION) host = os.environ.get("SCAN_SERVICE_HOST", DEFAULT_HOST) service = os.environ.get("VOLC_SERVICE", DEFAULT_SERVICE) session_token = os.environ.get("VOLC_SESSION_TOKEN", "") user_id = os.environ.get("VOLC_USERID", "") ``` ### Technical Analysis The directory-packaging routine recursively includes every file reachable through `os.walk()` without applying exclusions, validating file types, checking for secrets, presenting a manifest, or imposing file-count and archive-size limits. The resulting archive is read in full and t ...[truncated 2778 chars]
- Remediation
- ## Remediation Suggestions 1. Default strictly to a loopback analysis service and require explicit, informed user consent before uploading any content to a remote service. 2. Enforce HTTPS for every non-loopback endpoint. Reject plaintext remote URLs rather than relying on user configuration. 3. Maintain an allowlist of trusted service origins and reject arbitrary `SCAN_BASE_URL` and `SCAN_SERVICE_HOST` values. 4. Build archives from an explicit allowlist of required source and metadata files rather than recursively including all files. 5. Exclude sensitive and unnecessary content by default, including `.env*`, private-key formats, credential files, VCS metadata, caches, build output, sockets, and symlinks. 6. Perform secret detection before packaging and stop the upload when likely credentials or private keys are found. 7. Display the exact destination and a complete archive manifest, including total size, before remote transmission. 8. Add configurable limits for individual file size, total archive size, recursion depth, and file count. 9. Stream uploads instead of reading the complete archive into memory. 10. Avoid forwarding signed authorization headers to any destination that has not passed strict origin validation. 11. Update `SKILL.md` to disclose cloud and configurable remote-upload behavior accurately, including what files are collected and where they are sent. 12. Implement the documented `config.json` behavior securely or remove that claim from the documentation.
