<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://wiki.owasp.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Manuela+Grindei</id>
		<title>OWASP - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="https://wiki.owasp.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Manuela+Grindei"/>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php/Special:Contributions/Manuela_Grindei"/>
		<updated>2026-05-30T19:14:24Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.27.2</generator>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Exception_handling_techniques&amp;diff=165016</id>
		<title>Exception handling techniques</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Exception_handling_techniques&amp;diff=165016"/>
				<updated>2013-12-20T15:44:00Z</updated>
		
		<summary type="html">&lt;p&gt;Manuela Grindei: changed status&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Status==&lt;br /&gt;
To be reviewed&lt;br /&gt;
&lt;br /&gt;
==Exceptions Overview==&lt;br /&gt;
&lt;br /&gt;
Exceptions are occurrences that alter the normal program flow. They can have various causes, such as hardware failures, resource exhaustion, programming bugs etc. When an exceptional event occurs, an exception is said to be &amp;quot;thrown.&amp;quot; The code responsible for treating the exception is called an &amp;quot;exception handler,&amp;quot; and it &amp;quot;catches&amp;quot; the thrown exception. Exception handling refers to passing the execution of a program to an appropriate exception handler when an exception occurs. For example, if a method that opens a file is called, and the file cannot be opened, the execution of that method will stop, and the code from the appropriate exception handler will be run.&lt;br /&gt;
&lt;br /&gt;
In Java, exception-handling code is cleanly separated from the exception-generating code. The try block (also called &amp;quot;guarded region&amp;quot;) is the code in which exceptions may occur, and it must be immediately followed by either a finally block or at least one catch block. In Java 7, there is a new syntactic construction, called &amp;quot;try-with-resources&amp;quot;, which is the only exception to this rule, as it is not forced to be followed by a finally or catch block.&lt;br /&gt;
&lt;br /&gt;
A finally block contains code that is always executed at some point after the try block, whether an exception was thrown or not. Even if there is a return statement in the try block, the finally block executes right after the return statement is encountered, and before the return executes. If the try block executes without exception, the finally block is executed immediately after the try block completes. If an exception was thrown, the finally block executes immediately after the &lt;br /&gt;
corresponding catch block completes. However, if the JVM exits while the try or catch code is being executed, then the finally block may not execute. Likewise, if the thread executing the try &lt;br /&gt;
or catch code is interrupted or killed, the finally block may not execute even though the application keeps running.&lt;br /&gt;
&lt;br /&gt;
==Swallowing Exceptions==&lt;br /&gt;
&lt;br /&gt;
Swallowing exceptions means to continue processing as if nothing had gone wrong even though an exception has been thrown. You catch the exception, but do nothing meaningful with it. The classical example is an empty catch block:&lt;br /&gt;
&lt;br /&gt;
    catch(Exception e) {&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
Swallowing exceptions is considered bad practice, because the ignored exception may lead the application to an unexpected failure, at a point in the code that bears no apparent relation to the source of the problem. Finding the cause of the failure in such cases can be very challenging and time-consuming. Merely letting an exception propagate outward can at least cause the program to fail swiftly, preserving information to aid in debugging the failure.&lt;br /&gt;
&lt;br /&gt;
In addition, in case an exception is caught, it is strongly recommended to log information about it, as it is very useful for debugging purposes.&lt;br /&gt;
&lt;br /&gt;
==Resource cleanup and finally block==&lt;br /&gt;
&lt;br /&gt;
One of the situations when exceptions may occur is when we work with resources, such as files, databases, network sockets etc. &lt;br /&gt;
&lt;br /&gt;
Opening/closing, connecting/disconnecting, read/write statements are examples of operations that may throw exceptions in particular cases. If our code needs to work with resources, it is important to release them as soon as we are finished using them.&lt;br /&gt;
&lt;br /&gt;
The following example is about writing a text in a file. The constructor, the write, the flush of the file operation can throw IOException, hence they are being placed inside the try block. We are aware that we must close the file after writing in it. A naive (and wrong) approach would be the following:&lt;br /&gt;
&lt;br /&gt;
    File file = new File(&amp;quot;file.txt&amp;quot;);&lt;br /&gt;
    Writer writer = null;&lt;br /&gt;
    try {&lt;br /&gt;
        writer = new PrintWriter(file);&lt;br /&gt;
        writer.write(&amp;quot;Hello world!&amp;quot;);&lt;br /&gt;
        writer.flush();&lt;br /&gt;
        writer.close();&lt;br /&gt;
    }&lt;br /&gt;
    catch(FileNotFoundException e) {&lt;br /&gt;
        System.err.println(&amp;quot;Caught FileNotFoundException: &amp;quot; + e.getMessage());   &lt;br /&gt;
    }&lt;br /&gt;
    catch (IOException e) {&lt;br /&gt;
        System.err.println(&amp;quot;Caught IOException: &amp;quot; + e.getMessage());&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
As you can see in the example, we close a resource inside the try block. However this is not a good practice, because if an exception is thrown before our close statement is reached, then it will not be executed and resources might thus leak. We could add the close statement in the catch block, which leads to code duplication. If we have several catch blocks, this means we have to add the close statement there. Whenever we need to add a new catch block, we must also remember to put the close statement there. This way of handling exceptions is error-prone and unnecessarily complicated.&lt;br /&gt;
&lt;br /&gt;
So where should we place the close statement? We would need a block that always gets executed, no matter if we have exceptions or not, like... finally.&lt;br /&gt;
&lt;br /&gt;
Indeed, the ideal place to release resources is the finally block. As we have seen before, finally always gets executed. This means the closing of resources will get executed even if exceptions occur, and in addition we do not have code duplication, which is mainly what we want. This approach is the best way to correctly handle the resources our code used.&lt;br /&gt;
&lt;br /&gt;
To fix the above example, a finally block was added and the file was closed there, as shown in the code below.&lt;br /&gt;
&lt;br /&gt;
    File file = new File(&amp;quot;file.txt&amp;quot;);&lt;br /&gt;
    Writer writer = null;&lt;br /&gt;
    try {&lt;br /&gt;
        writer = new PrintWriter(file);&lt;br /&gt;
        writer.write(&amp;quot;Hello world!&amp;quot;);&lt;br /&gt;
        writer.flush();&lt;br /&gt;
    }&lt;br /&gt;
    catch(FileNotFoundException e) {&lt;br /&gt;
        System.err.println(&amp;quot;Caught FileNotFoundException: &amp;quot; + e.getMessage());   &lt;br /&gt;
    }&lt;br /&gt;
    catch (IOException e) {&lt;br /&gt;
        System.err.println(&amp;quot;Caught IOException: &amp;quot; + e.getMessage());&lt;br /&gt;
    } finally {&lt;br /&gt;
        if (writer != null)&lt;br /&gt;
            try {&lt;br /&gt;
                writer.close();&lt;br /&gt;
            } catch (IOException e) {&lt;br /&gt;
                System.err.println(&amp;quot;Caught IOException: &amp;quot; + e.getMessage());&lt;br /&gt;
            }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
==Try-with-resources==&lt;br /&gt;
&lt;br /&gt;
In Java 7, resource cleanup was automated by means of the try-with-resources block. In practice, this new syntax allows you to declare resources that are part of the try block. You define the resources ahead of time and the runtime automatically closes those resources (if they are not already closed) after the execution of the try block. &lt;br /&gt;
&lt;br /&gt;
A resource can be any object that implements the interface java.lang.AutoCloseable.&lt;br /&gt;
&lt;br /&gt;
Although the try-with-resources block can have a finally or catch block, it is not mandatory.&lt;br /&gt;
&lt;br /&gt;
In our example, since Writer implements AutoCloseable, we can place it in a try-with-resources block as follows:&lt;br /&gt;
&lt;br /&gt;
    File file = new File(&amp;quot;file.txt&amp;quot;);&lt;br /&gt;
    try(Writer writer = new PrintWriter(file)) {&lt;br /&gt;
        writer.write(&amp;quot;Hello world!&amp;quot;);&lt;br /&gt;
        writer.flush();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
The code looks far more readable this way, and the developer is no longer supposed to close the resources, it is automatically done as long as the classes implement the AutoCloseable interface. Also note that the function that contains this code must throw IOException in order to compile, since there are no catch blocks.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Java Project]]&lt;br /&gt;
[[Category:Java]]&lt;br /&gt;
[[Category:Error Handling]]&lt;/div&gt;</summary>
		<author><name>Manuela Grindei</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=OWASP_Java_Table_of_Contents&amp;diff=165015</id>
		<title>OWASP Java Table of Contents</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=OWASP_Java_Table_of_Contents&amp;diff=165015"/>
				<updated>2013-12-20T15:43:31Z</updated>
		
		<summary type="html">&lt;p&gt;Manuela Grindei: changed status&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;b&amp;gt;Key:&amp;lt;/b&amp;gt;&lt;br /&gt;
* xx%: Progress status of the paragraph&lt;br /&gt;
* &amp;lt;b&amp;gt;Review&amp;lt;/b&amp;gt;: The paragraph needs a review&lt;br /&gt;
* TD: Paragraph to be assigned&lt;br /&gt;
&lt;br /&gt;
==[[J2EE Security for Architects]]==&lt;br /&gt;
Discuss the security implications of common J2EE architectures.  This could be discussed in terms of: Authentication, Authorisation, Data Validation, Cross Site Scripting protection.  Other architecture concerns such as scalability, performance and maintainability can also be mentioned, but the focus on security should not be lost.&lt;br /&gt;
  &lt;br /&gt;
Any other security concerns that should be addressed during the design phase should also be mentioned here.&lt;br /&gt;
===Design considerations===&lt;br /&gt;
* Architectural considerations (0%, TD)&lt;br /&gt;
** EJB Middle tier (0%, TD)&lt;br /&gt;
** Web Services Middle tier (0%, TD)&lt;br /&gt;
** Spring Middle tier (0%, TD)&lt;br /&gt;
&lt;br /&gt;
==[[J2EE Security for Developers]]==&lt;br /&gt;
=== Noteworthy Frameworks ===&lt;br /&gt;
Discuss important and relevant Java security frameworks that would be useful to architects.  The information should be at a suitably high level. For example, by discussing the advantages and features as well as the associated costs (direct and indirect) of using the frameworks.&lt;br /&gt;
&lt;br /&gt;
(0%, Seeking Volunteers)&lt;br /&gt;
*	Cocoon&lt;br /&gt;
*	[[Java Server Faces]] (Sam Reghenzi - 90%, Finalising content)&lt;br /&gt;
*	JSecurity&lt;br /&gt;
*	SiteMesh&lt;br /&gt;
*	Spring (0%, Adrian San Juan, TD)&lt;br /&gt;
*	[[Struts]] (0% Jon Forck)&lt;br /&gt;
*	Tapestry&lt;br /&gt;
*	Tiles&lt;br /&gt;
*	Turbine&lt;br /&gt;
*	Webwork&lt;br /&gt;
*	[[Wicket]]&lt;br /&gt;
&lt;br /&gt;
===Java Security Basics===&lt;br /&gt;
Provide an introduction into the basic security services provided by the Java language and environment.  Remember to keep this relevant for web developers for the initial release - there may be a potential to expand this to thick clients in subsequent releases.&lt;br /&gt;
* Class Loading (0%, Philippe Clairet)&lt;br /&gt;
* Bytecode verifier (0%, Philippe Clairet)&lt;br /&gt;
* The Security Manager and security.policy file (0%, John Wilander, Philippe Clairet)&lt;br /&gt;
&lt;br /&gt;
===Input Validation Overview ===&lt;br /&gt;
Input validation is perhaps the most important category of application security. Any data entering a software system must be verified to contain safe data that is not mounting a SQL Injection, XSS, CSRF or other form of attack. This is done primarily through the use of regular expressions. It's crucial not to hard-code input validation routines. Regular expressions should contained within a configuration file that can easily updated by an InfoSec professional and not require a programmers intervention or deployment of new application code. Application security needs change over time as new attack vectors are discovered. Application administers need to be able to react to these changes as quickly as possible. &lt;br /&gt;
&lt;br /&gt;
===Input Validation ===&lt;br /&gt;
* Dangerous calls (BufferedReader.readLine(), ServletRequest.getParameter(), etc...) (0%, TD)&lt;br /&gt;
* [[How to add validation logic to HttpServletRequest]] (100%, Jeff Williams, Complete)&lt;br /&gt;
* [[How to perform HTML entity encoding in Java]] (100%, Jeff Williams, Complete)&lt;br /&gt;
&lt;br /&gt;
==== [[Preventing SQL Injection in Java]] ====&lt;br /&gt;
* Overview &lt;br /&gt;
* Prevention (60%, Stephen de Vries, &amp;lt;b&amp;gt;Review&amp;lt;/b&amp;gt;)&lt;br /&gt;
** White Listing&lt;br /&gt;
** Prepared Statements&lt;br /&gt;
** Stored Procedures &lt;br /&gt;
** Hibernate &lt;br /&gt;
** Ibatis (60%, Rohyt Belani, &amp;lt;b&amp;gt;Review&amp;lt;/b&amp;gt;)&lt;br /&gt;
** Spring JDBC &lt;br /&gt;
** EJB 3.0&lt;br /&gt;
** JDO&lt;br /&gt;
&lt;br /&gt;
==== [[Preventing LDAP Injection in Java]] ====&lt;br /&gt;
* Overview (100%, Stephen de Vries, Complete)&lt;br /&gt;
* Prevention (100%, Stephen de Vries, Complete)&lt;br /&gt;
&lt;br /&gt;
==== XPATH Injection ====&lt;br /&gt;
* [[XPATH Injection|Article n°1]] (70%, Weilin Zhong)&lt;br /&gt;
* [[XPATH Injection Java|Article n°2]] (100%, Dominique Righetto, Complete)&lt;br /&gt;
&lt;br /&gt;
==== [[Miscellaneous Injection Attacks]]  ====&lt;br /&gt;
* HTTP Response splitting (0%, TD)&lt;br /&gt;
* [[Code injection in Java]] (75%, Neil Bergman, Review)&lt;br /&gt;
* [[Command injection in Java]] - Runtime.getRuntime().exec() (100%, Neil Bergman, Review)&lt;br /&gt;
* Regular Expression (regex) Injections (20%)&lt;br /&gt;
&lt;br /&gt;
''' Status '''&lt;br /&gt;
In progress&lt;br /&gt;
&lt;br /&gt;
=== Authentication===&lt;br /&gt;
* [[Storing credentials]] - (20%, Adrian San Juan, &amp;lt;b&amp;gt;Review&amp;lt;/b&amp;gt;)&lt;br /&gt;
* [[Hashing Java|Hashing]] - (100%, Michel Prunet, &amp;lt;b&amp;gt;Review&amp;lt;/b&amp;gt;)&lt;br /&gt;
* [[SSL Best Practices]] - (20%, Philippe Curmin, &amp;lt;b&amp;gt;Review&amp;lt;/b&amp;gt;)&lt;br /&gt;
* [[Captchas in Java]] - (100%, Dave Ferguson, &amp;lt;b&amp;gt;Review&amp;lt;/b&amp;gt;) &lt;br /&gt;
* Container-managed authentication with Realms&lt;br /&gt;
** [[Declarative Access Control in Java]] - (100%, Dave Ferguson, Completed)&lt;br /&gt;
* [[JAAS Timed Login Module]] - (100%, Stephen de Vries, &amp;lt;b&amp;gt;Review&amp;lt;/b&amp;gt;)&lt;br /&gt;
* [[JAAS Tomcat Login Module]] - (100%, Stephen de Vries, &amp;lt;b&amp;gt;Review&amp;lt;/b&amp;gt;)&lt;br /&gt;
* [[Password length &amp;amp; complexity]] - (100%, Adrian San Juan, &amp;lt;b&amp;gt;Review&amp;lt;/b&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
===Session Management ===&lt;br /&gt;
The generic problems and solutions for session management are covered in the Guide.  This section should focus on Java specific examples.&lt;br /&gt;
* [[Logout]] (100%, Dominique Righetto, Complete)&lt;br /&gt;
* [[Session Timeout]] (100%, Dominique Righetto, Complete)&lt;br /&gt;
* Absolute Timeout (0%, TD)&lt;br /&gt;
* [[Session Fixation in Java]] (100%, Rohyt Belani, &amp;lt;b&amp;gt;Review&amp;lt;/b&amp;gt;)&lt;br /&gt;
* Terminating sessions (0%, TD)&lt;br /&gt;
** Terminating sessions when the browser window is closed&lt;br /&gt;
&lt;br /&gt;
===Authorization===&lt;br /&gt;
* [[Declarative v/s Programmatic]] (10%, TD)&lt;br /&gt;
* EJB Authorization (0%, TD)&lt;br /&gt;
* Acegi (0%, TD)&lt;br /&gt;
* JACC (0%, TD)&lt;br /&gt;
* Check horizontal privilege (0%, TD)&lt;br /&gt;
&lt;br /&gt;
=== Encryption===&lt;br /&gt;
* [http://www.owasp.org/index.php/Using_the_Java_Cryptographic_Extensions JCE] (100%, Joe Prasanna Kumar - To be reviewed)&lt;br /&gt;
* Storing db secrets (0%, TD)&lt;br /&gt;
* Encrypting JDBC connections (0%, TD)&lt;br /&gt;
* [http://www.owasp.org/index.php/Using_the_Java_Secure_Socket_Extensions JSSE] (100%, Joe Prasanna Kumar - To be reviewed)&lt;br /&gt;
* [http://www.owasp.org/index.php/Digital_Signature_Implementation_in_Java Digital Signatures in Java] (100%, Joe Prasanna Kumar - To be reviewed)&lt;br /&gt;
&lt;br /&gt;
=== Error Handling &amp;amp; Logging===&lt;br /&gt;
* Logging - why log? what to log? log4j, etc. (0%, TD)&lt;br /&gt;
* [[Exception handling techniques]] (100%, Manuela Grindei, To be reviewed)&lt;br /&gt;
** fail-open/fail-closed&lt;br /&gt;
** resource cleanup&lt;br /&gt;
** finally block&lt;br /&gt;
** swallowing exceptions&lt;br /&gt;
* Exception handling frameworks (50%, TD)&lt;br /&gt;
** [[Servlet spec - web.xml]] (100%, Dominique Righetto, Complete)&lt;br /&gt;
** [[Securing tomcat]] (100%, Darren Edmonds, Completed)&lt;br /&gt;
** [[JSP errorPage]] (100%, Dominique Righetto, Complete)&lt;br /&gt;
* Web application forensics (0%, TD)&lt;br /&gt;
&lt;br /&gt;
=== Web Services Security ===&lt;br /&gt;
* SAML (0%, TD)&lt;br /&gt;
* (X)WS-Security (0%, TD)&lt;br /&gt;
* SunJWSDP (0%, TD)&lt;br /&gt;
* WSS4J (0%, Eelco Klaver)&lt;br /&gt;
* XML Signature (JSR 105) (0%, TD)&lt;br /&gt;
* XML Encryption (JSR 106) (0%, TD)&lt;br /&gt;
&lt;br /&gt;
=== Cross-Origin Resource Sharing ===&lt;br /&gt;
* [[CORS OriginHeaderScrutiny|Origin HTTP header check]] (100%, Dominique Righetto, Complete)&lt;br /&gt;
* [[CORS RequestPreflighScrutiny|Request preflight process check]] (100%, Dominique Righetto, Complete)&lt;br /&gt;
&lt;br /&gt;
=== Content Security Policy ===&lt;br /&gt;
* [[Content Security Policy|Set up in a application]] (100%, Dominique Righetto, Complete)&lt;br /&gt;
&lt;br /&gt;
=== Code Analysis Tools ===&lt;br /&gt;
The introduction should cover the advantages and short comings of code analysis tools.  An overview of the current state of the art and the available tools would go well here.  As a start, only open source tools are listed, but if vendors of commercial tools adhere to the [[Tutorial]] guidelines, these submissions will be gladly received.&lt;br /&gt;
* Introduction (0%, TD)&lt;br /&gt;
* [[:Category:OWASP LAPSE Project]] (100%, &amp;lt;b&amp;gt;Review&amp;lt;/b&amp;gt;)&lt;br /&gt;
* FindBugs (0%, TD)&lt;br /&gt;
** Creating custom rules&lt;br /&gt;
* PMD (0%, TD)&lt;br /&gt;
** Creating custom rules&lt;br /&gt;
* JLint (0%, TD)&lt;br /&gt;
* Jmetrics (0%, TD)&lt;br /&gt;
&lt;br /&gt;
=== Choosing Security Libraries ===&lt;br /&gt;
* [[Summary of Java Security Libraries]]&lt;br /&gt;
&lt;br /&gt;
== J2EE Security For Deployers ==&lt;br /&gt;
Practical step-by-step guides to securing various J2EE servers.  Examples of secure configurations can also be provided for download.  If configurations are provided, they should be properly commented so that the rationale for configuration settings is clearly explained.  Users of the configurations should be provided with enough information to make their own risk decisions.&lt;br /&gt;
=== Securing Popular J2EE Servers ===&lt;br /&gt;
* [[Securing tomcat|Securing Tomcat]] - (100%, Darren Edmonds, Completed)&lt;br /&gt;
* Securing JBoss (0%, TD)&lt;br /&gt;
* Securing WebLogic (0%, TD)&lt;br /&gt;
* Securing WebSphere (0%, TD)&lt;br /&gt;
* Others...&lt;br /&gt;
&lt;br /&gt;
=== Defining a Java Security Policy ===&lt;br /&gt;
Practical information on creating a Java security policies for J2EE servers.&lt;br /&gt;
* PolicyTool - JChains already provides this functionality, one policy tool is enough.&lt;br /&gt;
* jChains (www.jchains.org) - (0%, TD)&lt;br /&gt;
&lt;br /&gt;
=== Protecting Binaries ===&lt;br /&gt;
* Bytecode manipulation tools and techniques (0%, TD)&lt;br /&gt;
* [[Bytecode obfuscation]] (100%, Pierre Parrend, Released)&lt;br /&gt;
* Convert bytecode to native machine code (0%, TD)&lt;br /&gt;
* [[Protecting code archives with digital signatures]] (100%, Pierre Parrend, Released)&lt;br /&gt;
* [[Signing jar files with jarsigner]] (100%, Pierre Parrend, Released)&lt;br /&gt;
&lt;br /&gt;
==J2EE Security for Security Analysts and Testers==&lt;br /&gt;
* Using Eclipse to verify Java applications (0%, TD)&lt;br /&gt;
* Using [[:Category:OWASP WebScarab Project|WebScarab]] to find vulnerabilities in J2EE applications - (0%, TD)&lt;br /&gt;
* [[Decompiling Java bytecode]] (100%, Dominique Righetto, Complete)&lt;br /&gt;
&lt;br /&gt;
== [[Java Security Resources]] (ongoing)==&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Java Project]]&lt;/div&gt;</summary>
		<author><name>Manuela Grindei</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Exception_handling_techniques&amp;diff=165014</id>
		<title>Exception handling techniques</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Exception_handling_techniques&amp;diff=165014"/>
				<updated>2013-12-20T15:42:15Z</updated>
		
		<summary type="html">&lt;p&gt;Manuela Grindei: fixed some typos&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Status==&lt;br /&gt;
Draft&lt;br /&gt;
&lt;br /&gt;
==Exceptions Overview==&lt;br /&gt;
&lt;br /&gt;
Exceptions are occurrences that alter the normal program flow. They can have various causes, such as hardware failures, resource exhaustion, programming bugs etc. When an exceptional event occurs, an exception is said to be &amp;quot;thrown.&amp;quot; The code responsible for treating the exception is called an &amp;quot;exception handler,&amp;quot; and it &amp;quot;catches&amp;quot; the thrown exception. Exception handling refers to passing the execution of a program to an appropriate exception handler when an exception occurs. For example, if a method that opens a file is called, and the file cannot be opened, the execution of that method will stop, and the code from the appropriate exception handler will be run.&lt;br /&gt;
&lt;br /&gt;
In Java, exception-handling code is cleanly separated from the exception-generating code. The try block (also called &amp;quot;guarded region&amp;quot;) is the code in which exceptions may occur, and it must be immediately followed by either a finally block or at least one catch block. In Java 7, there is a new syntactic construction, called &amp;quot;try-with-resources&amp;quot;, which is the only exception to this rule, as it is not forced to be followed by a finally or catch block.&lt;br /&gt;
&lt;br /&gt;
A finally block contains code that is always executed at some point after the try block, whether an exception was thrown or not. Even if there is a return statement in the try block, the finally block executes right after the return statement is encountered, and before the return executes. If the try block executes without exception, the finally block is executed immediately after the try block completes. If an exception was thrown, the finally block executes immediately after the &lt;br /&gt;
corresponding catch block completes. However, if the JVM exits while the try or catch code is being executed, then the finally block may not execute. Likewise, if the thread executing the try &lt;br /&gt;
or catch code is interrupted or killed, the finally block may not execute even though the application keeps running.&lt;br /&gt;
&lt;br /&gt;
==Swallowing Exceptions==&lt;br /&gt;
&lt;br /&gt;
Swallowing exceptions means to continue processing as if nothing had gone wrong even though an exception has been thrown. You catch the exception, but do nothing meaningful with it. The classical example is an empty catch block:&lt;br /&gt;
&lt;br /&gt;
    catch(Exception e) {&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
Swallowing exceptions is considered bad practice, because the ignored exception may lead the application to an unexpected failure, at a point in the code that bears no apparent relation to the source of the problem. Finding the cause of the failure in such cases can be very challenging and time-consuming. Merely letting an exception propagate outward can at least cause the program to fail swiftly, preserving information to aid in debugging the failure.&lt;br /&gt;
&lt;br /&gt;
In addition, in case an exception is caught, it is strongly recommended to log information about it, as it is very useful for debugging purposes.&lt;br /&gt;
&lt;br /&gt;
==Resource cleanup and finally block==&lt;br /&gt;
&lt;br /&gt;
One of the situations when exceptions may occur is when we work with resources, such as files, databases, network sockets etc. &lt;br /&gt;
&lt;br /&gt;
Opening/closing, connecting/disconnecting, read/write statements are examples of operations that may throw exceptions in particular cases. If our code needs to work with resources, it is important to release them as soon as we are finished using them.&lt;br /&gt;
&lt;br /&gt;
The following example is about writing a text in a file. The constructor, the write, the flush of the file operation can throw IOException, hence they are being placed inside the try block. We are aware that we must close the file after writing in it. A naive (and wrong) approach would be the following:&lt;br /&gt;
&lt;br /&gt;
    File file = new File(&amp;quot;file.txt&amp;quot;);&lt;br /&gt;
    Writer writer = null;&lt;br /&gt;
    try {&lt;br /&gt;
        writer = new PrintWriter(file);&lt;br /&gt;
        writer.write(&amp;quot;Hello world!&amp;quot;);&lt;br /&gt;
        writer.flush();&lt;br /&gt;
        writer.close();&lt;br /&gt;
    }&lt;br /&gt;
    catch(FileNotFoundException e) {&lt;br /&gt;
        System.err.println(&amp;quot;Caught FileNotFoundException: &amp;quot; + e.getMessage());   &lt;br /&gt;
    }&lt;br /&gt;
    catch (IOException e) {&lt;br /&gt;
        System.err.println(&amp;quot;Caught IOException: &amp;quot; + e.getMessage());&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
As you can see in the example, we close a resource inside the try block. However this is not a good practice, because if an exception is thrown before our close statement is reached, then it will not be executed and resources might thus leak. We could add the close statement in the catch block, which leads to code duplication. If we have several catch blocks, this means we have to add the close statement there. Whenever we need to add a new catch block, we must also remember to put the close statement there. This way of handling exceptions is error-prone and unnecessarily complicated.&lt;br /&gt;
&lt;br /&gt;
So where should we place the close statement? We would need a block that always gets executed, no matter if we have exceptions or not, like... finally.&lt;br /&gt;
&lt;br /&gt;
Indeed, the ideal place to release resources is the finally block. As we have seen before, finally always gets executed. This means the closing of resources will get executed even if exceptions occur, and in addition we do not have code duplication, which is mainly what we want. This approach is the best way to correctly handle the resources our code used.&lt;br /&gt;
&lt;br /&gt;
To fix the above example, a finally block was added and the file was closed there, as shown in the code below.&lt;br /&gt;
&lt;br /&gt;
    File file = new File(&amp;quot;file.txt&amp;quot;);&lt;br /&gt;
    Writer writer = null;&lt;br /&gt;
    try {&lt;br /&gt;
        writer = new PrintWriter(file);&lt;br /&gt;
        writer.write(&amp;quot;Hello world!&amp;quot;);&lt;br /&gt;
        writer.flush();&lt;br /&gt;
    }&lt;br /&gt;
    catch(FileNotFoundException e) {&lt;br /&gt;
        System.err.println(&amp;quot;Caught FileNotFoundException: &amp;quot; + e.getMessage());   &lt;br /&gt;
    }&lt;br /&gt;
    catch (IOException e) {&lt;br /&gt;
        System.err.println(&amp;quot;Caught IOException: &amp;quot; + e.getMessage());&lt;br /&gt;
    } finally {&lt;br /&gt;
        if (writer != null)&lt;br /&gt;
            try {&lt;br /&gt;
                writer.close();&lt;br /&gt;
            } catch (IOException e) {&lt;br /&gt;
                System.err.println(&amp;quot;Caught IOException: &amp;quot; + e.getMessage());&lt;br /&gt;
            }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
==Try-with-resources==&lt;br /&gt;
&lt;br /&gt;
In Java 7, resource cleanup was automated by means of the try-with-resources block. In practice, this new syntax allows you to declare resources that are part of the try block. You define the resources ahead of time and the runtime automatically closes those resources (if they are not already closed) after the execution of the try block. &lt;br /&gt;
&lt;br /&gt;
A resource can be any object that implements the interface java.lang.AutoCloseable.&lt;br /&gt;
&lt;br /&gt;
Although the try-with-resources block can have a finally or catch block, it is not mandatory.&lt;br /&gt;
&lt;br /&gt;
In our example, since Writer implements AutoCloseable, we can place it in a try-with-resources block as follows:&lt;br /&gt;
&lt;br /&gt;
    File file = new File(&amp;quot;file.txt&amp;quot;);&lt;br /&gt;
    try(Writer writer = new PrintWriter(file)) {&lt;br /&gt;
        writer.write(&amp;quot;Hello world!&amp;quot;);&lt;br /&gt;
        writer.flush();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
The code looks far more readable this way, and the developer is no longer supposed to close the resources, it is automatically done as long as the classes implement the AutoCloseable interface. Also note that the function that contains this code must throw IOException in order to compile, since there are no catch blocks.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Java Project]]&lt;br /&gt;
[[Category:Java]]&lt;br /&gt;
[[Category:Error Handling]]&lt;/div&gt;</summary>
		<author><name>Manuela Grindei</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Exception_handling_techniques&amp;diff=164410</id>
		<title>Exception handling techniques</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Exception_handling_techniques&amp;diff=164410"/>
				<updated>2013-12-08T18:04:59Z</updated>
		
		<summary type="html">&lt;p&gt;Manuela Grindei: added category&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Status==&lt;br /&gt;
Draft&lt;br /&gt;
&lt;br /&gt;
==Exceptions Overview==&lt;br /&gt;
&lt;br /&gt;
Exceptions are occurrences that alter the normal program flow. They can have various causes, such as hardware failures, resource exhaustion, programming bugs etc. When an exceptional event occurs, an exception is said to be &amp;quot;thrown.&amp;quot; The code responsible for treating the exception is called an &amp;quot;exception handler,&amp;quot; and it &amp;quot;catches&amp;quot; the thrown exception. Exception handling refers to passing the execution of a program to an appropriate exception handler when an exception occurs. For example, if a method that opens a file is called, and the file cannot be opened, the execution of that method will stop, and the code from the appropriate exception handler will be run.&lt;br /&gt;
&lt;br /&gt;
In Java, exception-handling code is cleanly separated from the exception-generating code. The try block (also called &amp;quot;guarded region&amp;quot;) is the code in which exceptions may occur, and it must be immediately followed by either a finally block or at least one catch block. In Java 7, there is a new syntactic construction, called &amp;quot;try-with-resources&amp;quot;, which is the only exception to this rule, as it is not forced to be followed by a finally or catch block.&lt;br /&gt;
&lt;br /&gt;
A finally block contains code that is always executed at some point after the try block, whether an exception was thrown or not. Even if there is a return statement in the try block, the finally block executes right after the return statement is encountered, and before the return executes. If the try block executes without exception, the finally block is executed immediately after the try block completes. If an exception was thrown, the finally block executes immediately after the &lt;br /&gt;
corresponding catch block completes. However, if the JVM exits while the try or catch code is being executed, then the finally block may not execute. Likewise, if the thread executing the try &lt;br /&gt;
or catch code is interrupted or killed, the finally block may not execute even though the application keeps running.&lt;br /&gt;
&lt;br /&gt;
==Swallowing Exceptions==&lt;br /&gt;
&lt;br /&gt;
Swallowing exceptions means to continue processing as if nothing had gone wrong even though an exception has been thrown. You catch the exception, but do nothing meaningful with it. The classical example is an empty catch block:&lt;br /&gt;
&lt;br /&gt;
    catch(Exception e) {&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
Swallowing exceptions is considered bad practice, because the ignored exception may lead the pplication to an unexpected failure, at a point in the code that bears no apparent relation to the source of the problem. Finding the cause of the failure in such cases can be very challenging and time-consuming. Merely letting an exception propagate outward can at least cause the program to fail swiftly, preserving information to aid in debugging the failure.&lt;br /&gt;
&lt;br /&gt;
In addition, in case an exception is caught, it is strongly recommended to log information about it, as it is very useful for debugging purposes.&lt;br /&gt;
&lt;br /&gt;
==Resource cleanup and finally block==&lt;br /&gt;
&lt;br /&gt;
One of the situations when exceptions may occur is when we work with resources, such as files, databases, network sockets etc. &lt;br /&gt;
&lt;br /&gt;
Opening/closing, connecting/disconnecting, read/write statements are examples of operations that may throw exceptions in particular cases. If our code needs to work with resources, it is important to release them as soon as we are finished using them.&lt;br /&gt;
&lt;br /&gt;
The following example is about writing a text in a file. The constructor, the write, the flush of the file operation can throw IOException, hence they are being placed inside the try block. We are aware that we must close the file after writing in it. A naive (and wrong) approach would be the following:&lt;br /&gt;
&lt;br /&gt;
    File file = new File(&amp;quot;file.txt&amp;quot;);&lt;br /&gt;
    Writer writer = null;&lt;br /&gt;
    try {&lt;br /&gt;
        writer = new PrintWriter(file);&lt;br /&gt;
        writer.write(&amp;quot;Hello world!&amp;quot;);&lt;br /&gt;
        writer.flush();&lt;br /&gt;
        writer.close();&lt;br /&gt;
    }&lt;br /&gt;
    catch(FileNotFoundException e) {&lt;br /&gt;
        System.err.println(&amp;quot;Caught FileNotFoundException: &amp;quot; + e.getMessage());   &lt;br /&gt;
    }&lt;br /&gt;
    catch (IOException e) {&lt;br /&gt;
        System.err.println(&amp;quot;Caught IOException: &amp;quot; + e.getMessage());&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
As you can see in the example, we close a resource inside the try block. However this is not a good practice, because if an exception is thrown before our close statement is reached, then it will not be executed and resources might thus leak. We could add the close statement in the catch block, which leads to code duplication. If we have several catch blocks, this means we have to add the close statement there. Whenever we need to add a new catch block, we must also remember to put the close statement there. This way of handling exceptions is error-prone and unnecessarily complicated.&lt;br /&gt;
&lt;br /&gt;
So where should to place the close statement? We would need a block that always gets executed, no matter if we have exceptions or not, like... finally.&lt;br /&gt;
&lt;br /&gt;
Indeed, the ideal place to release resources is the finally block. As we have seen before, finally always gets executed. This means the closing of resources will get executed even if exceptions occur, and in addition we do not have code duplication, which is mainly what we want. This approach is the best way to correctly handle the resources our code used.&lt;br /&gt;
&lt;br /&gt;
To fix the above example, a finally block was added and the file was closed there, as shown in the code below.&lt;br /&gt;
&lt;br /&gt;
    File file = new File(&amp;quot;file.txt&amp;quot;);&lt;br /&gt;
    Writer writer = null;&lt;br /&gt;
    try {&lt;br /&gt;
        writer = new PrintWriter(file);&lt;br /&gt;
        writer.write(&amp;quot;Hello world!&amp;quot;);&lt;br /&gt;
        writer.flush();&lt;br /&gt;
    }&lt;br /&gt;
    catch(FileNotFoundException e) {&lt;br /&gt;
        System.err.println(&amp;quot;Caught FileNotFoundException: &amp;quot; + e.getMessage());   &lt;br /&gt;
    }&lt;br /&gt;
    catch (IOException e) {&lt;br /&gt;
        System.err.println(&amp;quot;Caught IOException: &amp;quot; + e.getMessage());&lt;br /&gt;
    } finally {&lt;br /&gt;
        if (writer != null)&lt;br /&gt;
            try {&lt;br /&gt;
                writer.close();&lt;br /&gt;
            } catch (IOException e) {&lt;br /&gt;
                System.err.println(&amp;quot;Caught IOException: &amp;quot; + e.getMessage());&lt;br /&gt;
            }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
==Try-with-resources==&lt;br /&gt;
&lt;br /&gt;
In Java 7, resource cleanup was automated by means of the try-with-resources block. In practice, this new syntax allows you to declare resources that are part of the try block. You define the resources ahead of time and the runtime automatically closes those resources (if they are not already closed) after the execution of the try block. &lt;br /&gt;
&lt;br /&gt;
A resource can be any object that implements the interface java.lang.AutoCloseable.&lt;br /&gt;
&lt;br /&gt;
Although the try-with-resources block can have a finally or catch block, it is not mandatory.&lt;br /&gt;
&lt;br /&gt;
In our example, since Writer implements AutoCloseable, we can place it in a try-with-resources block as follows:&lt;br /&gt;
&lt;br /&gt;
    File file = new File(&amp;quot;file.txt&amp;quot;);&lt;br /&gt;
    try(Writer writer = new PrintWriter(file)) {&lt;br /&gt;
        writer.write(&amp;quot;Hello world!&amp;quot;);&lt;br /&gt;
        writer.flush();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
The code looks far more readable this way, and the developer is no longer supposed to close the resources, it is automatically done as long as the classes implement the AutoCloseable interface. Also note that the function that contains this code must throw IOException in order to compile, since there are no catch blocks.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Java Project]]&lt;br /&gt;
[[Category:Java]]&lt;br /&gt;
[[Category:Error Handling]]&lt;/div&gt;</summary>
		<author><name>Manuela Grindei</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=OWASP_Java_Table_of_Contents&amp;diff=164409</id>
		<title>OWASP Java Table of Contents</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=OWASP_Java_Table_of_Contents&amp;diff=164409"/>
				<updated>2013-12-08T17:59:37Z</updated>
		
		<summary type="html">&lt;p&gt;Manuela Grindei: updated progress&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;b&amp;gt;Key:&amp;lt;/b&amp;gt;&lt;br /&gt;
* xx%: Progress status of the paragraph&lt;br /&gt;
* &amp;lt;b&amp;gt;Review&amp;lt;/b&amp;gt;: The paragraph needs a review&lt;br /&gt;
* TD: Paragraph to be assigned&lt;br /&gt;
&lt;br /&gt;
==[[J2EE Security for Architects]]==&lt;br /&gt;
Discuss the security implications of common J2EE architectures.  This could be discussed in terms of: Authentication, Authorisation, Data Validation, Cross Site Scripting protection.  Other architecture concerns such as scalability, performance and maintainability can also be mentioned, but the focus on security should not be lost.&lt;br /&gt;
  &lt;br /&gt;
Any other security concerns that should be addressed during the design phase should also be mentioned here.&lt;br /&gt;
===Design considerations===&lt;br /&gt;
* Architectural considerations (0%, TD)&lt;br /&gt;
** EJB Middle tier (0%, TD)&lt;br /&gt;
** Web Services Middle tier (0%, TD)&lt;br /&gt;
** Spring Middle tier (0%, TD)&lt;br /&gt;
&lt;br /&gt;
==[[J2EE Security for Developers]]==&lt;br /&gt;
=== Noteworthy Frameworks ===&lt;br /&gt;
Discuss important and relevant Java security frameworks that would be useful to architects.  The information should be at a suitably high level. For example, by discussing the advantages and features as well as the associated costs (direct and indirect) of using the frameworks.&lt;br /&gt;
&lt;br /&gt;
(0%, Seeking Volunteers)&lt;br /&gt;
*	Cocoon&lt;br /&gt;
*	[[Java Server Faces]] (Sam Reghenzi - 90%, Finalising content)&lt;br /&gt;
*	JSecurity&lt;br /&gt;
*	SiteMesh&lt;br /&gt;
*	Spring (0%, Adrian San Juan, TD)&lt;br /&gt;
*	[[Struts]] (0% Jon Forck)&lt;br /&gt;
*	Tapestry&lt;br /&gt;
*	Tiles&lt;br /&gt;
*	Turbine&lt;br /&gt;
*	Webwork&lt;br /&gt;
*	[[Wicket]]&lt;br /&gt;
&lt;br /&gt;
===Java Security Basics===&lt;br /&gt;
Provide an introduction into the basic security services provided by the Java language and environment.  Remember to keep this relevant for web developers for the initial release - there may be a potential to expand this to thick clients in subsequent releases.&lt;br /&gt;
* Class Loading (0%, Philippe Clairet)&lt;br /&gt;
* Bytecode verifier (0%, Philippe Clairet)&lt;br /&gt;
* The Security Manager and security.policy file (0%, John Wilander, Philippe Clairet)&lt;br /&gt;
&lt;br /&gt;
===Input Validation Overview ===&lt;br /&gt;
Input validation is perhaps the most important category of application security. Any data entering a software system must be verified to contain safe data that is not mounting a SQL Injection, XSS, CSRF or other form of attack. This is done primarily through the use of regular expressions. It's crucial not to hard-code input validation routines. Regular expressions should contained within a configuration file that can easily updated by an InfoSec professional and not require a programmers intervention or deployment of new application code. Application security needs change over time as new attack vectors are discovered. Application administers need to be able to react to these changes as quickly as possible. &lt;br /&gt;
&lt;br /&gt;
===Input Validation ===&lt;br /&gt;
* Dangerous calls (BufferedReader.readLine(), ServletRequest.getParameter(), etc...) (0%, TD)&lt;br /&gt;
* [[How to add validation logic to HttpServletRequest]] (100%, Jeff Williams, Complete)&lt;br /&gt;
* [[How to perform HTML entity encoding in Java]] (100%, Jeff Williams, Complete)&lt;br /&gt;
&lt;br /&gt;
==== [[Preventing SQL Injection in Java]] ====&lt;br /&gt;
* Overview &lt;br /&gt;
* Prevention (60%, Stephen de Vries, &amp;lt;b&amp;gt;Review&amp;lt;/b&amp;gt;)&lt;br /&gt;
** White Listing&lt;br /&gt;
** Prepared Statements&lt;br /&gt;
** Stored Procedures &lt;br /&gt;
** Hibernate &lt;br /&gt;
** Ibatis (60%, Rohyt Belani, &amp;lt;b&amp;gt;Review&amp;lt;/b&amp;gt;)&lt;br /&gt;
** Spring JDBC &lt;br /&gt;
** EJB 3.0&lt;br /&gt;
** JDO&lt;br /&gt;
&lt;br /&gt;
==== [[Preventing LDAP Injection in Java]] ====&lt;br /&gt;
* Overview (100%, Stephen de Vries, Complete)&lt;br /&gt;
* Prevention (100%, Stephen de Vries, Complete)&lt;br /&gt;
&lt;br /&gt;
==== XPATH Injection ====&lt;br /&gt;
* [[XPATH Injection|Article n°1]] (70%, Weilin Zhong)&lt;br /&gt;
* [[XPATH Injection Java|Article n°2]] (100%, Dominique Righetto, Complete)&lt;br /&gt;
&lt;br /&gt;
==== [[Miscellaneous Injection Attacks]]  ====&lt;br /&gt;
* HTTP Response splitting (0%, TD)&lt;br /&gt;
* [[Code injection in Java]] (75%, Neil Bergman, Review)&lt;br /&gt;
* [[Command injection in Java]] - Runtime.getRuntime().exec() (100%, Neil Bergman, Review)&lt;br /&gt;
* Regular Expression (regex) Injections (20%)&lt;br /&gt;
&lt;br /&gt;
''' Status '''&lt;br /&gt;
In progress&lt;br /&gt;
&lt;br /&gt;
=== Authentication===&lt;br /&gt;
* [[Storing credentials]] - (20%, Adrian San Juan, &amp;lt;b&amp;gt;Review&amp;lt;/b&amp;gt;)&lt;br /&gt;
* [[Hashing Java|Hashing]] - (100%, Michel Prunet, &amp;lt;b&amp;gt;Review&amp;lt;/b&amp;gt;)&lt;br /&gt;
* [[SSL Best Practices]] - (20%, Philippe Curmin, &amp;lt;b&amp;gt;Review&amp;lt;/b&amp;gt;)&lt;br /&gt;
* [[Captchas in Java]] - (100%, Dave Ferguson, &amp;lt;b&amp;gt;Review&amp;lt;/b&amp;gt;) &lt;br /&gt;
* Container-managed authentication with Realms&lt;br /&gt;
** [[Declarative Access Control in Java]] - (100%, Dave Ferguson, Completed)&lt;br /&gt;
* [[JAAS Timed Login Module]] - (100%, Stephen de Vries, &amp;lt;b&amp;gt;Review&amp;lt;/b&amp;gt;)&lt;br /&gt;
* [[JAAS Tomcat Login Module]] - (100%, Stephen de Vries, &amp;lt;b&amp;gt;Review&amp;lt;/b&amp;gt;)&lt;br /&gt;
* [[Password length &amp;amp; complexity]] - (100%, Adrian San Juan, &amp;lt;b&amp;gt;Review&amp;lt;/b&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
===Session Management ===&lt;br /&gt;
The generic problems and solutions for session management are covered in the Guide.  This section should focus on Java specific examples.&lt;br /&gt;
* [[Logout]] (100%, Dominique Righetto, Complete)&lt;br /&gt;
* [[Session Timeout]] (100%, Dominique Righetto, Complete)&lt;br /&gt;
* Absolute Timeout (0%, TD)&lt;br /&gt;
* [[Session Fixation in Java]] (100%, Rohyt Belani, &amp;lt;b&amp;gt;Review&amp;lt;/b&amp;gt;)&lt;br /&gt;
* Terminating sessions (0%, TD)&lt;br /&gt;
** Terminating sessions when the browser window is closed&lt;br /&gt;
&lt;br /&gt;
===Authorization===&lt;br /&gt;
* [[Declarative v/s Programmatic]] (10%, TD)&lt;br /&gt;
* EJB Authorization (0%, TD)&lt;br /&gt;
* Acegi (0%, TD)&lt;br /&gt;
* JACC (0%, TD)&lt;br /&gt;
* Check horizontal privilege (0%, TD)&lt;br /&gt;
&lt;br /&gt;
=== Encryption===&lt;br /&gt;
* [http://www.owasp.org/index.php/Using_the_Java_Cryptographic_Extensions JCE] (100%, Joe Prasanna Kumar - To be reviewed)&lt;br /&gt;
* Storing db secrets (0%, TD)&lt;br /&gt;
* Encrypting JDBC connections (0%, TD)&lt;br /&gt;
* [http://www.owasp.org/index.php/Using_the_Java_Secure_Socket_Extensions JSSE] (100%, Joe Prasanna Kumar - To be reviewed)&lt;br /&gt;
* [http://www.owasp.org/index.php/Digital_Signature_Implementation_in_Java Digital Signatures in Java] (100%, Joe Prasanna Kumar - To be reviewed)&lt;br /&gt;
&lt;br /&gt;
=== Error Handling &amp;amp; Logging===&lt;br /&gt;
* Logging - why log? what to log? log4j, etc. (0%, TD)&lt;br /&gt;
* [[Exception handling techniques]] (90%, Manuela Grindei, In progress)&lt;br /&gt;
** fail-open/fail-closed&lt;br /&gt;
** resource cleanup&lt;br /&gt;
** finally block&lt;br /&gt;
** swallowing exceptions&lt;br /&gt;
* Exception handling frameworks (50%, TD)&lt;br /&gt;
** [[Servlet spec - web.xml]] (100%, Dominique Righetto, Complete)&lt;br /&gt;
** [[Securing tomcat]] (100%, Darren Edmonds, Completed)&lt;br /&gt;
** [[JSP errorPage]] (100%, Dominique Righetto, Complete)&lt;br /&gt;
* Web application forensics (0%, TD)&lt;br /&gt;
&lt;br /&gt;
=== Web Services Security ===&lt;br /&gt;
* SAML (0%, TD)&lt;br /&gt;
* (X)WS-Security (0%, TD)&lt;br /&gt;
* SunJWSDP (0%, TD)&lt;br /&gt;
* WSS4J (0%, Eelco Klaver)&lt;br /&gt;
* XML Signature (JSR 105) (0%, TD)&lt;br /&gt;
* XML Encryption (JSR 106) (0%, TD)&lt;br /&gt;
&lt;br /&gt;
=== Cross-Origin Resource Sharing ===&lt;br /&gt;
* [[CORS OriginHeaderScrutiny|Origin HTTP header check]] (100%, Dominique Righetto, Complete)&lt;br /&gt;
* [[CORS RequestPreflighScrutiny|Request preflight process check]] (100%, Dominique Righetto, Complete)&lt;br /&gt;
&lt;br /&gt;
=== Content Security Policy ===&lt;br /&gt;
* [[Content Security Policy|Set up in a application]] (100%, Dominique Righetto, Complete)&lt;br /&gt;
&lt;br /&gt;
=== Code Analysis Tools ===&lt;br /&gt;
The introduction should cover the advantages and short comings of code analysis tools.  An overview of the current state of the art and the available tools would go well here.  As a start, only open source tools are listed, but if vendors of commercial tools adhere to the [[Tutorial]] guidelines, these submissions will be gladly received.&lt;br /&gt;
* Introduction (0%, TD)&lt;br /&gt;
* [[:Category:OWASP LAPSE Project]] (100%, &amp;lt;b&amp;gt;Review&amp;lt;/b&amp;gt;)&lt;br /&gt;
* FindBugs (0%, TD)&lt;br /&gt;
** Creating custom rules&lt;br /&gt;
* PMD (0%, TD)&lt;br /&gt;
** Creating custom rules&lt;br /&gt;
* JLint (0%, TD)&lt;br /&gt;
* Jmetrics (0%, TD)&lt;br /&gt;
&lt;br /&gt;
=== Choosing Security Libraries ===&lt;br /&gt;
* [[Summary of Java Security Libraries]]&lt;br /&gt;
&lt;br /&gt;
== J2EE Security For Deployers ==&lt;br /&gt;
Practical step-by-step guides to securing various J2EE servers.  Examples of secure configurations can also be provided for download.  If configurations are provided, they should be properly commented so that the rationale for configuration settings is clearly explained.  Users of the configurations should be provided with enough information to make their own risk decisions.&lt;br /&gt;
=== Securing Popular J2EE Servers ===&lt;br /&gt;
* [[Securing tomcat|Securing Tomcat]] - (100%, Darren Edmonds, Completed)&lt;br /&gt;
* Securing JBoss (0%, TD)&lt;br /&gt;
* Securing WebLogic (0%, TD)&lt;br /&gt;
* Securing WebSphere (0%, TD)&lt;br /&gt;
* Others...&lt;br /&gt;
&lt;br /&gt;
=== Defining a Java Security Policy ===&lt;br /&gt;
Practical information on creating a Java security policies for J2EE servers.&lt;br /&gt;
* PolicyTool - JChains already provides this functionality, one policy tool is enough.&lt;br /&gt;
* jChains (www.jchains.org) - (0%, TD)&lt;br /&gt;
&lt;br /&gt;
=== Protecting Binaries ===&lt;br /&gt;
* Bytecode manipulation tools and techniques (0%, TD)&lt;br /&gt;
* [[Bytecode obfuscation]] (100%, Pierre Parrend, Released)&lt;br /&gt;
* Convert bytecode to native machine code (0%, TD)&lt;br /&gt;
* [[Protecting code archives with digital signatures]] (100%, Pierre Parrend, Released)&lt;br /&gt;
* [[Signing jar files with jarsigner]] (100%, Pierre Parrend, Released)&lt;br /&gt;
&lt;br /&gt;
==J2EE Security for Security Analysts and Testers==&lt;br /&gt;
* Using Eclipse to verify Java applications (0%, TD)&lt;br /&gt;
* Using [[:Category:OWASP WebScarab Project|WebScarab]] to find vulnerabilities in J2EE applications - (0%, TD)&lt;br /&gt;
* [[Decompiling Java bytecode]] (100%, Dominique Righetto, Complete)&lt;br /&gt;
&lt;br /&gt;
== [[Java Security Resources]] (ongoing)==&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Java Project]]&lt;/div&gt;</summary>
		<author><name>Manuela Grindei</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Exception_handling_techniques&amp;diff=164408</id>
		<title>Exception handling techniques</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Exception_handling_techniques&amp;diff=164408"/>
				<updated>2013-12-08T17:58:25Z</updated>
		
		<summary type="html">&lt;p&gt;Manuela Grindei: first version of Exceptions Tutorial&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Status==&lt;br /&gt;
Draft&lt;br /&gt;
&lt;br /&gt;
==Exceptions Overview==&lt;br /&gt;
&lt;br /&gt;
Exceptions are occurrences that alter the normal program flow. They can have various causes, such as hardware failures, resource exhaustion, programming bugs etc. When an exceptional event occurs, an exception is said to be &amp;quot;thrown.&amp;quot; The code responsible for treating the exception is called an &amp;quot;exception handler,&amp;quot; and it &amp;quot;catches&amp;quot; the thrown exception. Exception handling refers to passing the execution of a program to an appropriate exception handler when an exception occurs. For example, if a method that opens a file is called, and the file cannot be opened, the execution of that method will stop, and the code from the appropriate exception handler will be run.&lt;br /&gt;
&lt;br /&gt;
In Java, exception-handling code is cleanly separated from the exception-generating code. The try block (also called &amp;quot;guarded region&amp;quot;) is the code in which exceptions may occur, and it must be immediately followed by either a finally block or at least one catch block. In Java 7, there is a new syntactic construction, called &amp;quot;try-with-resources&amp;quot;, which is the only exception to this rule, as it is not forced to be followed by a finally or catch block.&lt;br /&gt;
&lt;br /&gt;
A finally block contains code that is always executed at some point after the try block, whether an exception was thrown or not. Even if there is a return statement in the try block, the finally block executes right after the return statement is encountered, and before the return executes. If the try block executes without exception, the finally block is executed immediately after the try block completes. If an exception was thrown, the finally block executes immediately after the &lt;br /&gt;
corresponding catch block completes. However, if the JVM exits while the try or catch code is being executed, then the finally block may not execute. Likewise, if the thread executing the try &lt;br /&gt;
or catch code is interrupted or killed, the finally block may not execute even though the application keeps running.&lt;br /&gt;
&lt;br /&gt;
==Swallowing Exceptions==&lt;br /&gt;
&lt;br /&gt;
Swallowing exceptions means to continue processing as if nothing had gone wrong even though an exception has been thrown. You catch the exception, but do nothing meaningful with it. The classical example is an empty catch block:&lt;br /&gt;
&lt;br /&gt;
    catch(Exception e) {&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
Swallowing exceptions is considered bad practice, because the ignored exception may lead the pplication to an unexpected failure, at a point in the code that bears no apparent relation to the source of the problem. Finding the cause of the failure in such cases can be very challenging and time-consuming. Merely letting an exception propagate outward can at least cause the program to fail swiftly, preserving information to aid in debugging the failure.&lt;br /&gt;
&lt;br /&gt;
In addition, in case an exception is caught, it is strongly recommended to log information about it, as it is very useful for debugging purposes.&lt;br /&gt;
&lt;br /&gt;
==Resource cleanup and finally block==&lt;br /&gt;
&lt;br /&gt;
One of the situations when exceptions may occur is when we work with resources, such as files, databases, network sockets etc. &lt;br /&gt;
&lt;br /&gt;
Opening/closing, connecting/disconnecting, read/write statements are examples of operations that may throw exceptions in particular cases. If our code needs to work with resources, it is important to release them as soon as we are finished using them.&lt;br /&gt;
&lt;br /&gt;
The following example is about writing a text in a file. The constructor, the write, the flush of the file operation can throw IOException, hence they are being placed inside the try block. We are aware that we must close the file after writing in it. A naive (and wrong) approach would be the following:&lt;br /&gt;
&lt;br /&gt;
    File file = new File(&amp;quot;file.txt&amp;quot;);&lt;br /&gt;
    Writer writer = null;&lt;br /&gt;
    try {&lt;br /&gt;
        writer = new PrintWriter(file);&lt;br /&gt;
        writer.write(&amp;quot;Hello world!&amp;quot;);&lt;br /&gt;
        writer.flush();&lt;br /&gt;
        writer.close();&lt;br /&gt;
    }&lt;br /&gt;
    catch(FileNotFoundException e) {&lt;br /&gt;
        System.err.println(&amp;quot;Caught FileNotFoundException: &amp;quot; + e.getMessage());   &lt;br /&gt;
    }&lt;br /&gt;
    catch (IOException e) {&lt;br /&gt;
        System.err.println(&amp;quot;Caught IOException: &amp;quot; + e.getMessage());&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
As you can see in the example, we close a resource inside the try block. However this is not a good practice, because if an exception is thrown before our close statement is reached, then it will not be executed and resources might thus leak. We could add the close statement in the catch block, which leads to code duplication. If we have several catch blocks, this means we have to add the close statement there. Whenever we need to add a new catch block, we must also remember to put the close statement there. This way of handling exceptions is error-prone and unnecessarily complicated.&lt;br /&gt;
&lt;br /&gt;
So where should to place the close statement? We would need a block that always gets executed, no matter if we have exceptions or not, like... finally.&lt;br /&gt;
&lt;br /&gt;
Indeed, the ideal place to release resources is the finally block. As we have seen before, finally always gets executed. This means the closing of resources will get executed even if exceptions occur, and in addition we do not have code duplication, which is mainly what we want. This approach is the best way to correctly handle the resources our code used.&lt;br /&gt;
&lt;br /&gt;
To fix the above example, a finally block was added and the file was closed there, as shown in the code below.&lt;br /&gt;
&lt;br /&gt;
    File file = new File(&amp;quot;file.txt&amp;quot;);&lt;br /&gt;
    Writer writer = null;&lt;br /&gt;
    try {&lt;br /&gt;
        writer = new PrintWriter(file);&lt;br /&gt;
        writer.write(&amp;quot;Hello world!&amp;quot;);&lt;br /&gt;
        writer.flush();&lt;br /&gt;
    }&lt;br /&gt;
    catch(FileNotFoundException e) {&lt;br /&gt;
        System.err.println(&amp;quot;Caught FileNotFoundException: &amp;quot; + e.getMessage());   &lt;br /&gt;
    }&lt;br /&gt;
    catch (IOException e) {&lt;br /&gt;
        System.err.println(&amp;quot;Caught IOException: &amp;quot; + e.getMessage());&lt;br /&gt;
    } finally {&lt;br /&gt;
        if (writer != null)&lt;br /&gt;
            try {&lt;br /&gt;
                writer.close();&lt;br /&gt;
            } catch (IOException e) {&lt;br /&gt;
                System.err.println(&amp;quot;Caught IOException: &amp;quot; + e.getMessage());&lt;br /&gt;
            }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
==Try-with-resources==&lt;br /&gt;
&lt;br /&gt;
In Java 7, resource cleanup was automated by means of the try-with-resources block. In practice, this new syntax allows you to declare resources that are part of the try block. You define the resources ahead of time and the runtime automatically closes those resources (if they are not already closed) after the execution of the try block. &lt;br /&gt;
&lt;br /&gt;
A resource can be any object that implements the interface java.lang.AutoCloseable.&lt;br /&gt;
&lt;br /&gt;
Although the try-with-resources block can have a finally or catch block, it is not mandatory.&lt;br /&gt;
&lt;br /&gt;
In our example, since Writer implements AutoCloseable, we can place it in a try-with-resources block as follows:&lt;br /&gt;
&lt;br /&gt;
    File file = new File(&amp;quot;file.txt&amp;quot;);&lt;br /&gt;
    try(Writer writer = new PrintWriter(file)) {&lt;br /&gt;
        writer.write(&amp;quot;Hello world!&amp;quot;);&lt;br /&gt;
        writer.flush();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
The code looks far more readable this way, and the developer is no longer supposed to close the resources, it is automatically done as long as the classes implement the AutoCloseable interface. Also note that the function that contains this code must throw IOException in order to compile, since there are no catch blocks.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Java Project]]&lt;br /&gt;
[[Category:Java]]&lt;/div&gt;</summary>
		<author><name>Manuela Grindei</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=OWASP_Java_Table_of_Contents&amp;diff=164407</id>
		<title>OWASP Java Table of Contents</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=OWASP_Java_Table_of_Contents&amp;diff=164407"/>
				<updated>2013-12-08T17:41:51Z</updated>
		
		<summary type="html">&lt;p&gt;Manuela Grindei: added link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;b&amp;gt;Key:&amp;lt;/b&amp;gt;&lt;br /&gt;
* xx%: Progress status of the paragraph&lt;br /&gt;
* &amp;lt;b&amp;gt;Review&amp;lt;/b&amp;gt;: The paragraph needs a review&lt;br /&gt;
* TD: Paragraph to be assigned&lt;br /&gt;
&lt;br /&gt;
==[[J2EE Security for Architects]]==&lt;br /&gt;
Discuss the security implications of common J2EE architectures.  This could be discussed in terms of: Authentication, Authorisation, Data Validation, Cross Site Scripting protection.  Other architecture concerns such as scalability, performance and maintainability can also be mentioned, but the focus on security should not be lost.&lt;br /&gt;
  &lt;br /&gt;
Any other security concerns that should be addressed during the design phase should also be mentioned here.&lt;br /&gt;
===Design considerations===&lt;br /&gt;
* Architectural considerations (0%, TD)&lt;br /&gt;
** EJB Middle tier (0%, TD)&lt;br /&gt;
** Web Services Middle tier (0%, TD)&lt;br /&gt;
** Spring Middle tier (0%, TD)&lt;br /&gt;
&lt;br /&gt;
==[[J2EE Security for Developers]]==&lt;br /&gt;
=== Noteworthy Frameworks ===&lt;br /&gt;
Discuss important and relevant Java security frameworks that would be useful to architects.  The information should be at a suitably high level. For example, by discussing the advantages and features as well as the associated costs (direct and indirect) of using the frameworks.&lt;br /&gt;
&lt;br /&gt;
(0%, Seeking Volunteers)&lt;br /&gt;
*	Cocoon&lt;br /&gt;
*	[[Java Server Faces]] (Sam Reghenzi - 90%, Finalising content)&lt;br /&gt;
*	JSecurity&lt;br /&gt;
*	SiteMesh&lt;br /&gt;
*	Spring (0%, Adrian San Juan, TD)&lt;br /&gt;
*	[[Struts]] (0% Jon Forck)&lt;br /&gt;
*	Tapestry&lt;br /&gt;
*	Tiles&lt;br /&gt;
*	Turbine&lt;br /&gt;
*	Webwork&lt;br /&gt;
*	[[Wicket]]&lt;br /&gt;
&lt;br /&gt;
===Java Security Basics===&lt;br /&gt;
Provide an introduction into the basic security services provided by the Java language and environment.  Remember to keep this relevant for web developers for the initial release - there may be a potential to expand this to thick clients in subsequent releases.&lt;br /&gt;
* Class Loading (0%, Philippe Clairet)&lt;br /&gt;
* Bytecode verifier (0%, Philippe Clairet)&lt;br /&gt;
* The Security Manager and security.policy file (0%, John Wilander, Philippe Clairet)&lt;br /&gt;
&lt;br /&gt;
===Input Validation Overview ===&lt;br /&gt;
Input validation is perhaps the most important category of application security. Any data entering a software system must be verified to contain safe data that is not mounting a SQL Injection, XSS, CSRF or other form of attack. This is done primarily through the use of regular expressions. It's crucial not to hard-code input validation routines. Regular expressions should contained within a configuration file that can easily updated by an InfoSec professional and not require a programmers intervention or deployment of new application code. Application security needs change over time as new attack vectors are discovered. Application administers need to be able to react to these changes as quickly as possible. &lt;br /&gt;
&lt;br /&gt;
===Input Validation ===&lt;br /&gt;
* Dangerous calls (BufferedReader.readLine(), ServletRequest.getParameter(), etc...) (0%, TD)&lt;br /&gt;
* [[How to add validation logic to HttpServletRequest]] (100%, Jeff Williams, Complete)&lt;br /&gt;
* [[How to perform HTML entity encoding in Java]] (100%, Jeff Williams, Complete)&lt;br /&gt;
&lt;br /&gt;
==== [[Preventing SQL Injection in Java]] ====&lt;br /&gt;
* Overview &lt;br /&gt;
* Prevention (60%, Stephen de Vries, &amp;lt;b&amp;gt;Review&amp;lt;/b&amp;gt;)&lt;br /&gt;
** White Listing&lt;br /&gt;
** Prepared Statements&lt;br /&gt;
** Stored Procedures &lt;br /&gt;
** Hibernate &lt;br /&gt;
** Ibatis (60%, Rohyt Belani, &amp;lt;b&amp;gt;Review&amp;lt;/b&amp;gt;)&lt;br /&gt;
** Spring JDBC &lt;br /&gt;
** EJB 3.0&lt;br /&gt;
** JDO&lt;br /&gt;
&lt;br /&gt;
==== [[Preventing LDAP Injection in Java]] ====&lt;br /&gt;
* Overview (100%, Stephen de Vries, Complete)&lt;br /&gt;
* Prevention (100%, Stephen de Vries, Complete)&lt;br /&gt;
&lt;br /&gt;
==== XPATH Injection ====&lt;br /&gt;
* [[XPATH Injection|Article n°1]] (70%, Weilin Zhong)&lt;br /&gt;
* [[XPATH Injection Java|Article n°2]] (100%, Dominique Righetto, Complete)&lt;br /&gt;
&lt;br /&gt;
==== [[Miscellaneous Injection Attacks]]  ====&lt;br /&gt;
* HTTP Response splitting (0%, TD)&lt;br /&gt;
* [[Code injection in Java]] (75%, Neil Bergman, Review)&lt;br /&gt;
* [[Command injection in Java]] - Runtime.getRuntime().exec() (100%, Neil Bergman, Review)&lt;br /&gt;
* Regular Expression (regex) Injections (20%)&lt;br /&gt;
&lt;br /&gt;
''' Status '''&lt;br /&gt;
In progress&lt;br /&gt;
&lt;br /&gt;
=== Authentication===&lt;br /&gt;
* [[Storing credentials]] - (20%, Adrian San Juan, &amp;lt;b&amp;gt;Review&amp;lt;/b&amp;gt;)&lt;br /&gt;
* [[Hashing Java|Hashing]] - (100%, Michel Prunet, &amp;lt;b&amp;gt;Review&amp;lt;/b&amp;gt;)&lt;br /&gt;
* [[SSL Best Practices]] - (20%, Philippe Curmin, &amp;lt;b&amp;gt;Review&amp;lt;/b&amp;gt;)&lt;br /&gt;
* [[Captchas in Java]] - (100%, Dave Ferguson, &amp;lt;b&amp;gt;Review&amp;lt;/b&amp;gt;) &lt;br /&gt;
* Container-managed authentication with Realms&lt;br /&gt;
** [[Declarative Access Control in Java]] - (100%, Dave Ferguson, Completed)&lt;br /&gt;
* [[JAAS Timed Login Module]] - (100%, Stephen de Vries, &amp;lt;b&amp;gt;Review&amp;lt;/b&amp;gt;)&lt;br /&gt;
* [[JAAS Tomcat Login Module]] - (100%, Stephen de Vries, &amp;lt;b&amp;gt;Review&amp;lt;/b&amp;gt;)&lt;br /&gt;
* [[Password length &amp;amp; complexity]] - (100%, Adrian San Juan, &amp;lt;b&amp;gt;Review&amp;lt;/b&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
===Session Management ===&lt;br /&gt;
The generic problems and solutions for session management are covered in the Guide.  This section should focus on Java specific examples.&lt;br /&gt;
* [[Logout]] (100%, Dominique Righetto, Complete)&lt;br /&gt;
* [[Session Timeout]] (100%, Dominique Righetto, Complete)&lt;br /&gt;
* Absolute Timeout (0%, TD)&lt;br /&gt;
* [[Session Fixation in Java]] (100%, Rohyt Belani, &amp;lt;b&amp;gt;Review&amp;lt;/b&amp;gt;)&lt;br /&gt;
* Terminating sessions (0%, TD)&lt;br /&gt;
** Terminating sessions when the browser window is closed&lt;br /&gt;
&lt;br /&gt;
===Authorization===&lt;br /&gt;
* [[Declarative v/s Programmatic]] (10%, TD)&lt;br /&gt;
* EJB Authorization (0%, TD)&lt;br /&gt;
* Acegi (0%, TD)&lt;br /&gt;
* JACC (0%, TD)&lt;br /&gt;
* Check horizontal privilege (0%, TD)&lt;br /&gt;
&lt;br /&gt;
=== Encryption===&lt;br /&gt;
* [http://www.owasp.org/index.php/Using_the_Java_Cryptographic_Extensions JCE] (100%, Joe Prasanna Kumar - To be reviewed)&lt;br /&gt;
* Storing db secrets (0%, TD)&lt;br /&gt;
* Encrypting JDBC connections (0%, TD)&lt;br /&gt;
* [http://www.owasp.org/index.php/Using_the_Java_Secure_Socket_Extensions JSSE] (100%, Joe Prasanna Kumar - To be reviewed)&lt;br /&gt;
* [http://www.owasp.org/index.php/Digital_Signature_Implementation_in_Java Digital Signatures in Java] (100%, Joe Prasanna Kumar - To be reviewed)&lt;br /&gt;
&lt;br /&gt;
=== Error Handling &amp;amp; Logging===&lt;br /&gt;
* Logging - why log? what to log? log4j, etc. (0%, TD)&lt;br /&gt;
* [[Exception handling techniques]] (20%, Manuela Grindei, In progress)&lt;br /&gt;
** fail-open/fail-closed&lt;br /&gt;
** resource cleanup&lt;br /&gt;
** finally block&lt;br /&gt;
** swallowing exceptions&lt;br /&gt;
* Exception handling frameworks (50%, TD)&lt;br /&gt;
** [[Servlet spec - web.xml]] (100%, Dominique Righetto, Complete)&lt;br /&gt;
** [[Securing tomcat]] (100%, Darren Edmonds, Completed)&lt;br /&gt;
** [[JSP errorPage]] (100%, Dominique Righetto, Complete)&lt;br /&gt;
* Web application forensics (0%, TD)&lt;br /&gt;
&lt;br /&gt;
=== Web Services Security ===&lt;br /&gt;
* SAML (0%, TD)&lt;br /&gt;
* (X)WS-Security (0%, TD)&lt;br /&gt;
* SunJWSDP (0%, TD)&lt;br /&gt;
* WSS4J (0%, Eelco Klaver)&lt;br /&gt;
* XML Signature (JSR 105) (0%, TD)&lt;br /&gt;
* XML Encryption (JSR 106) (0%, TD)&lt;br /&gt;
&lt;br /&gt;
=== Cross-Origin Resource Sharing ===&lt;br /&gt;
* [[CORS OriginHeaderScrutiny|Origin HTTP header check]] (100%, Dominique Righetto, Complete)&lt;br /&gt;
* [[CORS RequestPreflighScrutiny|Request preflight process check]] (100%, Dominique Righetto, Complete)&lt;br /&gt;
&lt;br /&gt;
=== Content Security Policy ===&lt;br /&gt;
* [[Content Security Policy|Set up in a application]] (100%, Dominique Righetto, Complete)&lt;br /&gt;
&lt;br /&gt;
=== Code Analysis Tools ===&lt;br /&gt;
The introduction should cover the advantages and short comings of code analysis tools.  An overview of the current state of the art and the available tools would go well here.  As a start, only open source tools are listed, but if vendors of commercial tools adhere to the [[Tutorial]] guidelines, these submissions will be gladly received.&lt;br /&gt;
* Introduction (0%, TD)&lt;br /&gt;
* [[:Category:OWASP LAPSE Project]] (100%, &amp;lt;b&amp;gt;Review&amp;lt;/b&amp;gt;)&lt;br /&gt;
* FindBugs (0%, TD)&lt;br /&gt;
** Creating custom rules&lt;br /&gt;
* PMD (0%, TD)&lt;br /&gt;
** Creating custom rules&lt;br /&gt;
* JLint (0%, TD)&lt;br /&gt;
* Jmetrics (0%, TD)&lt;br /&gt;
&lt;br /&gt;
=== Choosing Security Libraries ===&lt;br /&gt;
* [[Summary of Java Security Libraries]]&lt;br /&gt;
&lt;br /&gt;
== J2EE Security For Deployers ==&lt;br /&gt;
Practical step-by-step guides to securing various J2EE servers.  Examples of secure configurations can also be provided for download.  If configurations are provided, they should be properly commented so that the rationale for configuration settings is clearly explained.  Users of the configurations should be provided with enough information to make their own risk decisions.&lt;br /&gt;
=== Securing Popular J2EE Servers ===&lt;br /&gt;
* [[Securing tomcat|Securing Tomcat]] - (100%, Darren Edmonds, Completed)&lt;br /&gt;
* Securing JBoss (0%, TD)&lt;br /&gt;
* Securing WebLogic (0%, TD)&lt;br /&gt;
* Securing WebSphere (0%, TD)&lt;br /&gt;
* Others...&lt;br /&gt;
&lt;br /&gt;
=== Defining a Java Security Policy ===&lt;br /&gt;
Practical information on creating a Java security policies for J2EE servers.&lt;br /&gt;
* PolicyTool - JChains already provides this functionality, one policy tool is enough.&lt;br /&gt;
* jChains (www.jchains.org) - (0%, TD)&lt;br /&gt;
&lt;br /&gt;
=== Protecting Binaries ===&lt;br /&gt;
* Bytecode manipulation tools and techniques (0%, TD)&lt;br /&gt;
* [[Bytecode obfuscation]] (100%, Pierre Parrend, Released)&lt;br /&gt;
* Convert bytecode to native machine code (0%, TD)&lt;br /&gt;
* [[Protecting code archives with digital signatures]] (100%, Pierre Parrend, Released)&lt;br /&gt;
* [[Signing jar files with jarsigner]] (100%, Pierre Parrend, Released)&lt;br /&gt;
&lt;br /&gt;
==J2EE Security for Security Analysts and Testers==&lt;br /&gt;
* Using Eclipse to verify Java applications (0%, TD)&lt;br /&gt;
* Using [[:Category:OWASP WebScarab Project|WebScarab]] to find vulnerabilities in J2EE applications - (0%, TD)&lt;br /&gt;
* [[Decompiling Java bytecode]] (100%, Dominique Righetto, Complete)&lt;br /&gt;
&lt;br /&gt;
== [[Java Security Resources]] (ongoing)==&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Java Project]]&lt;/div&gt;</summary>
		<author><name>Manuela Grindei</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=OWASP_Java_Table_of_Contents&amp;diff=163463</id>
		<title>OWASP Java Table of Contents</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=OWASP_Java_Table_of_Contents&amp;diff=163463"/>
				<updated>2013-11-17T14:23:21Z</updated>
		
		<summary type="html">&lt;p&gt;Manuela Grindei: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;b&amp;gt;Key:&amp;lt;/b&amp;gt;&lt;br /&gt;
* xx%: Progress status of the paragraph&lt;br /&gt;
* &amp;lt;b&amp;gt;Review&amp;lt;/b&amp;gt;: The paragraph needs a review&lt;br /&gt;
* TD: Paragraph to be assigned&lt;br /&gt;
&lt;br /&gt;
==[[J2EE Security for Architects]]==&lt;br /&gt;
Discuss the security implications of common J2EE architectures.  This could be discussed in terms of: Authentication, Authorisation, Data Validation, Cross Site Scripting protection.  Other architecture concerns such as scalability, performance and maintainability can also be mentioned, but the focus on security should not be lost.&lt;br /&gt;
  &lt;br /&gt;
Any other security concerns that should be addressed during the design phase should also be mentioned here.&lt;br /&gt;
===Design considerations===&lt;br /&gt;
* Architectural considerations (0%, TD)&lt;br /&gt;
** EJB Middle tier (0%, TD)&lt;br /&gt;
** Web Services Middle tier (0%, TD)&lt;br /&gt;
** Spring Middle tier (0%, TD)&lt;br /&gt;
&lt;br /&gt;
==[[J2EE Security for Developers]]==&lt;br /&gt;
=== Noteworthy Frameworks ===&lt;br /&gt;
Discuss important and relevant Java security frameworks that would be useful to architects.  The information should be at a suitably high level. For example, by discussing the advantages and features as well as the associated costs (direct and indirect) of using the frameworks.&lt;br /&gt;
&lt;br /&gt;
(0%, Seeking Volunteers)&lt;br /&gt;
*	Cocoon&lt;br /&gt;
*	[[Java Server Faces]] (Sam Reghenzi - 90%, Finalising content)&lt;br /&gt;
*	JSecurity&lt;br /&gt;
*	SiteMesh&lt;br /&gt;
*	Spring (0%, Adrian San Juan, TD)&lt;br /&gt;
*	[[Struts]] (0% Jon Forck)&lt;br /&gt;
*	Tapestry&lt;br /&gt;
*	Tiles&lt;br /&gt;
*	Turbine&lt;br /&gt;
*	Webwork&lt;br /&gt;
*	[[Wicket]]&lt;br /&gt;
&lt;br /&gt;
===Java Security Basics===&lt;br /&gt;
Provide an introduction into the basic security services provided by the Java language and environment.  Remember to keep this relevant for web developers for the initial release - there may be a potential to expand this to thick clients in subsequent releases.&lt;br /&gt;
* Class Loading (0%, Philippe Clairet)&lt;br /&gt;
* Bytecode verifier (0%, Philippe Clairet)&lt;br /&gt;
* The Security Manager and security.policy file (0%, John Wilander, Philippe Clairet)&lt;br /&gt;
&lt;br /&gt;
===Input Validation Overview ===&lt;br /&gt;
Input validation is perhaps the most important category of application security. Any data entering a software system must be verified to contain safe data that is not mounting a SQL Injection, XSS, CSRF or other form of attack. This is done primarily through the use of regular expressions. It's crucial not to hard-code input validation routines. Regular expressions should contained within a configuration file that can easily updated by an InfoSec professional and not require a programmers intervention or deployment of new application code. Application security needs change over time as new attack vectors are discovered. Application administers need to be able to react to these changes as quickly as possible. &lt;br /&gt;
&lt;br /&gt;
===Input Validation ===&lt;br /&gt;
* Dangerous calls (BufferedReader.readLine(), ServletRequest.getParameter(), etc...) (0%, TD)&lt;br /&gt;
* [[How to add validation logic to HttpServletRequest]] (100%, Jeff Williams, Complete)&lt;br /&gt;
* [[How to perform HTML entity encoding in Java]] (100%, Jeff Williams, Complete)&lt;br /&gt;
&lt;br /&gt;
==== [[Preventing SQL Injection in Java]] ====&lt;br /&gt;
* Overview &lt;br /&gt;
* Prevention (60%, Stephen de Vries, &amp;lt;b&amp;gt;Review&amp;lt;/b&amp;gt;)&lt;br /&gt;
** White Listing&lt;br /&gt;
** Prepared Statements&lt;br /&gt;
** Stored Procedures &lt;br /&gt;
** Hibernate &lt;br /&gt;
** Ibatis (60%, Rohyt Belani, &amp;lt;b&amp;gt;Review&amp;lt;/b&amp;gt;)&lt;br /&gt;
** Spring JDBC &lt;br /&gt;
** EJB 3.0&lt;br /&gt;
** JDO&lt;br /&gt;
&lt;br /&gt;
==== [[Preventing LDAP Injection in Java]] ====&lt;br /&gt;
* Overview (100%, Stephen de Vries, Complete)&lt;br /&gt;
* Prevention (100%, Stephen de Vries, Complete)&lt;br /&gt;
&lt;br /&gt;
==== XPATH Injection ====&lt;br /&gt;
* [[XPATH Injection|Article n°1]] (70%, Weilin Zhong)&lt;br /&gt;
* [[XPATH Injection Java|Article n°2]] (100%, Dominique Righetto, Complete)&lt;br /&gt;
&lt;br /&gt;
==== [[Miscellaneous Injection Attacks]]  ====&lt;br /&gt;
* HTTP Response splitting (0%, TD)&lt;br /&gt;
* [[Code injection in Java]] (75%, Neil Bergman, Review)&lt;br /&gt;
* [[Command injection in Java]] - Runtime.getRuntime().exec() (100%, Neil Bergman, Review)&lt;br /&gt;
* Regular Expression (regex) Injections (20%)&lt;br /&gt;
&lt;br /&gt;
''' Status '''&lt;br /&gt;
In progress&lt;br /&gt;
&lt;br /&gt;
=== Authentication===&lt;br /&gt;
* [[Storing credentials]] - (20%, Adrian San Juan, &amp;lt;b&amp;gt;Review&amp;lt;/b&amp;gt;)&lt;br /&gt;
* [[Hashing Java|Hashing]] - (100%, Michel Prunet, &amp;lt;b&amp;gt;Review&amp;lt;/b&amp;gt;)&lt;br /&gt;
* [[SSL Best Practices]] - (20%, Philippe Curmin, &amp;lt;b&amp;gt;Review&amp;lt;/b&amp;gt;)&lt;br /&gt;
* [[Captchas in Java]] - (100%, Dave Ferguson, &amp;lt;b&amp;gt;Review&amp;lt;/b&amp;gt;) &lt;br /&gt;
* Container-managed authentication with Realms&lt;br /&gt;
** [[Declarative Access Control in Java]] - (100%, Dave Ferguson, Completed)&lt;br /&gt;
* [[JAAS Timed Login Module]] - (100%, Stephen de Vries, &amp;lt;b&amp;gt;Review&amp;lt;/b&amp;gt;)&lt;br /&gt;
* [[JAAS Tomcat Login Module]] - (100%, Stephen de Vries, &amp;lt;b&amp;gt;Review&amp;lt;/b&amp;gt;)&lt;br /&gt;
* [[Password length &amp;amp; complexity]] - (100%, Adrian San Juan, &amp;lt;b&amp;gt;Review&amp;lt;/b&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
===Session Management ===&lt;br /&gt;
The generic problems and solutions for session management are covered in the Guide.  This section should focus on Java specific examples.&lt;br /&gt;
* [[Logout]] (100%, Dominique Righetto, Complete)&lt;br /&gt;
* [[Session Timeout]] (100%, Dominique Righetto, Complete)&lt;br /&gt;
* Absolute Timeout (0%, TD)&lt;br /&gt;
* [[Session Fixation in Java]] (100%, Rohyt Belani, &amp;lt;b&amp;gt;Review&amp;lt;/b&amp;gt;)&lt;br /&gt;
* Terminating sessions (0%, TD)&lt;br /&gt;
** Terminating sessions when the browser window is closed&lt;br /&gt;
&lt;br /&gt;
===Authorization===&lt;br /&gt;
* [[Declarative v/s Programmatic]] (10%, TD)&lt;br /&gt;
* EJB Authorization (0%, TD)&lt;br /&gt;
* Acegi (0%, TD)&lt;br /&gt;
* JACC (0%, TD)&lt;br /&gt;
* Check horizontal privilege (0%, TD)&lt;br /&gt;
&lt;br /&gt;
=== Encryption===&lt;br /&gt;
* [http://www.owasp.org/index.php/Using_the_Java_Cryptographic_Extensions JCE] (100%, Joe Prasanna Kumar - To be reviewed)&lt;br /&gt;
* Storing db secrets (0%, TD)&lt;br /&gt;
* Encrypting JDBC connections (0%, TD)&lt;br /&gt;
* [http://www.owasp.org/index.php/Using_the_Java_Secure_Socket_Extensions JSSE] (100%, Joe Prasanna Kumar - To be reviewed)&lt;br /&gt;
* [http://www.owasp.org/index.php/Digital_Signature_Implementation_in_Java Digital Signatures in Java] (100%, Joe Prasanna Kumar - To be reviewed)&lt;br /&gt;
&lt;br /&gt;
=== Error Handling &amp;amp; Logging===&lt;br /&gt;
* Logging - why log? what to log? log4j, etc. (0%, TD)&lt;br /&gt;
* Exception handling techniques (20%, Manuela Grindei, In progress)&lt;br /&gt;
** fail-open/fail-closed&lt;br /&gt;
** resource cleanup&lt;br /&gt;
** finally block&lt;br /&gt;
** swallowing exceptions&lt;br /&gt;
* Exception handling frameworks (50%, TD)&lt;br /&gt;
** [[Servlet spec - web.xml]] (100%, Dominique Righetto, Complete)&lt;br /&gt;
** [[Securing tomcat]] (100%, Darren Edmonds, Completed)&lt;br /&gt;
** [[JSP errorPage]] (100%, Dominique Righetto, Complete)&lt;br /&gt;
* Web application forensics (0%, TD)&lt;br /&gt;
&lt;br /&gt;
=== Web Services Security ===&lt;br /&gt;
* SAML (0%, TD)&lt;br /&gt;
* (X)WS-Security (0%, TD)&lt;br /&gt;
* SunJWSDP (0%, TD)&lt;br /&gt;
* WSS4J (0%, Eelco Klaver)&lt;br /&gt;
* XML Signature (JSR 105) (0%, TD)&lt;br /&gt;
* XML Encryption (JSR 106) (0%, TD)&lt;br /&gt;
&lt;br /&gt;
=== Cross-Origin Resource Sharing ===&lt;br /&gt;
* [[CORS OriginHeaderScrutiny|Origin HTTP header check]] (100%, Dominique Righetto, Complete)&lt;br /&gt;
* [[CORS RequestPreflighScrutiny|Request preflight process check]] (100%, Dominique Righetto, Complete)&lt;br /&gt;
&lt;br /&gt;
=== Content Security Policy ===&lt;br /&gt;
* [[Content Security Policy|Set up in a application]] (100%, Dominique Righetto, Complete)&lt;br /&gt;
&lt;br /&gt;
=== Code Analysis Tools ===&lt;br /&gt;
The introduction should cover the advantages and short comings of code analysis tools.  An overview of the current state of the art and the available tools would go well here.  As a start, only open source tools are listed, but if vendors of commercial tools adhere to the [[Tutorial]] guidelines, these submissions will be gladly received.&lt;br /&gt;
* Introduction (0%, TD)&lt;br /&gt;
* [[:Category:OWASP LAPSE Project]] (100%, &amp;lt;b&amp;gt;Review&amp;lt;/b&amp;gt;)&lt;br /&gt;
* FindBugs (0%, TD)&lt;br /&gt;
** Creating custom rules&lt;br /&gt;
* PMD (0%, TD)&lt;br /&gt;
** Creating custom rules&lt;br /&gt;
* JLint (0%, TD)&lt;br /&gt;
* Jmetrics (0%, TD)&lt;br /&gt;
&lt;br /&gt;
=== Choosing Security Libraries ===&lt;br /&gt;
* [[Summary of Java Security Libraries]]&lt;br /&gt;
&lt;br /&gt;
== J2EE Security For Deployers ==&lt;br /&gt;
Practical step-by-step guides to securing various J2EE servers.  Examples of secure configurations can also be provided for download.  If configurations are provided, they should be properly commented so that the rationale for configuration settings is clearly explained.  Users of the configurations should be provided with enough information to make their own risk decisions.&lt;br /&gt;
=== Securing Popular J2EE Servers ===&lt;br /&gt;
* [[Securing tomcat|Securing Tomcat]] - (100%, Darren Edmonds, Completed)&lt;br /&gt;
* Securing JBoss (0%, TD)&lt;br /&gt;
* Securing WebLogic (0%, TD)&lt;br /&gt;
* Securing WebSphere (0%, TD)&lt;br /&gt;
* Others...&lt;br /&gt;
&lt;br /&gt;
=== Defining a Java Security Policy ===&lt;br /&gt;
Practical information on creating a Java security policies for J2EE servers.&lt;br /&gt;
* PolicyTool - JChains already provides this functionality, one policy tool is enough.&lt;br /&gt;
* jChains (www.jchains.org) - (0%, TD)&lt;br /&gt;
&lt;br /&gt;
=== Protecting Binaries ===&lt;br /&gt;
* Bytecode manipulation tools and techniques (0%, TD)&lt;br /&gt;
* [[Bytecode obfuscation]] (100%, Pierre Parrend, Released)&lt;br /&gt;
* Convert bytecode to native machine code (0%, TD)&lt;br /&gt;
* [[Protecting code archives with digital signatures]] (100%, Pierre Parrend, Released)&lt;br /&gt;
* [[Signing jar files with jarsigner]] (100%, Pierre Parrend, Released)&lt;br /&gt;
&lt;br /&gt;
==J2EE Security for Security Analysts and Testers==&lt;br /&gt;
* Using Eclipse to verify Java applications (0%, TD)&lt;br /&gt;
* Using [[:Category:OWASP WebScarab Project|WebScarab]] to find vulnerabilities in J2EE applications - (0%, TD)&lt;br /&gt;
* [[Decompiling Java bytecode]] (100%, Dominique Righetto, Complete)&lt;br /&gt;
&lt;br /&gt;
== [[Java Security Resources]] (ongoing)==&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Java Project]]&lt;/div&gt;</summary>
		<author><name>Manuela Grindei</name></author>	</entry>

	</feed>