Skip to content

v0.25.0

Latest

Choose a tag to compare

@pjbull pjbull released this 22 Aug 18:39
· 4 commits to master since this release
a55e549
  • Security fix (GHSA-r4f8-3xc4-c8vw): local path traversal via .. in cloud object keys.
    Cloud object keys are opaque strings and some backends (e.g. Google Cloud Storage) accept ..
    segments. cloudpathlib mapped keys onto local paths with plain path arithmetic and no containment
    check, so a key such as ../../evil could escape the local cache directory (on any
    read/write/open/os.fspath of a CloudPath) or a download destination
    (download_to/copytree/copy/move to a local path), writing attacker-controlled bytes
    outside the intended directory. cloudpathlib now confirms each computed local target stays within
    its base directory and raises CloudPathLocalPathTraversalError otherwise. This guards the cache
    mapping (CloudPath._local and its S3/HTTP overrides), both branches of CloudPath.download_to
    and CloudPath.copytree (including joins that can escape via \ or drive letters in keys on
    Windows), and the cloudpathlib.local mock's storage-side mapping. Reported by mohammad adnan
    (cystack.ps redteam).
  • Added a lazy keyword argument to CloudPath.walk. By default (lazy=False) the existing fast behavior is preserved: the whole subtree is fetched up front with a single recursive listing. Passing lazy=True lists each directory on demand so that, when top_down=True, callers can prune subdirectories by modifying dirnames in-place (à la os.walk / Path.walk) to skip fetching the contents of those subtrees entirely — dramatically reducing API calls for large, sparsely-traversed trees. (Issue #518, PR #574)
  • Added presigned URL support to the mock clients in cloudpathlib.local, so as_url(presign=True) on a LocalS3Path, LocalGSPath, or LocalAzureBlobPath returns a deterministic URL with expires and signature query parameters instead of raising NotImplementedError. This lets code that generates presigned URLs be exercised in tests that use the mock classes. (PR #572)
  • Fixed S3 copy and move operations to forward copy-specific extra args such as CopySourceSSECustomerKey, and added addressing_style="virtual" support for S3Client (Issues #500, #527, PR #576)
  • Changed S3Client._get_metadata to read object metadata with HeadObject instead of GetObject, so stat, etag, and size no longer open the object body. Also fixes a KeyError on ContentLength against S3-compatible gateways that drop Content-Length from GetObject responses. (Issue #564, PR #565)
  • Fixed KeyError on ETag against S3-compatible gateways that omit ETag from HeadObject responses. (Issue #582, PR #583)
  • Fixed mypy 2.x type errors in Client and CloudPath that caused CI lint failures (Issue #563, PR #566)
  • Added AGENTS.md with repository-specific guidance for coding agents covering contributor
    workflow, compatibility expectations, test rig and mock usage, live backend validation, and PR
    hygiene. (PR #573)