[JAVA-3974] Async CryptBinding.retain() returns wrapped reference instead of this Created: 28/Jan/21 Updated: 28/Oct/23 Resolved: 03/Feb/21 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | Reactive Streams |
| Affects Version/s: | None |
| Fix Version/s: | 4.3.0 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Jeffrey Yemin | Assignee: | Jeffrey Yemin |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||
| Documentation Changes: | Not Needed | ||||||||||||||||
| Description |
|
Implementations of ReferenceCounted.retain should always return this. The implementation of com.mongodb.reactivestreams.client.internal.crypt.CryptBinding instead returns wrapped.retain(). If a caller did something like:
this could lead to bad outcomes, like failure to encrypt or decrypt documents. While it doesn't appear that any driver code actually does this right now, we should still fix this to avoid future problems. |
| Comments |
| Comment by Githook User [ 03/Feb/21 ] |
|
Author: {'name': 'Jeff Yemin', 'email': 'jeff.yemin@mongodb.com', 'username': 'jyemin'}Message: Return `this` from CryptBinding.retain
|
| Comment by Jeffrey Yemin [ 28/Jan/21 ] |
|
Yes, that's true. But that class in in test code, whereas this is production code, so I wanted to call this one out separately. |
| Comment by Valentin Kavalenka [ 28/Jan/21 ] |
|
AsyncSessionBinding.SessionBindingAsyncConnectionSource.retain also returns not this but wrapped.retain(). This violates the contract specified by the ReferenceCounted.retain method. Update: created |