Back to skill

Security audit

飞书文档API技能

Security checks for vulnerabilities and agentic risk

Overview

This Feishu document skill does what it advertises, but it can delete or overwrite shared documents and expose app secrets through CLI arguments without strong safeguards.

Install only if you are comfortable giving this skill Feishu app credentials with read/write access to documents. Use a least-privileged Feishu app, avoid passing secrets with --app-secret, prefer protected environment configuration, test in a non-production folder first, and manually confirm document IDs before delete or full-replace operations.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
Findings (2)

T09 · Insecure Skill Coding Practices

Warning
Location
bin/cli.js:40
Finding
Feishu App Secret Exposed Through Command-Line Arguments<![CDATA[ ## Vulnerability Details **File Location**: `bin/cli.js:40-45` **Additional Locations**: `bin/cli.js:80-85`, `138-143`, `178-183`, `205-210`, `247-252`, `289-294`, `316-321`, `356-361`, `404-409` **Vulnerability Type**: Sensitive credential exposure through process arguments **Risk Level**: Medium ### Vulnerable Code ```javascript .option('--app-id <id>', '飞书应用ID(覆盖环境变量)') .option('--app-secret <secret>', '飞书应用密钥(覆盖环境变量)') .action(async (options) => { try { if (options.appId) process.env.FEISHU_APP_ID = options.appId; if (options.appSecret) process.env.FEISHU_APP_SECRET = options.appSecret; ``` Equivalent `--app-secret` handling is repeated across every major CLI command. ### Technical Analysis The CLI permits the Feishu App Secret to be supplied directly as a command-line argument. Command-line arguments are not an appropriate secret transport mechanism because they can be exposed through: - Shell history files. - Process listings and operating-system process inspection interfaces. - Terminal session logging. - Job schedulers, command auditing, and monitoring platforms. - Diagnostic reports that capture process command lines. Copying the secret from `options.appSecret` into `process.env.FEISHU_APP_SECRET` does not remove it from `process.argv`, the parent shell's history, or external process telemetry. The secret grants application-level authentication through Feishu's tenant access-token endpoint. Its effective authority is determined by the permissions granted to the associated Feishu application. ### Attack Path 1. A user invokes a command such as: ```bash node bin/cli.js get \ --document-id dcnxxxxxx \ --app-id cli_xxxxxx \ --app-secret real_secret_value ``` 2. The complete command is recorded in shell history or remains visible in process metadata while the command runs. 3. A local user, process-monitoring agent, log collector, or party with access to the user's shell history obtains the secret. 4 ...[truncated 834 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Remove the `--app-secret` option from all CLI commands. 2. Accept secrets only through a protected environment variable or an external secret manager. 3. If interactive entry is required, use a hidden prompt that disables terminal echo. 4. For automation, support reading the secret from a protected file descriptor or a file with restrictive permissions instead of from the command line. 5. Avoid copying secrets into additional mutable locations unless required. 6. Clear in-memory secret references when feasible after client initialization. 7. Update documentation to warn users never to place credentials in command-line arguments. 8. Rotate any App Secret that has previously been supplied through this option. 9. Apply least-privilege Feishu permissions so compromise of the application credential has a restricted impact. ]]>

T08 · Insecure Dependencies

Note
Location
package-lock.json:23
Finding
Dependency Lockfile Uses a Third-Party npm Registry Mirror<![CDATA[ ## Vulnerability Details **File Location**: `package-lock.json:23-34` **Additional Locations**: Other `resolved` fields throughout `package-lock.json` **Vulnerability Type**: Third-party dependency source and supply-chain trust exposure **Risk Level**: Low ### Vulnerable Code ```json "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmmirror.com/asynckit/-/asynckit-0.4.0.tgz", "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", "license": "MIT" }, "node_modules/axios": { "version": "1.13.5", "resolved": "https://registry.npmmirror.com/axios/-/axios-1.13.5.tgz", "integrity": "sha512-cz4ur7Vb0xS4/KUN0tPWe44eqxrIu31me+fbang3ijiNscE129POzipJJA6zniq2C/Z6sJCjMimjS8Lc/GAs8Q==", ``` The same mirror is used for the other locked dependencies. ### Technical Analysis The lockfile directs npm to retrieve dependency archives from `registry.npmmirror.com` rather than the official npm registry. This introduces an additional party into the dependency trust chain. The included SHA-512 integrity values materially reduce the likelihood that a mirror can transparently replace an archive without detection. However, they do not fully remove the risk because: - Installation availability depends on the third-party mirror. - A malicious or incorrectly regenerated lockfile could contain both a modified archive URL and its matching malicious integrity hash. - Future dependency updates may trust package metadata supplied by the mirror. - Reviewers must validate package provenance across an additional infrastructure provider. No evidence was found that the currently locked packages are malicious. This finding concerns avoidable supply-chain exposure rather than confirmed malicious package contents. ### Attack Path 1. A user follows the setup instructions and runs `npm install` or `npm ci`. 2. npm reads the `resolved` URLs in `package-lock.json`. 3. Package archives ar ...[truncated 1114 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Regenerate `package-lock.json` using the official npm registry: ```bash npm config set registry https://registry.npmjs.org/ rm -rf node_modules package-lock.json npm install ``` 2. Review the regenerated lockfile and confirm all `resolved` package URLs use the approved registry. 3. Continue retaining cryptographic integrity hashes. 4. Use `npm ci` in deployment and CI environments to prevent implicit lockfile changes. 5. Pin exact dependency versions where operationally practical. 6. Enable automated vulnerability and dependency provenance checks. 7. Require code review for all lockfile modifications. 8. Consider disabling lifecycle scripts during installation when they are not required: ```bash npm ci --ignore-scripts ``` 9. Maintain an organizational allowlist of approved package registries and enforce it through `.npmrc` or CI policy. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Rogue AgentSelf-Modification, Session Persistence
Findings (42)

Credential Access

High
Category
Privilege Escalation
Content
### 方法A:使用.env文件(推荐)
```bash
cd skills/feishu-docs
cp .env.example .env
# 编辑.env文件,填入你的凭证
```
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Tp4

High
Category
MCP Tool Poisoning
Confidence
90% confidence
Finding
从给出的代码块看,实际行为集中在“测试飞书文档转换接口”。脚本读取环境变量中的 appId/appSecret,实例化 FeishuDocsAPI,并调用 convertContent('markdown', ...) 与 convertContent('html', ...) 来验证转换结果,同时测试非法类型、空内容的报错处理,以及检查表格块中 merge_info 字段。代码没有展示任何创建文档、读取文档、更新文档、删除文档或权限管理相关操作。因此,虽然声明中的“支持 Markdown/HTML 内容转换”与代码行为一致,但整体描述将技能定义为完整的飞书文档 CRUD + 权限管理 API,与当前代码块实际体现的能力不符,属于描述与行为不一致。

Ae1

High
Category
analysis-evasion
Content
node bin/cli.js --help
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
node bin/cli.js --help
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
node bin/cli.js --help
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
node bin/cli.js --help
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
node bin/cli.js --help
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
node bin/cli.js --help
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
node bin/cli.js --help
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Tool Parameter Abuse

High
Category
Tool Misuse
Content
GET    /docx/v1/documents/{document_id}/raw_content          # 获取文档纯文本
GET    /docx/v1/documents/{document_id}/blocks               # 获取文档块列表
PATCH  /docx/v1/documents/{document_id}/blocks/{block_id}    # 更新块
DELETE /docx/v1/documents/{document_id}/blocks/{block_id}    # 删除块
POST   /docx/v1/documents/{document_id}/blocks/{block_id}/children  # 插入子块
POST   /docx/v1/documents/blocks/convert                     # Markdown/HTML→块
DELETE /drive/v1/files/{file_token}?type=docx                # 删除文档
Confidence
80% confidence
Finding
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Tool Parameter Abuse

High
Category
Tool Misuse
Content
DELETE /docx/v1/documents/{document_id}/blocks/{block_id}    # 删除块
POST   /docx/v1/documents/{document_id}/blocks/{block_id}/children  # 插入子块
POST   /docx/v1/documents/blocks/convert                     # Markdown/HTML→块
DELETE /drive/v1/files/{file_token}?type=docx                # 删除文档
GET    /drive/v1/files?folder_token=xxx                      # 列出文件夹文件
POST   /drive/v1/permissions/{token}/members?type=docx       # 添加权限成员
GET    /drive/v1/permissions/{token}/members?type=docx       # 获取权限成员
Confidence
81% confidence
Finding
Document-level deletion is a high-risk destructive capability, and the skill exposes it without describing guardrails such as confirmation, token validation, or rollback/version recovery expectations. In an agent-driven workflow, a mistaken or manipulated file_token could cause permanent deletion of the wrong document, making this materially more dangerous than ordinary read/write operations.

Tool Parameter Abuse

High
Category
Tool Misuse
Content
### 订单管理
- GET /api/orders
- POST /api/orders
- DELETE /api/orders/{id}

## 代码示例
Confidence
80% confidence
Finding
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Known Vulnerable Dependency: axios==1.13.5 — 16 advisory(ies): CVE-2026-44494 (axios Vulnerable to Full Man-in-the-Middle via Prototype Pollution Gadget in `co); CVE-2026-44495 (axios Vulnerable to Credential Theft and Response Hijacking via Prototype Pollut); CVE-2025-62718 (Axios has a NO_PROXY Hostname Normalization Bypass that Leads to SSRF) +13 more

High
Category
Supply Chain
Confidence
95% confidence
Finding
The lockfile pins axios to 1.13.5, and the static analysis indicates multiple published advisories affecting that version, including SSRF/proxy bypass and prototype-pollution-related attack paths. In a skill that performs remote document API operations, an HTTP client library is security-sensitive, so exploitable flaws could affect outbound request routing, credential handling, or response trust.

Known Vulnerable Dependency: form-data==4.0.5 — 1 advisory(ies): CVE-2026-12143 (form-data: CRLF injection in form-data via unescaped multipart field names and f)

High
Category
Supply Chain
Confidence
89% confidence
Finding
form-data 4.0.5 is flagged for CRLF injection via unescaped multipart field names and filenames. If this skill ever builds multipart requests using attacker-controlled input, an attacker may be able to manipulate part headers or request structure, which can enable request smuggling-like behavior or downstream parsing abuses.

Known Vulnerable Dependency: axios==1.13.5 — 16 advisory(ies): CVE-2026-44494 (axios Vulnerable to Full Man-in-the-Middle via Prototype Pollution Gadget in `co); CVE-2026-44495 (axios Vulnerable to Credential Theft and Response Hijacking via Prototype Pollut); CVE-2025-62718 (Axios has a NO_PROXY Hostname Normalization Bypass that Leads to SSRF) +13 more

High
Category
Supply Chain
Confidence
96% confidence
Finding
This package allows installation of axios versions matched by ^1.6.0, and the static finding indicates the resolved version is axios 1.13.5 with multiple known advisories, including SSRF- and request-handling-related issues. In a document API skill that performs outbound HTTP requests, vulnerable axios behavior can materially increase risk because attacker-controlled URLs, proxy settings, headers, or polluted objects may influence request routing, credential handling, or response processing.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
This markdown file includes a `delete` command example that removes a document, but the surrounding documentation provides no warning that the action may be destructive or irreversible. Under the markdown criteria for SQP-2, user-facing skill documentation should disclose behaviors that can affect user data or system integrity.

Session Persistence

Medium
Category
Rogue Agent
Content
### 方法B:手动安装
```bash
# 创建技能目录
mkdir -p /Users/steven/openclaw/skills/feishu-docs
cd /Users/steven/openclaw/skills/feishu-docs

# 复制所有文件到目录
Confidence
60% confidence
Finding
Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Session Persistence

Medium
Category
Rogue Agent
Content
### 方法B:手动安装
```bash
# 创建技能目录
mkdir -p /Users/steven/openclaw/skills/feishu-docs
cd /Users/steven/openclaw/skills/feishu-docs

# 复制所有文件到目录
Confidence
60% confidence
Finding
Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Lp3

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding
The skill declares environment-variable requirements for application credentials but does not declare any explicit tool scope or allowed-tools boundary. That makes the skill's effective privileges under-specified, which is dangerous for an agent skill because secret access and external API use can occur without a clear least-privilege contract.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The skill prominently advertises destructive operations such as document deletion and full-content replacement without an explicit warning about irreversibility or user confirmation guidance. In an agent context, that increases the chance of accidental destructive actions against production documents when a user intent is ambiguous or parameters are mistaken.

Missing User Warnings

Medium
Confidence
96% confidence
Finding
This code file includes a destructive operation via the `delete` command, culminating in `api.deleteDocument(options.documentId)`. Although it logs that deletion is in progress, there is no confirmation prompt or stronger user-facing warning that the action is irreversible, which increases the risk of accidental data loss.

Description-Behavior Mismatch

Medium
Confidence
92% confidence
Finding
The manifest describes a skill for creating, reading, updating, deleting Feishu documents, converting Markdown/HTML content, and managing document permissions. This file additionally implements workspace discovery features: searching documents globally and listing arbitrary folder contents, which are broader content-enumeration operations not described as part of the skill’s stated purpose.

Missing User Warnings

Medium
Confidence
92% confidence
Finding
The examples instruct users to export and use live Feishu app credentials directly in the shell, but provide no guidance on secret handling, shell history exposure, log leakage, or avoiding committed/shared files. In an agent or shared workstation context, this increases the chance that sensitive credentials are exposed and then used to access or modify Feishu workspace data.

Missing User Warnings

Medium
Confidence
89% confidence
Finding
The documented commands create documents and write content to a remote Feishu workspace, but the examples do not clearly warn users that running them has external side effects. In agent-assisted or automated environments, this can lead to unintended document creation, data propagation to third-party systems, or modification of production/shared workspaces.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
replaceDocumentContent irreversibly deletes all existing child blocks before inserting new content, with no safeguard in the API contract such as confirmation, dry-run support, or expected-state checks. In an agent setting, ambiguous prompts, misuse, or prompt injection into higher-level orchestration could cause destructive overwrite of documents the token can access.

Static analysis

No suspicious patterns detected.