Skip to content

Fix path traversal when downloading objects to a directory - #2206

Merged
micafer merged 4 commits into
trunkfrom
fix_storage_path
Nov 6, 2026
Merged

micafer merged 4 commits into
trunkfrom
fix_storage_path

Conversation

@micafer

@micafer micafer commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Fix path traversal when downloading objects to a directory

Description

Fix path traversal when downloading objects to a directory

When download_object saves an object to a directory, it now uses only the object’s basename as the local filename. This prevents provider-supplied object names containing path traversal components from writing files outside the intended destination directory.

Adds a regression test covering an object name with ../ components.

Status

  • done, ready for review

Checklist (tick everything that applies)

  • Code linting (required, can be done after the PR checks)
  • Documentation
  • Tests
  • ICLA (required for bigger changes)

@micafer
micafer requested a review from tisonkun November 5, 2026 09:23
@codecov-commenter

codecov-commenter commented Nov 5, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.57%. Comparing base (731331a) to head (7f8bd1c).

Additional details and impacted files
@@            Coverage Diff             @@
##            trunk    #2206      +/-   ##
==========================================
+ Coverage   83.56%   83.57%   +0.01%     
==========================================
  Files         352      352              
  Lines       82069    82082      +13     
  Branches     8800     8802       +2     
==========================================
+ Hits        68579    68594      +15     
+ Misses      10613    10612       -1     
+ Partials     2877     2876       -1     
Files with missing lines Coverage Δ
libcloud/storage/base.py 83.84% <100.00%> (+1.01%) ⬆️
libcloud/test/storage/test_base.py 96.30% <100.00%> (+0.27%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@micafer
micafer requested a review from PsiACE November 5, 2026 15:46
@micafer
micafer merged commit 71900a8 into trunk Nov 6, 2026
17 checks passed
@micafer
micafer deleted the fix_storage_path branch November 6, 2026 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants