Skip to content

fix: sanitize GCS blob names to prevent path traversal in skill loading - #5281

Closed
bishtsec wants to merge 14 commits into
google:mainfrom
bishtsec:main
Closed

bishtsec wants to merge 14 commits into
google:mainfrom
bishtsec:main

Conversation

@bishtsec

@bishtsec bishtsec commented Apr 11, 2026 •

Copy link
Copy Markdown
Contributor

closed issue

@google-cla

google-cla Bot commented Apr 11, 2026

Copy link
Copy Markdown

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.

@adk-bot adk-bot added the core [Component] This issue is related to the core interface and implementation label Apr 11, 2026
Added path traversal protection in _materialize_and_run function.
Added checks for absolute paths and updated path traversal detection.
Refactor _load_files_in_dir to use dict type hints and PurePosixPath for path validation.
@bishtsec

Copy link
Copy Markdown
Contributor Author

"Updated PR #5281 — defense in depth implemented. Both ingestion-time (_utils.py via PurePosixPath) and execution-time (skill_toolset.py via realpath + commonpath) protections verified locally against original PoC. Malicious paths blocked at source before execution. Safe paths unaffected."

@rohityan rohityan self-assigned this Apr 13, 2026
@rohityan rohityan added the request clarification [Status] The maintainer need clarification or more information from the author label Apr 13, 2026
@rohityan

Copy link
Copy Markdown
Collaborator

Hi @Bisht-cx , Thank you for your contribution! We appreciate you taking the time to submit this pull request. Please fix formatting errors by running autoformat.sh

@bishtsec

Copy link
Copy Markdown
Contributor Author

sure , lemme start working on it , will update in few minutes / hours

@bishtsec

bishtsec commented Apr 13, 2026 •

Copy link
Copy Markdown
Contributor Author

Done! Ran autoformat.sh pyink and isort fixes are pushed. Checks should be green now.

@bishtsec

bishtsec commented Apr 15, 2026 •

Copy link
Copy Markdown
Contributor Author

@rohityan
All requested changes have been addressed:

  • Ran autoformat.sh (pyink + isort)
  • Added additional validation for path traversal (defense-in-depth)
  • Verified against original PoC

The fix ensures malicious blob paths cannot escape the intended directory before execution.

Would appreciate a review when you get time. Thanks!

@bishtsec

Copy link
Copy Markdown
Contributor Author

"@rohityan all conflicts resolved and checks are green. This PR patches a triaged unauthenticated RCE (Google OSS VRP #499557362) — path traversal via unsanitized GCS blob names leading to runpy.run_path() execution. Would appreciate workflow approval and review when you get a chance. Planned disclosure date is July 3, 2026."

- Ingestion layer: reject .. traversal, absolute paths, duplicate normalized paths
- Materialization layer: verify realpath+commonpath guards block traversal and absolute paths
- Happy path: confirm safe blobs load and materialize correctly

@bishtsec bishtsec left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@surajksharma07 — E2E verification is complete as requested. All 108 tests pass as of commit d340122 (today). Both defense layers confirmed, formatting clean.
One blocker remaining: 4 workflows are pending maintainer approval to run CI — could you approve the workflow run so checks can complete?

@adk-bot

adk-bot commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator

Thank you @cherry-bisht for your contribution! 🎉

Your changes have been successfully imported and merged via Copybara in commit 20a5a0c.

Closing this PR as the changes are now in the main branch.

@adk-bot adk-bot added the merged [Status] This PR is merged label Oct 16, 2026
@adk-bot adk-bot closed this Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core [Component] This issue is related to the core interface and implementation merged [Status] This PR is merged request clarification [Status] The maintainer need clarification or more information from the author

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants