Repository navigation
v0.2.5 — P0 Safety Fixes: Git Sandbox, Installer Protection & apply_edits Rollback
Security & Safety Release (v0.2.5)
Fixes three P0 safety and data-integrity issues (#5, thanks @ErrantSnow):
Fixed
- Read-only
git branch/git tagsandbox bypass (src/tools/batch-search.ts,src/benchmark-core.ts):- Separated Git optional-value flags (
--merged,--no-merged,--abbrev,--color,--column) from value-consuming flags so they accept=-attached values without settingexpectValue = trueto skip validation on the next space-separated token (blocking bypasses likebranch --color -D --column target,branch --color -m main hacked,branch --abbrev new-branch, andtag --color -d --column v0.2.2). - Removed
--abbrev,--color, and--columnfromGIT_BRANCH_VALUE_FLAGSinsrc/benchmark-core.ts.
- Separated Git optional-value flags (
- Installer source-repo protection &
--targetownership verification (scripts/install.mjs):- Resolves
fs.realpathwith case folding onwin32/darwinto prevent same-repo deletion across symlinked paths or case variants. - Refuses deleting
REPO_ROOTor any strict ancestor directory ofREPO_ROOT. - Requires non-empty, non-symlink target directories to contain
plugin.jsonwith"name": "agy-fast"before deletion, and unlinks symlinks/junctions (including broken links) directly without touching link targets.
- Resolves
apply_editsPhase-2 fallback truncation &createrollback safety (src/tools/apply-edits.ts):- Isolates temp-file
writeFile/chmodfailures (cleans up the temp file and rethrows without falling back toO_TRUNCdirect writes on the target). - Records the file in
writtenbefore the rename-fallback direct write so any mid-write failure rolls back the target's original content/permissions or removes a newly created file. - Treats only
ENOENTas missing in Phase-1create, failing fast onEACCES/EBUSY/ENOTDIRinstead of misclassifying an existing file as non-existent.
- Isolates temp-file
简体中文更新摘要(v0.2.5)
安全与数据完整性加固版本,修复三项 P0 级安全与防误删漏洞(#5,感谢 @ErrantSnow):
- 封堵只读
git branch/git tag沙箱绕过:将 Git 可选值参数(--merged、--no-merged、--abbrev、--color、--column)拆离消费下个参数的白名单,彻底拦截branch --color -D --column target、branch --color -m ...、tag --color -d ...等绕过,并同步修正benchmark-core.ts。 - 安装器防误删源仓库与
--target归属校验:通过fs.realpath+win32/darwin大小写归一化避免软链/大小写变体误删源仓库;拦截对源仓库及任意祖先目录的删除;删除非空非软链目录前强校验plugin.json的name === "agy-fast";软链/Windows junction/死链直接fs.unlink不触碰目标目录。 - 修复
apply_edits写盘截断与create回滚误删:将临时文件写入/chmod失败与rename隔离,不再触发回退直写截断原文件;真正rename失败走回退直写前先加入回滚队列;Phase-1create仅将ENOENT视为文件不存在,遇到EACCES/EBUSY等错误直接快速失败,避免回滚误删已有文件。
Full Changelog: v0.2.4...v0.2.5