Repository navigation
Conversation
There was a problem hiding this comment.
Code Review
This pull request replaces the legacy Java serialization mechanism in PartitionId with a custom PartitionCodec that encodes BatchTransactionId and Partition pairs into URL-safe base64 strings using structured protobuf and binary encoding. It also updates various Spanner read/query context classes to support query partitions via ExecuteSqlRequest. The review feedback recommends addressing potential Denial of Service (DoS) vulnerabilities in PartitionCodec by enforcing a tighter 1MB limit on transactionIdLength and tokenLength allocations, and suggests optimizing serialization performance by writing ByteString and protobuf objects directly to the output stream instead of allocating temporary byte arrays.
…tobuf encoding Replaces Java object serialization in PartitionId with a structured binary format based on protobuf. This eliminates unsafe object deserialization and adds size limits on decompressed payloads to guard against decompression bombs when executing RUN PARTITION statements. Summary of changes: - Encodes partition tokens and query parameters using standard Spanner request protos rather than serializing Java object graphs. - Enforces strict bounds on decompressed data to prevent zip bomb attacks. - Adds safety limits on encoded string length and payload sizes, with system properties available for custom tuning. - Centralizes how queries and parameters are converted into execution requests so partitions execute consistently.
d3918b1 to
d8a2395
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request replaces legacy Java serialization for PartitionId with a secure, structured binary and protobuf-based encoding mechanism implemented in the new PartitionCodec class. It refactors several core Spanner classes—including AbstractReadContext, Partition, PartitionedDmlTransaction, ReadOrQueryRequest, and Statement—to support building and executing partitions directly via ExecuteSqlRequest. Corresponding unit tests have been added and updated to verify the new codec, security limits, and request options precedence. There are no review comments to address, and the changes look solid.
Replaces Java object serialization in PartitionId with a structured binary format based on protobuf. This eliminates unsafe object deserialization and adds size limits on decompressed payloads to guard against decompression bombs when executing RUN PARTITION statements.
Summary of changes: