Skip to content

Commit 0971089

Browse files
Copilottvaron3
andcommitted
Address code review feedback: improve comments and fix typo
Co-authored-by: tvaron3 <70857381+tvaron3@users.noreply.github.com>
1 parent 2fe22cb commit 0971089

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

sdk/cosmos/azure-cosmos/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* **[SECURITY]** Fixed Remote Code Execution (RCE) vulnerability via unsafe Java deserialization in `CosmosClientMetadataCachesSnapshot`, `AsyncCache`, and `DocumentCollection`. Added `SafeObjectInputStream` with class allowlisting to prevent deserialization of unauthorized classes.
1313

1414
#### Other Changes
15-
* Added `x-ms-hub-region-processing-only` header to allow hub-region stickiness when 404 `READ SESSION NOT AVAIALBLE` is hit for Single-Writer accounts. - [PR 47631](https://github.com/Azure/azure-sdk-for-java/pull/47631)
15+
* Added `x-ms-hub-region-processing-only` header to allow hub-region stickiness when 404 `READ SESSION NOT AVAILABLE` is hit for Single-Writer accounts. - [PR 47631](https://github.com/Azure/azure-sdk-for-java/pull/47631)
1616

1717
### 4.77.0 (2026-01-26)
1818

sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/caches/AsyncCache.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,12 +246,16 @@ private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IO
246246
pairs.put(key, new AsyncLazy<>(value));
247247
}
248248

249-
// Security fix: Don't deserialize the IEqualityComparer as it could be a malicious object.
249+
// Security fix: Don't deserialize the IEqualityComparer as it could be a malicious object
250+
// (e.g., a crafted lambda that executes arbitrary code).
250251
// Instead, skip it and use the default equality comparer.
251-
// This is safe because all existing serialized caches use the default comparer.
252-
ois.readObject(); // Read and discard the serialized comparer
252+
// This is safe because:
253+
// 1. All existing production code uses the default equality comparer
254+
// 2. The serialization format remains unchanged (we still write the comparer for backward compatibility)
255+
// 3. Future format changes should increment the serialVersionUID to handle compatibility explicitly
256+
ois.readObject(); // Read and discard the serialized comparer to maintain format compatibility
253257

254-
// Use the default equality comparer
258+
// Use the default equality comparer (same as AsyncCache constructor)
255259
@SuppressWarnings("unchecked")
256260
IEqualityComparer<TValue> equalityComparer = (value1, value2) -> {
257261
if (value1 == value2)

0 commit comments

Comments
 (0)