New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RandomAccessReferenceMap.update() can randomly corrupt the map #37
Comments
From chrisisbeef on December 01, 2009 23:28:24 I believe, and correct me if I am wrong here, that the chances of this happening are Also, with how impropable this situation is, is it worth affecting the performance of |
From chrisisbeef on December 01, 2009 23:55:02 Labels: -Priority-Medium Priority-Low |
From cyounk...@gmail.com on December 02, 2009 15:46:58 Well, I guess it depends on whether or not you want this thing to actually work reliably. These are unchecked insertions, so the probability of a collision is the # of In the report I stated how to fix it. It would take at most 10 minutes to change and |
From manico.james@gmail.com on October 31, 2010 22:59:29 Younkins is right IMO. I'll fix this before 2.0. Owner: manico.james |
From manico.james@gmail.com on October 31, 2010 23:01:43 Status: Accepted |
From chrisisbeef on November 20, 2010 13:16:56 Labels: Component-Other |
From manico.james@gmail.com on May 28, 2012 20:20:12 Owner: chrisisbeef |
* Concurrency Test for AbstractAccessReferenceMap SThis test case consistently illustrates the race condition resulting from concurrent invocations of addDirectReference. * AbstractAccessReferenceMap Sync Updates Synchronizing all public access methods to this wrapper class. * AbstractAccessReferenceMap Class Documentation Updating class documentation to provide an example of multi-interaction synchronization syntax. * AbstractAccessMap field updates to use HashMap With primary synchronization being pushed to the class API level, there really is no benefit to maintaining the overhead of ConcurrentHashMap fields. The thread-safety guaranteed by the ConcurrentHashMap is superceeded by the public API of the abstract class, and should never actually be leveraged. This assumes that all sub-classes with extended public API continue the use of class-level synchronization. * AbstractAccessReferenceMapTest Extension Adding method which shows that it is possible to create a corrupted direct -> Indirect to Indirect -> Direct Object relationship when using the public update(Set) API. * AbstractAccessReferenceMap.update Logic Update Altering the logic of update behavior to avoid the possibility of the same indirect object being associated with multiple direct instances.
Closed via PR #469 |
From cyounk...@gmail.com on August 06, 2009 15:33:16
What steps will reproduce the problem? You have a ARM set up like this:
direct1 <=> "AAAA"
You do this:
newSet = new Set()
newSet.add(newDirect)
newSet.add(direct1)
ARM.update(newSet)
update() clears the old mappings, but tries to preserve them if the same
direct objects are referenced in the new set. Here's how this could go awry:
getUniqueRandomReference(), which randomly returns "AAAA". It checks that
"AAAA" is not in the current mapping, and it's not (It was just cleared).
sets it in the new mapping direct1 <=> "AAAA", corrupting the indirect to
direct mapping which is now "AAAA" -> direct1
How to fix it:
keys and ensure the generated one is not in that list
getUniqueRandomReference What version of the product are you using? On what operating system? SVN revision 574 .
Original issue: http://code.google.com/p/owasp-esapi-java/issues/detail?id=27
The text was updated successfully, but these errors were encountered: