T09 · Insecure Skill Coding Practices
- Location
scripts/search-user.js:8- Finding
Hardcoded Feishu Application Credentials
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This Feishu messaging skill is mostly aligned with messaging workflows, but it ships apparent app secrets and scripts that can send messages and expose employee contact data.
Review before installing or running. Do not use the bundled Feishu credentials; rotate them if they belong to you, replace them with securely supplied environment credentials, and limit the Feishu app scopes. Treat message text and uploaded files as data sent to Feishu, and avoid running the user-search script unless you are authorized to view and log employee contact details.
scripts/search-user.js:8Hardcoded Feishu Application Credentials
scripts/test-send-message.js:111Application Secret and Access Token Fragments Disclosed in Logs
scripts/search-user.js:74Excessive Feishu Directory Data Retrieval and PII Logging
The skill is presented as a narrow workflow, but the examples include authenticated API usage and direct messaging to a specific user ID, which are materially different operational behaviors from the described group/member lookup and document flow. In a security review context, this kind of under-disclosure is risky because it hides the real trust boundary: the skill handles credentials and can send data to external recipients.
The skill is presented as a narrow workflow, but the examples include authenticated API usage and direct messaging to a specific user ID, which are materially different operational behaviors from the described group/member lookup and document flow. In a security review context, this kind of under-disclosure is risky because it hides the real trust boundary: the skill handles credentials and can send data to external recipients.
The skill is presented as a narrow workflow, but the examples include authenticated API usage and direct messaging to a specific user ID, which are materially different operational behaviors from the described group/member lookup and document flow. In a security review context, this kind of under-disclosure is risky because it hides the real trust boundary: the skill handles credentials and can send data to external recipients.
The script embeds fallback Feishu app credentials directly in source code, meaning anyone with code access can use them to obtain tenant access tokens. Hardcoded secrets are easily leaked via repositories, logs, copies, or package distribution and can enable unauthorized API access to organizational data.
The script hardcodes a Feishu APP_ID and APP_SECRET and immediately uses them to obtain a tenant access token for outbound API calls. Embedding live application credentials in a test script is dangerous because anyone with file access can reuse them to authenticate as the application, send messages, and potentially access other granted Feishu APIs; in a messaging skill context, this capability is directly operational rather than incidental, which increases risk.
The application secret is stored in plaintext and used to authenticate requests without any protection boundary, prompting direct transmission to the Feishu token endpoint whenever the script runs. This creates a straightforward secret-exposure path: anyone who copies the repository or logs can recover the secret and mint valid access tokens, enabling impersonation of the app and abuse of its permissions.
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
try {
// 获取 token
console.log('📝 获取 access token...');
const token = await getTenantAccessToken();
console.log(`✅ Token 获取成功\n`);
The script hardcodes fallback Feishu APP_ID and APP_SECRET and will automatically use them when environment variables are absent. Embedding live-looking outbound authentication credentials in a distributed script can expose tenant access, enable unauthorized API use, and cause accidental cross-tenant messaging or abuse if the repository is shared.
The skill includes code that consumes sensitive application credentials (APP_ID/APP_SECRET) and makes external API calls, but the manifest does not declare any tool scope or permissions boundary. That omission weakens reviewability and can cause the skill to be invoked without a clear contract about credential use or external network behavior.
The manifest frames the skill as messaging/document workflow, but the body also documents image and file upload operations. This expands the data-exfiltration surface beyond plain text messaging, because arbitrary user-supplied files or media may be transmitted to Feishu without that broader scope being obvious from the manifest.
The trigger text lists scenarios such as '发送消息失败需要重新尝试' without defining exact invocation phrases or boundaries for when the skill should activate. This broad troubleshooting-oriented wording could match many common conversations about retrying failed messages, increasing the risk of unintended invocation.
The skill encourages sending messages and uploading files/images to an external Feishu service without clearly warning that user content will leave the local environment. This creates a privacy and compliance risk because users or operators may provide sensitive text or attachments without informed consent or policy checks.
The script does more than support message sending: it searches the organization directory and then retrieves full user profiles for each match. In the stated skill context, this expands access to employee data beyond what is necessary and increases privacy and insider-enumeration risk if the tool is misused or run broadly.
The script sends the searched name to Feishu's user search API and then retrieves detailed user profile data including email, mobile number, and employee number. Although there are progress logs, they do not warn that personally identifiable information will be queried from and displayed via a remote service, which is a missing user warning for privacy-impacting network operations.
The code prints employee number, email, mobile number, and department IDs to the console, which are sensitive personnel attributes not needed just to send a message. Exposing this data in terminal output can leak PII through shell history, logs, screenshots, CI output, or to operators who only needed a messaging identifier.
User-facing strings are written in Chinese throughout the script, and date formatting is explicitly forced to 'zh-CN'. This is a natural-language policy concern because it imposes a specific language and locale without user opt-in or documented justification.
The manifest description explicitly claims '文档创建工作流', suggesting document creation is part of the skill's intended behavior. In the actual documented code, the available examples cover chat search, message sending, image upload, file upload, and chat member queries, but no document creation APIs or flows are present.
The script's comments and all console output are written in Chinese, and there is no option for users to select another language or locale. This constitutes a natural-language policy concern because the skill enforces a specific language without documented opt-in or a region-specific justification.
The manifest describes this skill as a Feishu message sending and document creation workflow, with trigger scenarios around finding group members/group IDs and retrying failed sends. This file additionally implements a current-user information API call, which is a separate identity/profile lookup capability and is not justified by the stated purpose of sending messages in this script.
The script explicitly formats timestamps with toLocaleString('zh-CN'), which imposes a specific locale regardless of the user's preferences or environment. This is a natural-language/locale policy issue because the file does not offer any choice or document why a Chinese locale is required.
No suspicious patterns detected.