chore: add GitHub-reward form, scripts & actions#91
chore: add GitHub-reward form, scripts & actions#91TechQuery wants to merge 2 commits intoiflytek:mainfrom
Conversation
Co-authored-by: TechQuery <19969570+TechQuery@users.noreply.github.com>
@ifytek review 意见Critical(必须修复才能合并)
deno --allow-all .github/scripts/share-reward.ts issueparser_amount 来自 issue 表单的自由文本输入,且未加引号。攻击者只需将 amount 填写为 0; curl
const PR_DATA = await $`gh api graphql -f query='{ 变量被直接插值进 GraphQL 查询字符串内部,而不是作为独立参数传递。zx 的 $ 模板只对独立参数做 shell
两个 workflow 都用了 --allow-all,Deno 的权限模型形同虚设。结合上面两个注入漏洞,攻击者一旦注入成功,拥有完全 Important(合并前应修复)
uses: actions/checkout@v6 # v6 根本不存在,行为不可预测 任何一个 action 仓库被供应链攻击,恶意代码就会以 contents: write + issues: write 权限运行。应锁定到具体的
on: 每次关闭任何 issue 都会触发,浪费 Actions 配额,也扩大了攻击面。应加上:
env: 这让所有 step(包括第三方 action)都能访问 token。应只在需要的 step 级别传入。
表单用的是自由文本 input,没有 pattern 约束。应在 workflow 里加一步校验: Minor
结论 Critical 1 + 2 + 3 构成完整的攻击链:任何能创建 issue 的用户,填写恶意 amount 字段并关闭 issue,即可在 runner |
This pull request introduces a complete workflow for managing, distributing, and reporting rewards for completed issues, primarily through GitHub Actions, custom scripts, and templates. It includes new automation for reward assignment, tagging, distribution, and monthly statistics, as well as supporting scripts and type definitions.
Features
Reward Workflow Automation
reward-task.yml) for creating reward-based tasks, capturing details like description, currency, amount, and payer.claim-issue-reward.ymlworkflow to automatically distribute rewards when an issue is closed, extracting relevant data and invoking the reward-sharing script.share-reward.tsscript to determine eligible users (excluding bots), split the reward, tag the merge commit with reward data, and comment the reward distribution on the issue.RewardTypeScript interface to standardize reward data across scripts.Reward Statistics and Reporting
statistic-member-reward.ymlworkflow to run monthly, checking for new reward data and generating a summary of rewards per user and currency.count-reward.tsscript to aggregate and summarize reward tags from the past month, group them by payee, and publish the statistics as a new tag and GitHub release.Supporting Configuration
deno.jsonconfiguration file for script execution.