fix(configurable): prevent path traversal in AgentTool config_path resolution#878
Open
adilburaksen wants to merge 2 commits into
Open
fix(configurable): prevent path traversal in AgentTool config_path resolution#878adilburaksen wants to merge 2 commits into
adilburaksen wants to merge 2 commits 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. |
…solution Absolute config_path values were accepted unconditionally, and relative paths were joined without boundary validation, allowing traversal outside the agent directory via "../../../etc/passwd" style inputs. Fix: reject absolute paths; verify the resolved path stays within the parent agent's directory using strings.HasPrefix after filepath.Clean.
3352de5 to
2a4876e
Compare
9 tasks
Author
|
@kdroste-google — would you (or another maintainer) be able to take a look at this small security fix when you have a moment? It adds a path-boundary check to |
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.
Summary
ResolveAgentReferenceinconfigurable_utils.goaccepted absoluterefPathvalues unconditionally and joined relative paths viafilepath.Joinwithout boundary enforcement. An attacker-controlledconfig_pathfield in an agent YAML could read arbitrary files accessible to the server process.Vulnerable pattern (before):
Fix
refPathvaluesstrings.HasPrefixon the cleaned pathRelated
Same vulnerability exists in
adk-python(PR: google/adk-python#5826) andadk-java(PR: google/adk-java#1218) — fix pattern is identical across all three SDKs.