Back to skill

Security audit

Feishu Automation

Security checks for vulnerabilities and agentic risk

Overview

This Feishu automation skill is broadly purpose-aligned but needs review because it promotes high-impact document/wiki/table automation while some scripts are demo stubs that can report fake success and several workflows are under-scoped.

Review before installing. Treat the scripts as examples until you verify real Feishu API behavior; run dry-runs first, scope Feishu app permissions to the exact workflow, avoid putting real secrets in YAML files, and do not run scheduled/batch write, move, restore, or sharing workflows against production content without explicit approval and backups.

Vulnerability Patterns
  • 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
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (2)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/batch_update.py:61
Finding
Sensitive Feishu Resource Identifiers Exposed in Logs## Vulnerability Details **File Location**: `scripts/batch_update.py:61, 73, 120`; related instances also occur in `scripts/bitable_to_doc.py:23` and `scripts/wiki_backup.py:28, 87, 313` **Vulnerability Type**: Sensitive identifier exposure through logging **Risk Level**: Medium ### Complete Code Snippet ```python def get_documents_in_folder(folder_token): """ Get list of document tokens in a folder. This is a placeholder - in practice, you'd use feishu_drive list action. """ # In real implementation, use: # exec_result = exec('tool call', {'tool': 'feishu_drive', 'action': 'list', 'folder_token': folder_token}) # Parse document tokens from response print(f"[INFO] Would fetch documents in folder: {folder_token}") # Return sample data for demonstration return ["doc_token_1", "doc_token_2"] def update_document(doc_token, content): """ Update a Feishu document with new content. This is a placeholder - in practice, you'd use feishu_doc write action. """ # In real implementation, use: # exec_result = exec('tool call', {'tool': 'feishu_doc', 'action': 'write', 'doc_token': doc_token, 'content': content}) print(f"[INFO] Would update document {doc_token}") print(f"Content preview: {content[:100]}...") return True ``` Additional affected logging statements include: ```python print(f"[INFO] Querying Bitable {table_id} in app {app_token}") print(f"[INFO] Fetching wiki structure for space {space_id}") print(f"[INFO] Reading wiki page {obj_token}") print(f"{prefix}- {node['title']} ({node['node_token']})") ``` ### Technical Analysis User-supplied Feishu app, folder, document, wiki, space, and object identifiers are written directly to standard output without masking. Standard output is commonly captured by CI/CD systems, schedulers, container platforms, monitoring agents, and support bundles. This behavior ...[truncated 1869 chars]
Remediation
## Remediation Suggestions 1. Remove complete resource tokens from normal operational logs. 2. Introduce a centralized masking function that retains only a short suffix, for example: ```python def mask_token(value): if not value: return "<unset>" return f"***{value[-4:]}" if len(value) > 4 else "***" ``` 3. Apply masking consistently to app, table, folder, document, wiki, object, node, and space identifiers. 4. Remove content previews by default. Permit them only through an explicit debug option and display a warning that sensitive content may be logged. 5. Load and enforce the documented `security.mask_tokens_in_logs` configuration rather than leaving it as an unused setting. 6. Configure log access controls, retention limits, and automated redaction in CI and centralized logging systems. 7. Add tests asserting that known token patterns and template secrets never appear in emitted logs.

T09 · Insecure Skill Coding Practices

Warning
Location
assets/config/sample_config.yaml:1
Finding
Sample Configuration Encourages Plaintext Secret Storage## Vulnerability Details **File Location**: `assets/config/sample_config.yaml:1-7, 154-170` **Vulnerability Type**: Insecure secret configuration and storage guidance **Risk Level**: Medium ### Complete Code Snippet ```yaml # Feishu Automation Configuration # Copy this file to config.yaml and customize for your environment feishu: # App credentials (from Feishu developer console) app_id: "cli_xxxxxxxx" app_secret: "xxxxxxxxxxxxxxxxxxxxxxxx" ``` The same file later includes another plaintext secret field and setup instructions: ```yaml webhooks: - name: "project_management" url: "https://api.example.com/webhook/feishu" secret: "xxxxxxxx" # Environment-specific overrides # Use environment variables to override sensitive values # Example: export FEISHU_APP_SECRET="actual_secret" # To use this configuration: # 1. Copy to config.yaml in your working directory # 2. Update with your actual values # 3. Set environment variables for sensitive data # 4. Reference in scripts using config.get('feishu.app_id') # Note: Never commit actual secrets to version control! # Use environment variables or secret management tools. ``` ### Technical Analysis The primary onboarding instruction tells users to copy the sample and customize it, while the schema contains direct plaintext fields for a Feishu app secret and webhook secret. Although the final comments recommend environment variables or a secret manager, they do not clearly prohibit populating those fields, and the project supplies no secret-loading implementation, file-permission enforcement, or repository exclusion rule. This creates a likely insecure default: users may place production credentials into a workspace YAML file. Such files can be unintentionally committed, archived by backup software, included in build artifacts, exposed through support bundles, or read by other local users when permissions are too broad. The val ...[truncated 1395 chars]
Remediation
## Remediation Suggestions 1. Remove plaintext secret value fields from the copy-and-edit workflow. Use environment-variable references or secret-manager identifiers instead: ```yaml feishu: app_id_env: "FEISHU_APP_ID" app_secret_env: "FEISHU_APP_SECRET" ``` 2. Make the instructions explicit that actual secrets must never be entered into YAML files. 3. Provide configuration-loading code that requires secrets from environment variables or an approved secret manager and fails closed when they are absent. 4. Add `config.yaml`, `.env`, local override files, and generated credential files to `.gitignore`. 5. Validate local configuration file permissions and reject files readable by unauthorized users where the platform supports that check. 6. Add pre-commit and CI secret scanning. 7. Document credential rotation and incident-response steps for accidentally exposed Feishu and webhook secrets. 8. Split permissions by workflow rather than granting document, wiki, Bitable, and Drive access to every deployment.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (15)

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding
The description overstates the skill's scope. The actual code is narrowly focused on migrating documents between folders or wiki spaces, backing up documents to markdown, and writing a local migration report. It does not implement advanced automation workflows across the broader Feishu suite, does not sync data across apps, and does not interact with bitables or cloud storage. While some declared triggers like knowledge base backup and data migration partially align, the primary declared purpose is materially broader than the actual behavior, so this is a mismatch.

Ae1

High
Category
analysis-evasion
Content
- `best_practices.md` - Performance and reliability tips
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Credential Access

High
Category
Privilege Escalation
Content
### Access Control
- **Least privilege**: Grant minimum necessary permissions
- **Token management**: Rotate access tokens regularly
- **Audit logging**: Log all automation activities

```python
Confidence
70% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
| `99991672` | Rate limit exceeded | Implement exponential backoff retry |
| `99991673` | Quota exceeded | Upgrade plan or reduce frequency |
| `99991679` | Internal server error | Retry with backoff; contact Feishu support if persistent |
| `99991700` | Invalid access token | Refresh tenant_access_token or user_access_token |

### OpenClaw Tool Errors
Confidence
70% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Lp3

Medium
Category
MCP Least Privilege
Confidence
87% confidence
Finding
The skill advertises operational scripts that read and write local files, but it does not declare any explicit tool scope or permissions boundary. In an agent environment, missing scope declarations can cause overbroad or ambiguous access, making it easier for batch workflows to modify local artifacts or backups without clear user consent or enforcement.

Missing User Warnings

Medium
Confidence
90% confidence
Finding
The skill promotes batch updates, migrations, and backups across documents and knowledge bases without prominently warning that these operations may overwrite content, duplicate data, or cause large-scale unintended changes. In automation contexts, omission of safety warnings increases the chance of destructive misuse, especially when users may run provided scripts directly on production content.

External Transmission

Medium
Category
Data Exfiltration
Content
webhooks:
    - name: "project_management"
      url: "https://api.example.com/webhook/feishu"
      secret: "xxxxxxxx"

# Environment-specific overrides
Confidence
50% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The example configuration embeds an `app_secret` directly in a YAML file, which normalizes storing credentials in plaintext within source-controlled config. In an automation skill for Feishu, users may copy this pattern into real deployments, leading to secret leakage via repositories, logs, backups, or shared documentation.

Missing User Warnings

Medium
Confidence
90% confidence
Finding
The guidance includes write and restore operations against user documents but does not explicitly require user confirmation, dry-run behavior, or warnings about overwriting existing content. In an automation skill for Feishu document management, this omission can lead to unintended modification or rollback of user data if the workflow is invoked on the wrong document or with stale backup content.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
The recovery section recommends actions such as updating with a known-good version, creating a new document and migrating, or restoring from version history without warning that these may overwrite current state or cause irreversible changes. In a batch automation context, such recovery logic increases the risk of accidental data loss or propagation of incorrect content across documents.

Missing User Warnings

Medium
Confidence
89% confidence
Finding
This markdown file includes concrete patterns for creating documents, writing updated content, creating records, creating folders, and moving files in Feishu. Under SQP-2 for markdown files, descriptions that could affect user data or system integrity should warn users about those effects, but this file provides no caution that these actions change remote content.

Intent-Code Divergence

Medium
Confidence
97% confidence
Finding
The function advertises querying a live Bitable using provided tokens and filters, but it silently returns hardcoded sample records instead. In an automation skill, this can mislead users into believing reports were generated from real workspace data, causing integrity failures, bad decisions, and accidental disclosure if users trust the output as authoritative.

Intent-Code Divergence

Medium
Confidence
98% confidence
Finding
The document creation function claims success, returns a fake document token, and prints a plausible document URL without creating anything. This is dangerous because downstream workflows or operators may assume documents were stored successfully, leading to data loss, failed backups/exports, and false audit trails in a productivity automation context.

Vague Triggers

Low
Confidence
78% confidence
Finding
This YAML defines several predefined workflows with schedules and enabled flags, but it does not document clear exclusion conditions or scope boundaries for when those workflows should or should not run beyond the cron expressions. For manifest-style configuration files, missing specificity around trigger scope can increase the risk of unintended invocation or misunderstanding of activation behavior.

Missing User Warnings

Low
Confidence
88% confidence
Finding
The workflow explicitly automates creation or updating of Feishu documents and then shares the generated report via wiki or chat, but it does not include a user-facing warning, approval step, or confirmation that the published content may contain sensitive internal data from Bitable. In an automation skill focused on cross-app Feishu data movement, silent publication increases the risk of unintended disclosure through overbroad sharing or accidental inclusion of sensitive fields.

Static analysis

No suspicious patterns detected.