Skip to content

fix(api_core): improve rest path validation#17753

Open
daniel-sanche wants to merge 14 commits into
mainfrom
fix_rest
Open

fix(api_core): improve rest path validation#17753
daniel-sanche wants to merge 14 commits into
mainfrom
fix_rest

Conversation

@daniel-sanche

Copy link
Copy Markdown
Contributor

Context: b/532254612

@daniel-sanche
daniel-sanche requested a review from a team as a code owner July 17, 2026 00:06

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces path traversal validation and percent-encoding for variables within path templates in google/api_core/path_template.py, along with corresponding unit tests. The feedback highlights a potential security bypass in _extract_and_validate_wildcards where path traversal sequences (like projects/..) could bypass validation if the value does not match the sub-template or if the template is single-segment. It is recommended to apply _validate_multi_segment_value to these edge cases and add tests to verify that these bypasses are successfully blocked.

Comment thread packages/google-api-core/google/api_core/path_template.py Outdated
Comment thread packages/google-api-core/tests/unit/test_path_template.py
@daniel-sanche daniel-sanche changed the title fix: improve rest path validation fix(api_core): improve rest path validation Jul 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant