Skip to content

fix(skills): validate skill_id path segments before GCS blob lookup - #6689

Closed
prasanna8585 wants to merge 3 commits into
google:mainfrom
prasanna8585:fix/skills-gcs-path-traversal
Closed

prasanna8585 wants to merge 3 commits into
google:mainfrom
prasanna8585:fix/skills-gcs-path-traversal

Conversation

@prasanna8585

Copy link
Copy Markdown
Contributor

_load_skill_from_gcs_dir builds the GCS blob prefix it looks up (SKILL.md and resource files) by directly interpolating the caller -supplied skill_id: f"{base_prefix}{skill_id}/". skill_id identifies which of potentially many skill directories under a shared bucket gets loaded, so an application may resolve it from a caller- or model-selected skill name rather than a fixed, developer-authored constant.

Validates each '/'-separated segment of skill_id the same way app_name/eval_set_id/eval_set_result_id are validated in GcsEvalSetsManager and GcsEvalSetResultsManager (rejecting empty segments, null bytes, backslashes, and '.'/'..' traversal segments) before it reaches the blob-name f-string, applying the same defense already present in gcs_artifact_service.py to this sibling code path.

Adds regression tests covering traversal-shaped skill_id values, confirming they are rejected before any blob lookup occurs. Full tests/unittests/skills/ suite (78 tests) passes unchanged.

@adk-bot adk-bot added the core [Component] This issue is related to the core interface and implementation label Aug 12, 2026
@DeanChensj DeanChensj assigned wukath and unassigned DeanChensj Aug 12, 2026
@prasanna8585

Copy link
Copy Markdown
Contributor Author

@wukath, is there anything needed from my side to merge this PR?

@prasanna8585

Copy link
Copy Markdown
Contributor Author

Hi @wukath ,

is there any update require from my side on this ?

@prasanna8585

Copy link
Copy Markdown
Contributor Author

Hi @wukath,
Is there anything needed from my side to merge this PR?

_load_skill_from_gcs_dir builds the GCS blob prefix it looks up
(SKILL.md and resource files) by directly interpolating the caller
-supplied skill_id: f"{base_prefix}{skill_id}/". skill_id identifies
which of potentially many skill directories under a shared bucket gets
loaded, so an application may resolve it from a caller- or
model-selected skill name rather than a fixed, developer-authored
constant.

Validates each '/'-separated segment of skill_id the same way
app_name/eval_set_id/eval_set_result_id are validated in
GcsEvalSetsManager and GcsEvalSetResultsManager (rejecting empty
segments, null bytes, backslashes, and '.'/'..' traversal segments)
before it reaches the blob-name f-string, applying the same defense
already present in gcs_artifact_service.py to this sibling code path.

Adds regression tests covering traversal-shaped skill_id values,
confirming they are rejected before any blob lookup occurs. Full
tests/unittests/skills/ suite (78 tests) passes unchanged.
@prasanna8585
prasanna8585 force-pushed the fix/skills-gcs-path-traversal branch from 32e507b to b4392de Compare September 24, 2026 11:25
copybara-service Bot pushed a commit that referenced this pull request Oct 27, 2026
Merge #6689

Validates skill_id segments (allowing nested paths with '/') while rejecting
empty segments, null bytes, backslashes, and '.'/'..' traversal segments.
Also normalizes skill_id by stripping leading and trailing slashes. This
means a caller passing 'skills/my-skill/' will now resolve to
'skills/my-skill/SKILL.md' instead of 'skills/my-skill//SKILL.md'.

PiperOrigin-RevId: 1007822919
@adk-bot

adk-bot commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator

Thank you @prasanna8585 for your contribution! 🎉

Your changes have been successfully imported and merged via Copybara in commit 7394fba.

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 27, 2026
@adk-bot adk-bot closed this Oct 27, 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants