T09 · Insecure Skill Coding Practices
- Location
scripts/update_config.py:29- Finding
API Keys Are Stored in Plaintext and Accepted Through Command-Line Arguments
- Content
View full analysis
dict: """Update the API key for the selected model.""" config = load_config() if model not in config.get("models", {}): return {"error": f"Unknown model: {model}; supported models: qwen, banana, dalle"} config["models"][model]["api_key"] = key config["models"][model]["enabled"] = True save_config(config) return {"success": True, "model": model, "message": f"{model} API key updated"} ``` ```python setkey = sub.add_parser("set-key", help="Set an API key") setkey.add_argument("model", choices=["qwen", "banana", "dalle"], help="Model name") setkey.add_argument("key", help="API Key") ``` The shipped configuration provides plaintext fields into which credentials are written: ```yaml models: qwen: enabled: true api_key: "" banana: enabled: false api_key: "" dalle: enabled: false api_key: "" ``` ### Technical Analysis The configuration manager serializes API keys directly into `config/models.yaml`. It also writes the complete configuration, including credentials, to the predictable temporary path `config/models.yaml.tmp` before replacing the final file. Neither the temporary file nor the final configuration file is explicitly created with owner-only permissions. Their ...[truncated 2477 chars]- Remediation
View remediation
