fix(agents): prevent path traversal in AgentTool config_path resolution#1218
fix(agents): prevent path traversal in AgentTool config_path resolution#1218adilburaksen wants to merge 1 commit into
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
|
I have read the CLA Documents and I hereby sign the CLA. |
4421e80 to
6e306c8
Compare
|
Hi @adilburaksen, thank you for your contribution! We appreciate you taking the time to submit this pull request. Could you please include the corresponding unit tests to verify your changes? |
|
Thanks for the review! I've added unit tests in |
|
Thank you for your response. please ensure your PR consists of a single commit. Could you please change your commits accordingly? |
Reject absolute config_path values and require the resolved sub-agent config path to stay within the agent directory, with unit tests covering absolute-path rejection, .. traversal rejection, and valid in-bounds resolution.
f077057 to
f10eceb
Compare
|
Done — squashed into a single commit ( |
|
Thank you for the updates @adilburaksen. Currently this PR is under review by our team, we will keep you posted if any additional information is required. thank you. |
|
@sherryfox, Could you please review this PR. |
Summary
resolveSubAgentFromConfigPathinConfigAgentUtils.javaaccepted absoluteconfigPathvalues unconditionally and resolved relative paths without boundary validation. An attacker-controlledconfig_pathfield in an agent YAML could read arbitrary files.Vulnerable pattern (before):
Fix
configPathvalues withConfigurationExceptionconfigDirbefore loadingRelated
Same vulnerability exists in
adk-python(PR: google/adk-python#5826) andadk-go— fix pattern is identical across all three SDKs.