Skip to content

fix(storage): Implement path containment to prevent traversal attacks#32780

Open
shubhangi-google wants to merge 9 commits intogoogleapis:mainfrom
shubhangi-google:bug_download_object_malformed_names
Open

fix(storage): Implement path containment to prevent traversal attacks#32780
shubhangi-google wants to merge 9 commits intogoogleapis:mainfrom
shubhangi-google:bug_download_object_malformed_names

Conversation

@shubhangi-google
Copy link
Contributor

@shubhangi-google shubhangi-google commented Feb 26, 2026

This pull request addresses a potential security vulnerability in the file download mechanism by implementing stringent path validation. The primary goal is to prevent malicious users from specifying paths that could lead to directory traversal attacks, ensuring that downloaded files are always written to safe, intended locations relative to the current working directory. This enhancement significantly improves the security posture of the file download feature.

Highlights

  • Security Enhancement: Implemented robust path validation within the file download functionality to prevent directory traversal vulnerabilities.
  • New Path Validation Method: Introduced a new private method, safe_path_for_download, which ensures that user-supplied download paths are relative and resolve strictly within the current working directory.
  • Expanded Test Coverage: Added new acceptance tests to specifically verify that attempts to download files to absolute paths or paths containing directory traversal sequences correctly raise SecurityError.

@shubhangi-google shubhangi-google changed the title Bug download object malformed names fix(storage): Implement path containment to prevent traversal attacks Feb 26, 2026
@shubhangi-google shubhangi-google marked this pull request as ready for review February 26, 2026 12:12
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