限定 weekly-report 工具权限,禁止写操作

通过 allowed-tools 限制为 Read/Glob/Grep + git pull + python,
禁止 Write、Edit 及任意 Bash 命令,临时文件由 Python 脚本自行管理

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
admin 2026-02-27 15:14:21 +08:00
parent 7ff805ca68
commit ff1f9ae07f
2 changed files with 17 additions and 0 deletions

View File

@ -4,6 +4,22 @@
> 适用于自建 Gitea 仓库,不依赖 `gh` CLI。
## 安全限制
本技能通过 `allowed-tools` 限定了 Claude 可使用的工具范围:
| 允许 | 说明 |
|------|------|
| `Read` | 读取配置文件和报告内容 |
| `Glob` | 查找脚本路径 |
| `Grep` | 搜索文件内容 |
| `Bash(git pull*)` | 仅允许执行 `git pull` |
| `Bash(python*)` | 仅允许执行 Python 脚本 |
明确**禁止**的操作:`Write`(写文件)、`Edit`(编辑文件)、任意 Bash 命令(如 `rm``curl``cat >` 等)。
临时文件(数据 JSON 和 HTML 报告)由 Python 脚本自身写入 `/tmp/`,不经过 Claude 的写工具。
## 前置要求
- Python 3.8+

View File

@ -2,6 +2,7 @@
name: weekly-report
description: 生成项目过去7天的周报通过 Gitea API 统计每位协作者的 commit 和 PR生成个人工作日志与项目整体报告通过 SMTP 发送邮件
argument-hint: ""
allowed-tools: Read, Glob, Grep, Bash(git pull*), Bash(python*)
---
生成当前项目过去 7 天的周报并发送邮件。按以下步骤执行,每步完成后告知用户进度。