Repository navigation
fix(pr1780): harden shell execute and stream context - #1814
Closed
guslegend0510 wants to merge 8 commits into
Closed
guslegend0510 wants to merge 8 commits into
guslegend0510 wants to merge 8 commits into
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Contributor
Author
|
@AgentScopeJavaBot @AgentScopeTeam 麻烦检查一下代码 |
Contributor
Author
|
针对于前面的 #1780 已处理,ShellExecuteTool 已在路径校验前增加 NUL 字符保护,并补充了 Windows / UNC / 空字节 / .. 的回归测试;Agent.stream(List, StreamOptions, RuntimeContext) 也保留了默认回退实现,并在 Javadoc 中说明了行为,同时补了三参 stream 的回归测试。 |
Contributor
Author
Contributor
Author
|
@chickenlj 麻烦您审核一下我这个PR,谢谢您 |
Contributor
Author
Collaborator
|
Thanks. See #1834 |
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.




AgentScope-Java Version
2.0.0-SNAPSHOT
Description
This PR hardens two areas highlighted in review feedback:
ShellExecuteToolnow validatesworking_directorybefore building the shell command.It rejects absolute paths,
..traversal, and null bytes.It also quotes the directory path before prepending
cd, which avoids shell parsing issues.Added regression coverage for safe quoting and unsafe path rejection.
Agentadds a new defaultstream(List<Msg>, StreamOptions, RuntimeContext)overload.The default implementation preserves backward compatibility by delegating to the legacy two-argument
stream(...).Added a regression test proving the new overload falls back to the old path.
Validation:
mvn -pl agentscope-harness,agentscope-core -Dtest=ShellExecuteToolTest,AgentStreamingTest testmvn -pl agentscope-harness,agentscope-core spotless:checkmvn -pl agentscope-harness,agentscope-core spotless:applyChecklist
mvn spotless:applymvn test)Close #1777