Skip to content

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

Open
prasanna8585 wants to merge 1 commit into
google:mainfrom
prasanna8585:fix/skills-gcs-path-traversal
Open

fix(skills): validate skill_id path segments before GCS blob lookup#6689
prasanna8585 wants to merge 1 commit into
google:mainfrom
prasanna8585:fix/skills-gcs-path-traversal

Conversation

@prasanna8585

Copy link
Copy Markdown

_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.

_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
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants