T09 · Insecure Skill Coding Practices
- Location
config.json:1- Finding
Plaintext API Credential Included in the Distributed Configuration
- Content
View full analysis
Optional[Dict]: if not os.path.exists(config_path): return None with open(config_path, "r", encoding="utf-8") as f: config = json.load(f) if not config.get("api_key"): return None config.setdefault("base_url", "https://open-api.rabyte.cn") return config ``` ```python def __init__(self, config: Dict): self.base_url = config["base_url"].rstrip("/") self.headers = { "app-agent": config["api_key"], "Content-Type": "application/json", } ``` Any party able to download or read the Skill package can recover the credential without executing the code. Masking the key in the `config --show` output does not protect the plaintext value stored on disk or distributed with the package. ### Attack Path 1. An attacker obtains the Skill archive, repository contents, deployment artifact, backup, or another copy of the project directory. 2. The attacker opens `config.json` and extracts the plaintext `api_key`. 3. The attacker constructs requests to the AlphaPai API using the stolen value in the `app-agent` header. 4. Requests are processed under the identity, quota, and authorization associated with the exposed credential. No local code execution is required to extract the secret. ### Impact Assessment The attacker may impersonate the credential owner to the AlphaPai service, consu ...[truncated 538 chars]- Remediation
View remediation
