T09 · Insecure Skill Coding Practices
- Location
group_learning.py:6- Finding
Hardcoded Feishu Application Credentials
- Content
View full analysis
Vulnerability Details
File Locations:
group_learning.py:6-7group_learning.py:15-18analyze.sh:3-5
Vulnerability Type: Hardcoded reusable credentials
Risk Level: HighVulnerable Code
group_learning.py:6-7:python APP_ID = "cli_a92b19fbc278dbd6" APP_SECRET = "WFsYhmcEZnRjL4c1ClotIeHhoq5568Sp"group_learning.py:15-18:python def get_token(): url = "https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal" resp = requests.post(url, json={"app_id": APP_ID, "app_secret": APP_SECRET}) return resp.json().get("tenant_access_token")analyze.sh:3-5:bash TOKEN=$(curl -s -X POST "https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal" \ -H "Content-Type: application/json" \ -d '{"app_id":"cli_a92b19fbc278dbd6","app_secret":"WFsYhmcEZnRjL4c1ClotIeHhoq5568Sp"}' | python3 -c "import sys,json; print(json.load(sys.stdin).get('tenant_access_token',''))")Technical Analysis
A reusable Feishu application ID and secret are embedded directly in two distributable source files. Anyone who can download the Skill, inspect a deployed copy, access source-control history, or read a backup can recover the credential without executing the Skill.
Sending credentials to Feishu's official authentication endpoint is required to obtain a tenant access token. Embedding a fixed secret in the package is not required and violates least-privilege and secret-management principles. The documented configuration mechanism is not used to obtain credentials.
The retrieved tenant token is subsequently placed in an authorization header and used to query Feishu messages:
python headers = {"Authorization": f"Bearer {token}"}The precise authorization scope cannot be determined from the reviewed files because Feishu application permissions are configured externally. Exploitation is therefore limited by the permissions grante ...[truncated 1318 chars]
- Remediation
View remediation
Remediation Suggestions
-
Revoke and rotate the exposed Feishu application secret immediately. Removing it from the current files is insufficient because copies and source history may retain it.
-
Remove credentials from both
group_learning.pyandanalyze.sh, including repository history and release artifacts where feasible. -
Load credentials from environment variables or an OpenClaw-supported secret store:
python APP_ID = os.environ.get("FEISHU_APP_ID") APP_SECRET = os.environ.get("FEISHU_APP_SECRET") if not APP_ID or not APP_SECRET: raise RuntimeError("Feishu credentials are not configured") -
Pass secrets to scheduled executions through a protected runtime environment rather than command-line arguments, where they may be exposed through process listings.
-
Restrict secret-file permissions to the account running the Skill, such as mode
0600. -
Grant the Feishu application only the minimum message-reading permissions required for explicitly configured groups. Remove unrelated write and administrative scopes.
-
Implement short request timeouts, status checks, and safe error handling without logging credentials or bearer tokens.
-
Add automated secret scanning to development and release workflows.
-
