T09 · Insecure Skill Coding Practices
Error
- Location
- config/feishu.env:4
- Finding
- Committed Feishu Application Secret<![CDATA[ ## Vulnerability Details **File Location**: `config/feishu.env:4-5` **Vulnerability Type**: Hardcoded production credential **Risk Level**: Critical ### Vulnerable Code ```bash FEISHU_APP_ID=cli_a90da2f009f8dbb3 FEISHU_APP_SECRET=[REDACTED ACTIVE SECRET] ``` The actual source file contains a plaintext secret. Its value is redacted from this report to avoid further credential exposure. ### Technical Analysis A Feishu application secret is committed directly to the project configuration. This contradicts the warning in the same file that sensitive information must not be committed. The credential is consumed by `scripts/feishu-auth.sh` and transmitted to Feishu's official tenant-token endpoint: ```bash response=$(curl -s -X POST "https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal" \ -H "Content-Type: application/json" \ -d "{ \"app_id\": \"${FEISHU_APP_ID}\", \"app_secret\": \"${FEISHU_APP_SECRET}\" }") ``` Possession of both the application ID and application secret can allow an unauthorized party to obtain a tenant access token. The resulting privileges depend on the permissions granted to the Feishu application. This network transmission is necessary for Feishu authentication and targets the official HTTPS endpoint. The vulnerability is not the transmission itself, but the inclusion of the secret in the distributed project. ### Attack Path 1. An attacker obtains the repository, Skill package, artifact, backup, or historical commit. 2. The attacker extracts the Feishu application ID and secret from `config/feishu.env`. 3. The attacker submits those credentials to Feishu's tenant access-token endpoint. 4. Feishu returns a tenant token if the credential remains valid. 5. The attacker invokes APIs enabled for the application, potentially including message, document, drive, wiki, OCR, or group operations. ### Impact Assessment The attacker may receive the same application-level privileges that Feishu grants t ...[truncated 470 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Revoke and rotate the exposed Feishu application secret immediately. 2. Review Feishu audit logs for token issuance and API activity associated with the application. 3. Remove the secret from the current tree and all repository history. 4. Replace `config/feishu.env` with a non-sensitive template such as: ```bash FEISHU_APP_ID= FEISHU_APP_SECRET= ``` 5. Add actual credential files to `.gitignore` and distribution exclusion rules. 6. Load production credentials from a protected environment variable, operating-system credential store, or centralized secret manager. 7. Restrict the Feishu application to only the scopes required by the enabled features. 8. Add automated secret scanning to pre-commit and CI workflows. 9. Rotate the secret again after repository-history cleanup if copies may already have been distributed. ]]>
