TabTonic / kerberosAREA

This is a plugin for authenticating remedy logins against a kerberos environment.
GNU General Public License v3.0
0 stars 0 forks source link

com.tabtonic.kerberosAREA.UAndPCallbackHandler(String, char[]) may expose internal representation by storing an externally mutable object into UAndPCallbackHandler._password #7

Closed nevetS closed 11 years ago

nevetS commented 11 years ago

Per findbugs:

new com.tabtonic.kerberosAREA.UAndPCallbackHandler(String, char[]) may expose internal representation by storing an externally mutable object into UAndPCallbackHandler._password MALICIOUS_CODE EI_EXPOSE_REP2 54 Medium

EI2: May expose internal representation by incorporating reference to mutable object (EI_EXPOSE_REP2)

This code stores a reference to an externally mutable object into the internal representation of the object. If instances are accessed by untrusted code, and unchecked changes to the mutable object would compromise security or other important properties, you will need to do something different. Storing a copy of the object is better approach in many situations.

nevetS commented 11 years ago

Essentially what was happening here is that char[] arrays can be manipulated/muted by external functions. By creating a clone of the array rather than referencing it directly it is ensured that the callback will receive the same information that was passed to the constructor.