T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/create_feishu_doc.py:157
- Finding
- Feishu Tenant Access Token Fragment Exposed in Logs## Vulnerability Details **File Location**: `scripts/create_feishu_doc.py:157` **Vulnerability Type**: Sensitive credential disclosure through application logs **Risk Level**: Medium **Vulnerable Code**: ```python # Get token token = load_token() print(f"Token loaded: {token[:20]}...") ``` ### Technical Analysis After obtaining a live Feishu tenant access token, the application writes its first 20 characters to standard output. This disclosure is unnecessary for the document-creation workflow. Standard output from scheduled jobs and agent executions may be retained in cron logs, CI logs, centralized logging systems, terminal histories, or agent transcripts. Anyone with access to those records can obtain the disclosed credential fragment. Although the fragment alone may not be sufficient to authenticate, exposing any portion of an active bearer token weakens credential confidentiality and can facilitate token correlation or reconstruction when combined with other disclosures. ### Attack Path 1. A legitimate user or scheduled process runs `scripts/create_feishu_doc.py`. 2. The script reads the Feishu application credentials from `~/.openclaw/openclaw.json`. 3. The script exchanges those credentials for a tenant access token. 4. The first 20 characters of the token are printed to standard output. 5. A logging service, shared automation platform, or user with log access captures the token fragment. 6. The fragment may be correlated with other leaked authentication data or retained after the intended execution context ends. ### Impact Assessment The issue exposes a fragment of Feishu authentication material to every system or user that can read process logs. It does not, by itself, establish that an attacker can authenticate using the fragment alone. If combined with another partial disclosure or vulnerable token format, however, it may contribute to unauthorized access within the permissions granted to the Feishu app ...[truncated 170 chars]
- Remediation
- ## Remediation Suggestions Remove all credential-derived values from logs: ```python token = load_token() print("Feishu tenant access token obtained successfully") ``` Additional hardening measures: - Never log complete or partial bearer tokens, application secrets, authorization headers, or token-exchange responses. - Configure automation and centralized logging systems to redact credential patterns as a defense-in-depth measure. - Restrict access to logs generated by scheduled and agent-driven executions. - Rotate the Feishu application secret if token material has previously been retained in broadly accessible logs. - Ensure that exceptions from authentication operations do not include request bodies containing `app_secret`.
