You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 11 Next »

Rationale

The CERT Oracle Secure Coding Standard for Java focuses on the Java 2 SE 6 Platform environment and includes guidelines that address the issue of secure coding using the Java SE 6 API. The Java Language Specification (3rd edition) [[JLS 2005]] prescribes the behavior of the Java programming language and serves as the primary reference for the development of this standard.

Traditional languages such as C and C++ allow unspecified or implementation defined behavior which leads to vulnerabilities when a programmer makes assumptions about the underlying behavior of an API or language construct. The Java Language Specification, on the other hand, standardizes language requirements where possible, because Java is designed to be a cross platform language. Even then, certain behaviors are left to the discretion of the implementer of the Java Virtual Machine (JVM) or the Java compiler. This standard identifies such language peculiarities and suggests solutions to help the implementers address the issues and let programmers appreciate and understand the limitations of the language and navigate around them.

Focusing only on language issues does not translate to writing secure software. Design issues in Java APIs sometimes lead to their deprecation. At other times, the APIs or the relevant documentation may be interpreted incorrectly by the programming community. This standard identifies such problematic APIs and highlights their correct use. Examples of commonly used faulty design patterns and idioms are also included.

The Java language, its core and extension APIs and the Java Virtual Machine (JVM) provide several security features, such as, the security manager and access controller, cryptography, automatic memory management, strong type checking and byte code verification. These features provide sufficient security for most applications but their proper use is of paramount importance. This standard highlights the pitfalls and caveats associated with the security architecture and stresses on its correct implementation. Adherence to this standard safeguards trusted programs from a plethora of exploitable security bugs that can cause denial of service, information leaks, erroneous computations and privilege escalation.

A section dedicated to securing the runtime environment helps enforce many of the guidelines. Software that complies with this standard provides its users the ability to define fine grained security policies and safely execute trusted mobile code on an untrusted system.

Included Libraries

This secure coding standard addresses security issues applicable to the lang and util Base Libraries, Other Base Libraries as well as the Integration Libraries. This standard avoids the inclusion of open bugs that have already been marked to be fixed or those that do not have any security ramifications. A functional bug is only included if it is likely that it occurs with high frequency, causes considerable security concerns or affects most Java technologies that rely on the core platform. This standard is not limited to security issues specific to the Core API but also includes important security concerns pertaining to the standard extension APIs (javax package).

Issues not Addressed

There are a number of issues not addressed by this secure coding standard.

Content

This coding standard does not address concerns specific to only one Java based platform, but applies broadly to all platforms. For example, guidelines that are applicable to Java ME or Java EE alone and not to Java SE are typically not included. Within Java SE, APIs that deal with the the user interface (User Interface Toolkits) or the web interface for providing features such as sound, graphical rendering, user account access control, session management, authentication and authorization, are beyond the scope of this standard. However, this does not preclude the standard from discussing networked Java systems in light of the risks associated with improper input validation and injection flaws, and suggesting appropriate mitigation strategies. This standard assumes that the functional specification of the product correctly identifies and prevents higher level design and architectural vulnerabilities.

Coding Style

Coding style issues are subjective, and it has proven impossible to develop a consensus on appropriate style guidelines. Consequently, the CERT Sun Microsystems Secure Coding standard for Java does not require any particular coding style to be enforced but only that the user defines style guidelines and apply these guidelines consistently. The easiest way to consistently apply a coding style is with the use of a code formatting tool. Many integrated development environments (IDEs) provide such capabilities.

Tools

As a federally funded research and development center (FFRDC), the SEI is not in a position to recommend particular vendors or tools to enforce the restrictions adopted. The user of this document is free to choose tools, and vendors are encouraged to provide tools to enforce the guidelines.

Controversial Guidelines

In general, the CERT secure coding standards try to avoid the inclusion of controversial guidelines that lack a broad consensus.

  • No labels