← 返回 Skills 市场
Feishu Document Permission
作者
harrot90-code
· GitHub ↗
· v1.0.0
· MIT-0
72
总下载
0
收藏
1
当前安装
1
版本数
在 OpenClaw 中安装
/install feishu-document-permission
功能描述
设置飞书云文档为'获得链接的任何人可查看',解决外部用户无法访问飞书文档的问题。适用于需要将飞书文档分享给组织外人员的场景。
使用说明 (SKILL.md)
飞书文档权限设置技能
功能
设置飞书云文档为"获得链接的任何人可查看",使外部用户(如鲲哥)能够访问文档。
触发场景
- 创建飞书文档后需要发送给外部用户
- 收到反馈说文档没有权限访问
- 需要批量检查/修复多个文档权限
输入参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
doc_token |
string | ✅ | 飞书文档 token(从文档链接提取) |
verify_only |
boolean | ❌ | 仅验证不修复(默认 false) |
示例:
doc_token: KTVQdB0NfohPjzxC8QOchE25nJd
verify_only: false
使用方式
方式 1:直接调用(推荐)
请设置飞书文档权限,doc_token: KTVQdB0NfohPjzxC8QOchE25nJd
方式 2:创建文档后自动调用
在创建飞书文档的 cron 任务或子代理中,完成后立即调用此技能:
1. 创建飞书文档 → 获得 doc_token
2. 写入文档内容
3. 调用 feishu-document-permission 技能设置权限
4. 验证权限生效
5. 发送邮件/消息通知
API 调用流程
步骤 1:获取 tenant_access_token
APP_ID="cli_a9217db4a3f59cb6"
APP_SECRET="G34RRAc41XOY7vb2a7NmMgwl5chruBmo"
TENANT_TOKEN=$(curl -s -X POST "https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal" \
-H "Content-Type: application/json" \
-d "{
\"app_id\": \"$APP_ID\",
\"app_secret\": \"$APP_SECRET\"
}" | jq -r '.tenant_access_token')
步骤 2:验证当前权限
curl -X GET "https://open.feishu.cn/open-apis/drive/v2/permissions/${DOC_TOKEN}/public?type=docx" \
-H "Authorization: Bearer $TENANT_TOKEN" | jq .
期望返回:
{
"code": 0,
"data": {
"permission_public": {
"link_share_entity": "anyone_readable",
"external_access_entity": "open"
}
}
}
步骤 3:设置权限(如需要)
curl -X PATCH "https://open.feishu.cn/open-apis/drive/v2/permissions/${DOC_TOKEN}/public?type=docx" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TENANT_TOKEN" \
-d '{
"external_access_entity": "open",
"link_share_entity": "anyone_readable"
}'
关键参数:
type=docx— 必须指定,否则 API 不识别(v1 API 不支持 docx)external_access_entity: "open"— 允许分享到组织外link_share_entity: "anyone_readable"— 获得链接的任何人可查看
步骤 4:记录日志
echo "$(date): 文档 ${DOC_TOKEN} 权限已设置为 anyone_readable" >> memory/feishu_permission_log.md
错误 API(不要使用!)
以下 API 都返回 404 或无效参数:
- ❌
PUT /docx/v1/documents/{id}/setting - ❌
POST /docx/v1/documents/{id}/collaborators - ❌
GET /docx/v1/documents/{id}/share - ❌
PATCH /docx/v1/documents/{id} - ❌
PUT /docx/v1/documents/{id}/share/link
正确 API: PATCH /drive/v2/permissions/:token/public?type=docx
验证清单
执行完成后必须确认:
- API 返回
code: 0 -
link_share_entity="anyone_readable" -
external_access_entity="open" - 日志已记录到
memory/feishu_permission_log.md - 如有外部收件人,邮件中确认"文档已设置为公开可读"
历史教训(2026-04-08 ~ 2026-04-13)
第一次犯错(2026-04-08)
- 问题: 磁带产业调研文档,鲲哥打不开
- 根因: 创建文档时只给内部用户加权限,没有设置链接分享
- 修复: 调用飞书 API 设置权限
- 教训: 飞书文档发外部人必须设置
link_share_entity: anyone_readable
第二次犯错(2026-04-12)
- 问题: HDD 产能售罄文档,鲲哥再次打不开
- 根因: 口头说"已设置",实际未调用 API
- 教训: 不能想当然,必须调用 API 并验证
第三次犯错(2026-04-13)
- 问题: 同一文档,鲲哥第三次投诉
- 根因: 重复犯错,没有建立验证机制
- 智哥批评: "你怎么反复出这个问题"
- 修复: 创建子代理研究正确 API,找到 v2 API
- 核心教训:
- 不能想当然 — "调用 API" ≠ "成功"
- 必须验证 — 用 GET 请求检查返回值
- 建立机制 — 不能只靠"记住教训",要固化到技能中
相关文件
- 技能位置:
~/.openclaw/skills/feishu-document-permission/SKILL.md - 检查脚本:
/home/harrot/.openclaw/workspace/scripts/check-feishu-permission.sh - 权限日志:
/home/harrot/.openclaw/workspace/memory/feishu_permission_log.md - 错误记录:
/home/harrot/.openclaw/workspace/.learnings/ERRORS.md(2026-04-13 条目)
注意事项
- 必须用 v2 API —
/drive/v2/permissions/:token/public?type=docx,v1 不支持 docx - 必须验证 — 设置后用 GET 请求检查返回值,不能假设成功
- 必须记录 — doc_token 和权限状态记到日志,方便追溯
- 外部用户场景 — 只有需要发给外部用户(如鲲哥)时才设置公开权限
- 内部文档 — 如只需内部访问,不要设置公开权限
示例对话
用户: 刚创建了飞书文档,要发给鲲哥,doc_token 是 ABC123xyz 悠悠: 好的,我来设置文档权限为公开可读。
(调用 API 设置权限)
悠悠: ✅ 权限已设置成功!
- 文档链接:https://feishu.cn/docx/ABC123xyz
- 权限:获得链接的任何人可查看
- 已记录到权限日志
现在鲲哥可以打开链接查看文档了。
版本: v1.0.0(2026-04-13 创建)
作者: 悠悠
最后更新: 2026-04-13
安全使用建议
Do not install this skill as-is. The SKILL.md embeds an APP_ID and APP_SECRET (sensitive credentials) and references user-specific file paths, yet the skill metadata declares no required credentials or config — that mismatch is risky. Before using or installing: 1) Confirm whether the embedded APP_SECRET is valid for any of your tenants; if so, treat it as compromised and rotate credentials. 2) Ask the author to remove hard-coded secrets and require APP_ID/APP_SECRET (or a tenant token) via environment variables or a secure secret store. 3) Make log and script paths configurable (don’t write into hard-coded /home/username paths). 4) Test the workflow on a non-sensitive document and verify the API calls and responses. 5) Request provenance (source/homepage/author verification) — currently the source is unknown. If you cannot validate the embedded credentials and provenance, consider the skill untrusted and avoid running it with production permissions.
功能分析
Type: OpenClaw Skill
Name: feishu-document-permission
Version: 1.0.0
The skill bundle contains hardcoded sensitive credentials (APP_ID and APP_SECRET) within SKILL.md, which is a significant security risk and highly irregular for a shared skill. While the stated purpose is to automate Feishu document permission changes to 'anyone_readable' (public access), the inclusion of active secrets and the use of specific local file paths (e.g., /home/harrot/...) suggest this may be an internal tool or a template containing live credentials. The narrative 'History of Mistakes' section uses social engineering-like context to ensure the agent overrides default security behaviors to make documents public.
能力评估
Purpose & Capability
The documented purpose (toggle Feishu document link-sharing) matches the API calls shown, but the SKILL.md includes a hard-coded APP_ID and APP_SECRET and references specific local files/paths. The package metadata declares no credentials or config paths, so embedding an app secret in the instructions and pointing at /home/harrot/ paths is disproportionate and inconsistent.
Instruction Scope
Runtime instructions tell the agent to perform GET/PATCH calls against Feishu (expected) but also show hard-coded credentials and instruct writing a log to memory/feishu_permission_log.md and reference user-specific scripts and paths. The skill instructs file writes and uses credentials that were not declared in requires.env, expanding its scope beyond a simple API helper.
Install Mechanism
No install spec and no code files — instruction-only. That minimizes install-time risk because nothing is downloaded or executed automatically.
Credentials
No required env vars are declared, yet the SKILL.md contains an APP_ID and APP_SECRET literal. A real Feishu integration needs an app id/secret or tenant token — declaring none while embedding secrets is inconsistent and unsafe. Also the skill expects to write logs under specific user paths, which is undeclared configuration access.
Persistence & Privilege
The skill does not request always:true and does not modify other skill configs, but it instructs the agent to write a permission log to a workspace path and references a check script. Writing to local workspace is normal for an instruction-style skill but should be explicit and configurable.
如何使用
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install feishu-document-permission - 安装完成后,直接呼叫该 Skill 的名称或使用
/feishu-document-permission触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release of feishu-document-permission.
- Sets Feishu document permission to "Anyone with the link can view", enabling external users to access shared documents.
- Supports verifying or directly fixing document permissions via API.
- Designed for scenarios where documents need to be shared outside the organization.
- Includes verification steps, error-proofing, and audit logging to ensure external access is correctly set.
- Provides usage examples, API instructions, and lists incorrect API patterns to avoid.
元数据
常见问题
Feishu Document Permission 是什么?
设置飞书云文档为'获得链接的任何人可查看',解决外部用户无法访问飞书文档的问题。适用于需要将飞书文档分享给组织外人员的场景。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 72 次。
如何安装 Feishu Document Permission?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install feishu-document-permission」即可一键安装,无需额外配置。
Feishu Document Permission 是免费的吗?
是的,Feishu Document Permission 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Feishu Document Permission 支持哪些平台?
Feishu Document Permission 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Feishu Document Permission?
由 harrot90-code(@harrot90-code)开发并维护,当前版本 v1.0.0。
推荐 Skills