fix(skills): validate skill_id path segments before GCS blob lookup - #6689
Open
prasanna8585 wants to merge 1 commit into
Open
fix(skills): validate skill_id path segments before GCS blob lookup#6689prasanna8585 wants to merge 1 commit into
prasanna8585 wants to merge 1 commit into
Conversation
_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.
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.
_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.