Skip to content

fix(entries): guard destructive automation entry points (audit H7/H8) - #315

Merged
wxy merged 5 commits into
masterfrom
codex/audit-fixes-entry-guard
Sep 26, 2026
Merged

wxy merged 5 commits into
masterfrom
codex/audit-fixes-entry-guard

Conversation

@wxy

@wxy wxy commented Sep 26, 2026

Copy link
Copy Markdown
Owner

What changed · 改动内容

落实 docs/code-audit-2026-09-26.md 自动化入口防护批次(High × 2):

  • H7 fix(entries): guard snapshots_prune against accidental full wipes — before 零校验 + TEXT 字典序比较,一个非 ISO 字符串(如 "z")即删光项目全部快照且静默返回成功,MCP 一次调用即可触发。四层修复:store 新增 prunePreview;service 层 ISO 8601 强校验 + 未知项目抛错 + dryRun 预览 + >50% 删除量需 force;MCP 工具暴露 dry_run/force 参数;CLI 暴露 --dry-run/--force。
  • H8 fix(entries): stop exposing GitHub token as a model-visible tool argument — sync_release_status 与 appilot_overview 删除 token 参数,token 统一从 ctx.credentials/环境变量读取(对齐 generate_store_copy 既有防泄漏标准)。

Verification · 验证

  • 新增 packages/headless/tests/snapshots-prune-guard.test.ts:6 场景(非法 before/未知项目/dryRun/>50% 拦截/force 放行/ISO 变体兼容)
  • CLI e2e 扩展 --dry-run 断言;MCP 端到端测试全绿
  • npm run typecheck 通过;根 npm test 全链通过(2026-09-26)

Contributor agreement · 贡献者协议

  • I have read the Appilot CLA v1.0. If CLA Assistant asks me to sign, I will post the exact acceptance comment on this pull request.

wxy added 2 commits September 26, 2026 09:51
审计 2026-09-26 H7:snapshots_prune 的 before 零校验——checkedAt 是
TEXT 按字典序比较,传 "z" 等非 ISO 字符串即删光项目全部快照并静默
返回成功;MCP 场景一次 tools/call 即可触发,无确认、无 dry-run。

- store 层新增 prunePreview(总数 + 命中数预览,未知项目返回 null)
- service 层 prune 加防护:ISO 8601 强校验(封堵字典序陷阱)、未知项目
  抛错(不再静默 0)、dryRun 只预览、删除量超存量 50% 需 force:true;
  返回 { matched, removed, total }
- MCP 工具与 headless CLI 同步暴露 dry_run/--dry-run 与 force/--force
- 测试:headless 服务级 6 场景 + CLI e2e 扩展 --dry-run 断言
…ment

审计 2026-09-26 H8:sync_release_status 与 appilot_overview 把 token 声明
为工具参数——描述一边劝阻一边接受,模型一旦走此参数,GitHub PAT 会落入
会话转录/持久化存储。与 generate_store_copy 自身「工具参数对模型可见、
防泄漏」的策略矛盾。

- 两个工具删除 token 参数,统一从 ctx.credentials / 环境变量读取
  (generate/revise 工具既有标准)
- 工具描述同步更新,向调用方明示凭据来源
@github-actions

Copy link
Copy Markdown

Appilot CLA v1.0 accepted. Thank you for contributing. / Appilot CLA 1.0 已接受,感谢贡献。
Posted by the CLA Assistant Lite bot.

@wxy
wxy merged commit 8a1d68f into master Sep 26, 2026
4 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 26, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant