T09 · Insecure Skill Coding Practices
- Location
SKILL.md:226- Finding
Hard-Coded Feishu Application Credentials Expose Tenant Access
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill is meant to query Feishu wiki content, but it exposes Feishu app credentials and includes under-scoped outbound messaging and broader spreadsheet permission guidance.
Review before installing. Do not use this package as-is with real Feishu resources unless the exposed app secret has been revoked and replaced, the packaged config has been cleared, spreadsheet permissions are reduced or explicitly justified, and any image upload or message sending requires clear user approval and verified recipients.
SKILL.md:226Hard-Coded Feishu Application Credentials Expose Tenant Access
SKILL.md:263Write-Capable Spreadsheet Permission Required for a Read-Only Workflow
The skill is described as a knowledge-base query/read capability, but the documentation adds active message-sending behavior, including uploading and sending images to users via Feishu IM. This materially expands the skill from read-only retrieval into outbound communication and data exfiltration pathways, increasing abuse potential if invoked on sensitive document content.
The documentation embeds a Feishu app_id and app_secret directly in the skill, allowing anyone with access to the file to obtain tenant access tokens. Hardcoded credentials can be reused outside the stated query workflow and may grant broad API access depending on the app's permissions, making this a direct credential exposure issue.
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
| 问题 | 原因 | 解决方案 |
|------|------|----------|
| `Search is not available` | 知识库搜索未开放 | 改用 `nodes` 遍历 |
| `Missing access token` | token 过期 | 重新获取 tenant_access_token |
| `receive_id_type is required` | 发送消息缺参数 | URL 加 `?receive_id_type=open_id` |
| `WrongBaseToken` | token 格式错误 | 确认使用的是正确的 token 类型 |
| `NOTEXIST` | 文档不存在或无权访问 | 检查 token 是否正确 |
The trigger description includes broad everyday phrases such as querying schedules or canteen menus, which can cause the skill to activate unexpectedly in contexts the user did not intend. Overbroad triggering is risky here because the skill accesses configured knowledge bases and may expose private organizational content when a different tool or a normal chat response was expected.
The skill stores knowledge-base configuration in a local file under the user's home directory, but the documentation does not clearly warn users that this information will be persisted. Persisted URLs, node tokens, and space identifiers may reveal internal resource structure and remain accessible to other local processes or future sessions.
The documentation instructs the operator to download document images and transmit them over network APIs without privacy warnings, data handling constraints, or explicit consent checks. In the context of an enterprise knowledge-base reader, this creates a clear path for sensitive document media to be exported and redistributed outside the original document context.
This finding is the same external token acquisition endpoint highlighted separately by the scanner. It is dangerous because it uses embedded application credentials to establish authenticated external access that can then be leveraged for additional API operations.
import json
# 1. 获取 tenant_access_token
token_resp = requests.post(
"https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal",
json={
"app_id": "cli_a938e5e808b8dbca",
This finding is the same external token acquisition endpoint highlighted separately by the scanner. It is dangerous because it uses embedded application credentials to establish authenticated external access that can then be leveraged for additional API operations.
import json
# 1. 获取 tenant_access_token
token_resp = requests.post(
"https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal",
json={
"app_id": "cli_a938e5e808b8dbca",
This request uploads image content to an external Feishu API, which constitutes outbound transfer of document-derived data. In a knowledge-base query skill, such transfer increases the risk of leaking sensitive embedded media, especially if users are not clearly informed or recipient validation is weak.
# 2. 上传图片
with open('/tmp/图片.png', 'rb') as f:
img_resp = requests.post(
"https://open.feishu.cn/open-apis/im/v1/images",
headers={"Authorization": f"Bearer {token}"},
files={"image": ("图片.png", f.read(), "image/png")},
This finding is the same outbound message-sending operation flagged at a more specific match granularity. It remains a true issue because it provides a ready-made channel to transmit internal image content to user accounts, which exceeds the query-only role of the skill.
image_key = img_resp.json()["data"]["image_key"]
# 3. 发送图片消息(需提供接收者的 open_id)
msg_resp = requests.post(
"https://open.feishu.cn/open-apis/im/v1/messages?receive_id_type=open_id",
headers={"Authorization": f"Bearer {token}", "Content-Type": "application/json"},
json={
This finding is the same outbound message-sending operation flagged at a more specific match granularity. It remains a true issue because it provides a ready-made channel to transmit internal image content to user accounts, which exceeds the query-only role of the skill.
image_key = img_resp.json()["data"]["image_key"]
# 3. 发送图片消息(需提供接收者的 open_id)
msg_resp = requests.post(
"https://open.feishu.cn/open-apis/im/v1/messages?receive_id_type=open_id",
headers={"Authorization": f"Bearer {token}", "Content-Type": "application/json"},
json={
A document-query skill should not require broader-than-read permissions unless there is a clearly justified write use case. Requiring the non-readonly sheets:spreadsheet permission increases blast radius if the credential or token is abused, enabling modification of spreadsheet content rather than simple retrieval.
This duplicate match points to the spreadsheet example's token retrieval endpoint. The concern is valid because credential-backed external authentication is embedded directly in documentation for a read-oriented skill, unnecessarily widening exposure if copied or reused.
import json
# 获取 token
token_resp = requests.post(
"https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal",
json={
"app_id": "cli_a938e5e808b8dbca",
This duplicate match points to the spreadsheet example's token retrieval endpoint. The concern is valid because credential-backed external authentication is embedded directly in documentation for a read-oriented skill, unnecessarily widening exposure if copied or reused.
import json
# 获取 token
token_resp = requests.post(
"https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal",
json={
"app_id": "cli_a938e5e808b8dbca",
文档中的首次配置提示、命令格式和输出格式均固定为中文表达,如“添加知识库”“查看知识库”以及中文来源标注。文件未说明该技能仅面向中文环境,也未给出用户语言选择,存在未获用户同意即固定语言/locale 的问题。
The natural-language value "杨毛毛知识库" suggests the skill is oriented to a specific language/locale, but this file provides no indication that the language restriction is optional, user-selected, or justified as region-specific. Under the policy rules, hard-coded locale-specific language can be a violation when no opt-in or documented scope is present.