T09 · Insecure Skill Coding Practices
Warning
- Location
- config.yaml:16
- Finding
- Plaintext Credential Storage in Configuration Template<![CDATA[ ## Vulnerability Details **File Location**: `config.yaml`, lines 16-63 **Vulnerability Type**: Plaintext sensitive-data storage **Risk Level**: Medium ### Vulnerable Code ```yaml TUSHARE_TOKEN: "Tushare token placeholder" JOINQUANT_USERNAME: "" JOINQUANT_PASSWORD: "" IFIND_USERNAME: "" IFIND_PASSWORD: "" SMTP_SERVER: "smtp.qq.com" SMTP_PORT: "587" EMAIL_USERNAME: "Email address placeholder" EMAIL_PASSWORD: "Email authorization-code placeholder" RECIPIENT_EMAIL: "Recipient email address placeholder" SERVERCHAN_SCKEY: "" WECHAT_WEBHOOK: "" ``` The placeholder descriptions above are English translations of the non-secret placeholder values in the audited configuration. The credential keys and storage structure are unchanged. ### Technical Analysis The distributed YAML configuration instructs users to place reusable API tokens, account passwords, email authorization codes, messaging keys, and webhook URLs directly into a plaintext file. The file comments claim that a copied `config_local.yaml` file will be excluded from version control, but the audited project contains no `.gitignore` file that enforces this protection. The executable code currently reads `TUSHARE_TOKEN` from this configuration and provides it to the Tushare SDK. The JoinQuant, iFinD, email, ServerChan, and WeChat credentials are not consumed by the reviewed implementation, so exposing fields for these credentials unnecessarily increases the sensitive-data footprint. Plaintext configuration files are commonly copied into source repositories, backups, support bundles, shared archives, and build artifacts. Unlike short-lived credentials obtained at runtime, secrets stored this way remain reusable by anyone who obtains the file. ### Attack Path 1. A user copies `config.yaml` to `config_local.yaml` as directed by the configuration comments. 2. The user enters a valid Tushare token, account password, email authorization code, messaging key, or webhook URL. 3. The user assumes the ...[truncated 1447 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Remove password, authorization-code, key, and webhook fields that are not used by the implementation. 2. Obtain required secrets from environment variables or an operating-system secret manager rather than ordinary YAML files. 3. Keep only non-sensitive settings in `config.yaml`; provide a separate example file containing clearly invalid placeholders. 4. Add and verify version-control exclusions for local secret files, including: ```gitignore config_local.yaml config.*.local.yaml .env .env.* ``` 5. Validate configuration values and reject known placeholder strings instead of treating them as valid tokens. 6. Restrict secret-file permissions to the owning user where file-based secrets remain unavoidable. 7. Avoid printing secrets in logs, errors, generated reports, or diagnostic output. 8. Document credential rotation and immediate revocation procedures for accidentally committed secrets. 9. Add automated secret scanning to development and release workflows. 10. If a populated configuration has previously been committed, remove it from repository history and rotate every affected credential; deleting only the latest copy is insufficient. ]]>
