T09 · Insecure Skill Coding Practices
Warning
- Location
- check.js:37
- Finding
- Sensitive Feishu identifiers exposed in logs and failure briefings<![CDATA[ ## Vulnerability Details **File Location**: `check.js`, lines 37–43 and 105 **Vulnerability Type**: Sensitive identifier exposure through logging and outbound messages **Risk Level**: Medium ### Vulnerable Code ```js console.log(` Fetching doc: ${link.token}`); const docData = await readDoc(link.token); const preview = extractPreview(docData.content); summaries.push(`📄 **${docData.title || 'Untitled'}**\n${preview}`); } catch (e) { console.error(` Failed to read doc ${link.token}: ${e.message}`); summaries.push(`❌ Failed to load doc: ${link.token}`); } ``` The configured recipient identifier is also logged: ```js console.log(`Sending briefing to ${target}...`); ``` ### Technical Analysis The implementation writes complete Feishu document tokens to standard output during normal operation and error output when document retrieval fails. On failure, it additionally incorporates the complete token into the briefing card transmitted to the configured recipient. The value of `FEISHU_MASTER_ID`, which may represent an Open ID or chat ID, is also written to logs. These identifiers are not necessarily standalone authentication credentials, but they identify protected Feishu resources and can facilitate access when combined with a valid, compromised, or overly privileged Feishu account. Full identifiers are unnecessary for operational logging and exceed the minimum information required to report progress or failure. The pre-scan finding at line 37 does not directly transmit the token over the network; it exposes it through process output. Network disclosure can occur at line 43 because the failure message becomes part of the briefing sent through the Feishu API. ### Attack Path 1. The Skill scans an event description containing a Feishu document link. 2. The extracted document token is printed to standard output. 3. If document retrieval fails, the token is printed to error output and added to the briefing content. 4. Runtime logs are collect ...[truncated 1084 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Do not log complete document tokens, Open IDs, or chat IDs. - Replace token-bearing progress messages with non-sensitive context, such as document type or sequence number: ```js console.log(` Fetching ${link.type} document`); ``` - Return a generic failure message in the briefing: ```js console.error(` Failed to read ${link.type} document: ${e.message}`); summaries.push('❌ Failed to load an attached document.'); ``` - If correlation is operationally required, use a non-reversible internal request ID. As a weaker alternative, redact all but a short suffix and ensure logs have restricted access and short retention. - Avoid logging `FEISHU_MASTER_ID`; log only whether the destination was resolved as a direct recipient or chat. - Review existing logs and delivered failure cards for exposed identifiers, then remove them where retention systems permit. ]]>
