T09 · Insecure Skill Coding Practices
- Location
scripts/alibaba_cloud_model_setup.py:394- Finding
Inline API keys are stored without enforcing restrictive file permissions
- Content
View full analysis
None: """Save config to JSON file with pretty formatting.""" config_path.parent.mkdir(parents=True, exist_ok=True) with open(config_path, "w", encoding="utf-8") as f: json.dump(config, f, indent=2, ensure_ascii=False) f.write("\n") ``` ```python if api_key_source == "inline": provider_config["apiKey"] = api_key # else: apiKey will be read from env var ``` ### Technical Analysis When inline storage is selected, the script inserts the plaintext Alibaba Cloud API key into the OpenClaw JSON configuration. The file is opened using the process's default permission behavior, and the script neither creates it with an explicit owner-only mode nor corrects permissions on an existing file. The resulting permissions depend on the current umask. On systems with permissive defaults, a newly created configuration may be readable by other local users. An existing configuration with weak permissions also remains weak. Timestamped backups can preserve the same sensitive content and inherited permissions. The network transmission of the API key to a fixed Alibaba Cloud HTTPS endpoint is consistent with the declared validation functionality. The vulnerability is the subsequent plaintext storage without enforced filesystem protection. ### Attack Path 1. A user runs the configurator and selects `inline` API-key storage. 2. The script adds the API key to `models.providers.bailian.apiKey`. 3. The script creates or rewrites the configuration without enforcing mode `0600`. 4. The file or a generated backup remains readable under local filesystem permissions. 5. Another local account or comprom ...[truncated 631 chars]- Remediation
View remediation
