Skip to content

feat(storage): enable default CRC32C checksum validation for object downloads#9210

Open
salilg-eng wants to merge 1 commit into
googleapis:mainfrom
salilg-eng:feat/default-crc32c
Open

feat(storage): enable default CRC32C checksum validation for object downloads#9210
salilg-eng wants to merge 1 commit into
googleapis:mainfrom
salilg-eng:feat/default-crc32c

Conversation

@salilg-eng
Copy link
Copy Markdown
Contributor

Overview

Enables full object checksum validation (CRC32C by default) across GCS JSON read paths, covering all four download methods: downloadAsString, downloadToFile, downloadAsStream, and downloadAsStreamAsync.

It integrates a HashValidatingStream decorator that computes hashes on-the-fly and validates them upon reaching the end of the stream.

Key Features

  • CRC32C by Default: Prioritizes lightweight, hardware-accelerated CRC32C validation.
  • MD5 Fallback: Automatically falls back to validating MD5 if a CRC32C hash is not available on the GCS object.
  • Configurable Options: Supports user overrides through the 'validate' parameter (crc32, md5, or false to disable).
  • Subrange Bypass: Bypasses checks automatically on partial range downloads (HTTP 206 Partial Content) where full object validation is incompatible.

Buganizer Tasks Resolved

  • Fixes b/514548528 ([PHP] SDK: Full object checksum for all JSON and XML Reads as well)

Testing

  • Added new unit tests in HashValidatingStreamTest.php.
  • Added sync/async integration test cases inside RestTest.php.

@salilg-eng salilg-eng requested review from a team as code owners May 25, 2026 10:11
@product-auto-label product-auto-label Bot added the api: storage Issues related to the Cloud Storage API. label May 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: storage Issues related to the Cloud Storage API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant