Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Edited by NavBot (vkp) v1.0

...

Wiki Markup
Pugh \[[Pugh 2009|AA. JavaBibliography#Pugh References#Pugh 09]\] cites a vulnerability discovered by the Findbugs static analysis tool in the early betas of jdk 1.7. The class {{sun.security.x509.InvalidityDateExtension}} returned a {{Date}} instance through a {{public}} accessor, without creating defensive copies.

...

Wiki Markup
*OBJ11-EX1:* According to Sun's Secure Coding Guidelines document \[[SCG 2007|AA. JavaBibliography#SCG References#SCG 07]\]

if a class merely serves as a container for mutable inputs or outputs (the class does not directly operate on them), it may not be necessary to create defensive copies. For example, arrays and the standard collection classes do not create copies of caller-provided values. If a copy is desired so updates to a value do not affect the corresponding value in the collection, the caller must create the copy before inserting it into the collection, or after receiving it from the collection.

...

Wiki Markup
\[[API 2006|AA. Java References#APIBibliography#API 06]\] [method clone()|http://java.sun.com/javase/6/docs/api/java/lang/Object.html#clone()]
\[[Security 2006|AA. Java References#SecurityBibliography#Security 06]\]
\[[Bloch 2008|AA. Java References#BlochBibliography#Bloch 08]\] Item 39: Make defensive copies when needed
\[[SCG 2007|AA. JavaBibliography#SCG References#SCG 07]\] Guideline 2-1 Create a copy of mutable inputs and outputs
\[[Haggar 2000|AA. JavaBibliography#Haggar References#Haggar 00]\] [Practical Java Praxis 64: Use clone for Immutable Objects When Passing or Receiving Object References to Mutable Objects|http://www.informit.com/articles/article.aspx?p=20530]
\[[Goetz 2006|AA. Java References#GoetzBibliography#Goetz 06]\] 3.2. Publication and Escape: Allowing Internal Mutable State to Escape
\[[Gong 2003|AA. Java References#GongBibliography#Gong 03]\] 9.4 Private Object State and Object Immutability
\[[MITRE 2009|AA. Java References#MITREBibliography#MITRE 09]\] [CWE ID 375|http://cwe.mitre.org/data/definitions/375.html] "Passing Mutable Objects to an Untrusted Method"

...