Skip to content

fix: validate resource name to prevent path traversal in Documents op…#2338

Open
brodmart wants to merge 1 commit intogoogleapis:mainfrom
brodmart:patch-1
Open

fix: validate resource name to prevent path traversal in Documents op…#2338
brodmart wants to merge 1 commit intogoogleapis:mainfrom
brodmart:patch-1

Conversation

@brodmart
Copy link
Copy Markdown

…erations

Documents.get and Documents.delete (sync and async) pass the caller-supplied
name parameter directly into format_map with no sanitization. A name
containing .. sequences can traverse outside the intended resource path.

Add a lightweight _validate_resource_name() guard that raises ValueError
on any name containing .. before the URL is constructed.

Fixes a path traversal reported via Google VRP (report 503098362).

@google-cla
Copy link
Copy Markdown

google-cla Bot commented Apr 24, 2026

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.

@Venkaiahbabuneelam Venkaiahbabuneelam self-assigned this Apr 27, 2026
@Venkaiahbabuneelam Venkaiahbabuneelam added the size:XL Code changes > 100 lines label Apr 27, 2026
@brodmart
Copy link
Copy Markdown
Author

brodmart commented May 4, 2026

Hi @Venkaiahbabuneelam — this fixes a path traversal reported via Google VRP (503098362). Happy to rebase or trim the diff if size:XL is a concern. Let me know what you need to move this forward.

Add _validate_resource_name() guard to block '..' in resource names
for Documents.get(), Documents.delete(), AsyncDocuments.get(), and
AsyncDocuments.delete() operations.

Fixes Google VRP report 503098362.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL Code changes > 100 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants