fix(security): keep file paths inside the working directory - #732
Draft
Solaris-star wants to merge 1 commit into
Draft
fix(security): keep file paths inside the working directory#732Solaris-star wants to merge 1 commit into
Solaris-star wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
关联问题
关联 #730。
修复范围
GenericAgentHandler._get_abs_path现在对路径做realpath解析,并要求解析结果位于工作目录内:../越界路径;file_write、file_patch、file_read和 JS 结果保存路径在拒绝时返回明确错误。本 PR 没有改动
code_run_header.py的 hash/integrity 机制,也没有重构执行链,避免扩大 #730 的修复范围。header 完整性可以另开 issue 讨论。验证
python -m unittest -v tests.test_path_jail4 个测试通过,覆盖正常路径、
../、symlink escape,以及file_write的拒绝结果;python -m compileall -q ga.py tests/test_path_jail.py通过。这是 draft PR,先请维护者确认路径 containment 的边界和错误处理方式。