Skip to content

Commit 8b8cf06

Browse files
Copilottvaron3
andcommitted
Address PR feedback: remove security tag, add PR link, clarify comments
Co-authored-by: tvaron3 <70857381+tvaron3@users.noreply.github.com>
1 parent 0c9ee02 commit 8b8cf06

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

sdk/cosmos/azure-cosmos/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#### Bugs Fixed
1010
* Fixed an issue where `query plan` failed with `400` or query return empty result when `CosmosQueryRequestOptions` has partition key filter and partition key value contains non-ascii character. See [PR 47881](https://github.com/Azure/azure-sdk-for-java/pull/47881)
1111
* Fixed an issue where operation failed with `400` when configured with pre-trigger or post-trigger with non-ascii character. Only impact for gateway mode. See [PR 47881](https://github.com/Azure/azure-sdk-for-java/pull/47881)
12-
* **[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.
12+
* 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. See [PR 47971](https://github.com/Azure/azure-sdk-for-java/pull/47971)
1313

1414
#### Other Changes
1515
* 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)

sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/DocumentCollection.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,9 @@ private void writeObject(ObjectOutputStream objectOutputStream) throws IOExcepti
539539

540540
private void readObject(ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException {
541541
Object obj = objectInputStream.readObject();
542-
// Security fix: Validate that the deserialized object is the expected type
542+
// Security fix: Validate that the deserialized object is the expected type before casting.
543+
// Without this check, an attacker could provide a malicious object that would be blindly cast to ObjectNode,
544+
// potentially leading to code execution vulnerabilities.
543545
if (!(obj instanceof ObjectNode)) {
544546
throw new InvalidClassException(
545547
"Expected ObjectNode but got " +

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,8 @@ private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IO
250250
// (e.g., a crafted lambda that executes arbitrary code).
251251
// Instead, skip it and use the default equality comparer.
252252
// This is safe because:
253-
// 1. All existing production code uses the default equality comparer
253+
// 1. All existing production code uses the default equality comparer (verified by searching all
254+
// usages of "new AsyncCache<>" - they all use the no-arg constructor which creates the default comparer)
254255
// 2. The serialization format remains unchanged (we still write the comparer for backward compatibility)
255256
// 3. Future format changes should increment the serialVersionUID to handle compatibility explicitly
256257
Object unusedComparer = ois.readObject(); // Read and discard the serialized comparer to maintain format compatibility

0 commit comments

Comments
 (0)