...
Additionally, hostile code from any other package can exploit this vulnerability if the class is accessible. (For more information, see CON04-J. Synchronize Use private final lock objects to synchronize classes that may interact with untrusted code using a private final lock object.)
Noncompliant Code Example (String
Literal)
...
For more information on using an Object
as a lock, see CON04-J. Synchronize Use private final lock objects to synchronize classes that may interact with untrusted code using a private final lock object.
Risk Assessment
A significant number of concurrency vulnerabilities arise from locking on the wrong kind of object. It is important to consider the properties of the lock object rather than indiscreetly scavenging for objects to synchronize on.
...