<?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=Jerry+Kickenson</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=Jerry+Kickenson"/>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php/Special:Contributions/Jerry_Kickenson"/>
		<updated>2026-05-29T19:46:43Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.27.2</generator>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=CRV2_SecDepConfig&amp;diff=165224</id>
		<title>CRV2 SecDepConfig</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=CRV2_SecDepConfig&amp;diff=165224"/>
				<updated>2013-12-31T18:03:59Z</updated>
		
		<summary type="html">&lt;p&gt;Jerry Kickenson: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Secure Deployment Configuration ==&lt;br /&gt;
Web applications do not execute in isolation.  They typically are deployed within an application server framework, running within an operating system on a physical host, within a network.  &lt;br /&gt;
&lt;br /&gt;
Secure operating system configuration (also called hardening) is not typically within the scope of code review.  For more information, see the [http://benchmarks.cisecurity.org/downloads/browse/index.cfm?category=benchmarks.os Center for Internet Security operating system benchmarks].&lt;br /&gt;
&lt;br /&gt;
Networks today consist of much more than routers and switches providing transport services.  Filtering switches, VLANs (virtual LANs), firewalls, WAFs (Web Application Firewall), and various middle boxes (e.g. reverse proxies, intrusion detection and prevention systems) all provide critical security services when configured to do so.   This is a big topic, but outside the scope of this web application code review guide.  For a good summary, see the SANS (System Administration, Networking, and Security) Institute [http://www.sans.org/critical-security-controls/control.php?id=10 Critical Control 10: Secure Configurations for Network Devices such as Firewalls, Routers, and Switches].&lt;br /&gt;
&lt;br /&gt;
Application server frameworks have many security related capabilities.  These capabilities are enabled and configured  declaratively.  Declarative configuration is usually done via static configuration files, typically in XML format, but may also be expressed as annotations within the code.&lt;br /&gt;
&lt;br /&gt;
Some security capabilities are accessible from within a Java program.  Programmatic security is done within the web application, using framework specific or standard Java EE APIs.&lt;br /&gt;
&lt;br /&gt;
=== Declarative Configuration ===&lt;br /&gt;
&lt;br /&gt;
When implemented using the Java Enterprise Edition (JEE) framework, the [http://docs.oracle.com/javaee/6/tutorial/doc/bnbwk.html JEE security model] may be used.  JEE uses a role-based security model, in which access to application resources is granted based on the security role. The security role is a logical grouping of principals (authenticated entities, usually a user), and access is declared by specifying a ''security constraint'' on the role.&lt;br /&gt;
&lt;br /&gt;
==== Deployment Descriptor Configuration ====&lt;br /&gt;
The constraints and roles are expressed as ''deployment descriptors'' expressed as XML elements.  Different types of components use different formats, or schemas, for their deployment descriptors:&lt;br /&gt;
&lt;br /&gt;
* Web components may use a web application deployment descriptor in the file ''web.xml''&lt;br /&gt;
* Enterprise JavaBeans components may use an EJB deployment descriptor named ''META-INF/ejb-jar.xml''&lt;br /&gt;
&lt;br /&gt;
In summary, the deployment descriptor can define resources (e.g. servlets accessible via a specific URL), which roles are authorized to access the resource, and how access is constrained (e.g. via GET but not POST).  &lt;br /&gt;
&lt;br /&gt;
The following example web component descriptor, included in the &amp;quot;web.xml&amp;quot; file, defines a Catalog servlet, a &amp;quot;manager&amp;quot; role, a SalesInfo resource within the servlet accessible via GET and POST requests, and specifies that only users with &amp;quot;manager&amp;quot; role, using SSL and successfully using HTTP basic authentication should be granted access:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;ISO-8859-1&amp;quot;?&amp;gt;&lt;br /&gt;
 &amp;lt;web-app xmlns=&amp;quot;http://java.sun.com/xml/ns/j2ee&amp;quot;&lt;br /&gt;
   xmlns:xsi=&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot;&lt;br /&gt;
   xsi:schemaLocation=&amp;quot;http://java.sun.com/xml/ns/j2ee&lt;br /&gt;
    http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd&amp;quot; version=?2.5?&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
     &amp;lt;display-name&amp;gt;A Secure Application&amp;lt;/display-name&amp;gt;&lt;br /&gt;
     &amp;lt;servlet&amp;gt;&lt;br /&gt;
       &amp;lt;servlet-name&amp;gt;catalog&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;
       &amp;lt;servlet-class&amp;gt;com.mycorp.CatalogServlet&amp;lt;/servlet-class&amp;gt;&lt;br /&gt;
       &amp;lt;init-param&amp;gt;&lt;br /&gt;
         &amp;lt;param-name&amp;gt;catalog&amp;lt;/param-name&amp;gt;&lt;br /&gt;
         &amp;lt;param-value&amp;gt;Spring&amp;lt;/param-value&amp;gt;&lt;br /&gt;
       &amp;lt;/init-param&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
       &amp;lt;nowiki&amp;gt;&amp;lt;!-- Define Security Roles --&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
       &amp;lt;security-role-ref&amp;gt;&lt;br /&gt;
         &amp;lt;role-name&amp;gt;MGR&amp;lt;/role-name&amp;gt;&lt;br /&gt;
         &amp;lt;!-- role name used in code --&amp;gt;&lt;br /&gt;
         &amp;lt;role-link&amp;gt;manager&amp;lt;/role-link&amp;gt;&lt;br /&gt;
       &amp;lt;/security-role-ref&amp;gt;&lt;br /&gt;
     &amp;lt;/servlet&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
     &amp;lt;security-role&amp;gt;&lt;br /&gt;
       &amp;lt;role-name&amp;gt;manager&amp;lt;/role-name&amp;gt;&lt;br /&gt;
     &amp;lt;/security-role&amp;gt;&lt;br /&gt;
     &amp;lt;servlet-mapping&amp;gt;&lt;br /&gt;
       &amp;lt;servlet-name&amp;gt;catalog&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;
       &amp;lt;url-pattern&amp;gt;/catalog/*&amp;lt;/url-pattern&amp;gt;&lt;br /&gt;
     &amp;lt;/servlet-mapping&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
     &amp;lt;nowiki&amp;gt;&amp;lt;!-- Define A Security Constraint --&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
     &amp;lt;security-constraint&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
     &amp;lt;nowiki&amp;gt;&amp;lt;!-- Specify the Resources to be Protected --&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
     &amp;lt;web-resource-collection&amp;gt;&lt;br /&gt;
       &amp;lt;web-resource-name&amp;gt;SalesInfo&amp;lt;/web-resource-name&amp;gt;&lt;br /&gt;
       &amp;lt;url-pattern&amp;gt;/salesinfo/*&amp;lt;/url-pattern&amp;gt;&lt;br /&gt;
       &amp;lt;http-method&amp;gt;GET&amp;lt;/http-method&amp;gt;&lt;br /&gt;
       &amp;lt;http-method&amp;gt;POST&amp;lt;/http-method&amp;gt;&lt;br /&gt;
      &amp;lt;/web-resource-collection&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
     &amp;lt;nowiki&amp;gt;&amp;lt;!-- Specify which Users Can Access Protected Resources --&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
     &amp;lt;auth-constraint&amp;gt;&lt;br /&gt;
       &amp;lt;role-name&amp;gt;manager&amp;lt;/role-name&amp;gt;&lt;br /&gt;
     &amp;lt;/auth-constraint&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
     &amp;lt;nowiki&amp;gt;&amp;lt;!-- Specify Secure Transport using SSL (confidential guarantee) --&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
     &amp;lt;user-data-constraint&amp;gt;&lt;br /&gt;
       &amp;lt;transport-guarantee&amp;gt;CONFIDENTIAL&amp;lt;/transport-guarantee&amp;gt;&lt;br /&gt;
     &amp;lt;/user-data-constraint&amp;gt;&lt;br /&gt;
     &amp;lt;/security-constraint&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
     &amp;lt;nowiki&amp;gt;&amp;lt;!-- Specify HTTP Basic Authentication Method --&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
     &amp;lt;login-config&amp;gt;&lt;br /&gt;
       &amp;lt;auth-method&amp;gt;BASIC&amp;lt;/auth-method&amp;gt;&lt;br /&gt;
       &amp;lt;realm-name&amp;gt;file&amp;lt;/realm-name&amp;gt;&lt;br /&gt;
     &amp;lt;/login-config&amp;gt;&lt;br /&gt;
 &amp;lt;/web-app&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Security roles can also be declared for enterprise Java beans in the &amp;quot;ejb-jar.xml&amp;quot; file.  For example:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;!-- A sample ejb-jar.xml fragment --&amp;gt;&lt;br /&gt;
  &amp;lt;ejb-jar&amp;gt;&lt;br /&gt;
     &amp;lt;!-- ... --&amp;gt;&lt;br /&gt;
     &amp;lt;assembly-descriptor&amp;gt;&lt;br /&gt;
         &amp;lt;security-role&amp;gt;&lt;br /&gt;
             &amp;lt;description&amp;gt;The single application role&amp;lt;/description&amp;gt;&lt;br /&gt;
             &amp;lt;role-name&amp;gt;TheApplicationRole&amp;lt;/role-name&amp;gt;&lt;br /&gt;
         &amp;lt;/security-role&amp;gt;&lt;br /&gt;
     &amp;lt;/assembly-descriptor&amp;gt;&lt;br /&gt;
 &amp;lt;/ejb-jar&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For beans, however, rather than specifying access to resources within servlets, access to bean methods is specified.  The following example illustrates several types of method access constraints for several beans:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;ejb-jar&amp;gt;&lt;br /&gt;
     &amp;lt;assembly-descriptor&amp;gt;&lt;br /&gt;
         &amp;lt;method-permission&amp;gt;&lt;br /&gt;
             &amp;lt;description&amp;gt;The employee and temp-employee roles may access any&lt;br /&gt;
                 method of the EmployeeService bean &amp;lt;/description&amp;gt;&lt;br /&gt;
             &amp;lt;role-name&amp;gt;employee&amp;lt;/role-name&amp;gt;&lt;br /&gt;
             &amp;lt;role-name&amp;gt;temp-employee&amp;lt;/role-name&amp;gt;&lt;br /&gt;
             &amp;lt;method&amp;gt;&lt;br /&gt;
                 &amp;lt;ejb-name&amp;gt;EmployeeService&amp;lt;/ejb-name&amp;gt;&lt;br /&gt;
                 &amp;lt;method-name&amp;gt;*&amp;lt;/method-name&amp;gt;&lt;br /&gt;
             &amp;lt;/method&amp;gt;&lt;br /&gt;
         &amp;lt;/method-permission&amp;gt;&lt;br /&gt;
         &amp;lt;method-permission&amp;gt;&lt;br /&gt;
             &amp;lt;description&amp;gt;The employee role may access the findByPrimaryKey,&lt;br /&gt;
                 getEmployeeInfo, and the updateEmployeeInfo(String) method of&lt;br /&gt;
                 the AardvarkPayroll bean &amp;lt;/description&amp;gt;&lt;br /&gt;
             &amp;lt;role-name&amp;gt;employee&amp;lt;/role-name&amp;gt;&lt;br /&gt;
             &amp;lt;method&amp;gt;&lt;br /&gt;
                 &amp;lt;ejb-name&amp;gt;AardvarkPayroll&amp;lt;/ejb-name&amp;gt;&lt;br /&gt;
                 &amp;lt;method-name&amp;gt;findByPrimaryKey&amp;lt;/method-name&amp;gt;&lt;br /&gt;
             &amp;lt;/method&amp;gt;&lt;br /&gt;
             &amp;lt;method&amp;gt;&lt;br /&gt;
                 &amp;lt;ejb-name&amp;gt;AardvarkPayroll&amp;lt;/ejb-name&amp;gt;&lt;br /&gt;
                 &amp;lt;method-name&amp;gt;getEmployeeInfo&amp;lt;/method-name&amp;gt;&lt;br /&gt;
             &amp;lt;/method&amp;gt;&lt;br /&gt;
             &amp;lt;method&amp;gt;&lt;br /&gt;
                 &amp;lt;ejb-name&amp;gt;AardvarkPayroll&amp;lt;/ejb-name&amp;gt;&lt;br /&gt;
                 &amp;lt;method-name&amp;gt;updateEmployeeInfo&amp;lt;/method-name&amp;gt;&lt;br /&gt;
                 &amp;lt;method-params&amp;gt;&lt;br /&gt;
                     &amp;lt;method-param&amp;gt;java.lang.String&amp;lt;/method-param&amp;gt;&lt;br /&gt;
                 &amp;lt;/method-params&amp;gt;&lt;br /&gt;
             &amp;lt;/method&amp;gt;&lt;br /&gt;
         &amp;lt;/method-permission&amp;gt;&lt;br /&gt;
         &amp;lt;method-permission&amp;gt;&lt;br /&gt;
             &amp;lt;description&amp;gt;The admin role may access any method of the&lt;br /&gt;
                 EmployeeServiceAdmin bean &amp;lt;/description&amp;gt;&lt;br /&gt;
             &amp;lt;role-name&amp;gt;admin&amp;lt;/role-name&amp;gt;&lt;br /&gt;
             &amp;lt;method&amp;gt;&lt;br /&gt;
                 &amp;lt;ejb-name&amp;gt;EmployeeServiceAdmin&amp;lt;/ejb-name&amp;gt;&lt;br /&gt;
                 &amp;lt;method-name&amp;gt;*&amp;lt;/method-name&amp;gt;&lt;br /&gt;
             &amp;lt;/method&amp;gt;&lt;br /&gt;
         &amp;lt;/method-permission&amp;gt;&lt;br /&gt;
         &amp;lt;method-permission&amp;gt;&lt;br /&gt;
             &amp;lt;description&amp;gt;Any authenticated user may access any method of the&lt;br /&gt;
                 EmployeeServiceHelp bean&amp;lt;/description&amp;gt;&lt;br /&gt;
             &amp;lt;unchecked/&amp;gt;&lt;br /&gt;
             &amp;lt;method&amp;gt;&lt;br /&gt;
                 &amp;lt;ejb-name&amp;gt;EmployeeServiceHelp&amp;lt;/ejb-name&amp;gt;&lt;br /&gt;
                 &amp;lt;method-name&amp;gt;*&amp;lt;/method-name&amp;gt;&lt;br /&gt;
             &amp;lt;/method&amp;gt;&lt;br /&gt;
         &amp;lt;/method-permission&amp;gt;&lt;br /&gt;
         &amp;lt;exclude-list&amp;gt;&lt;br /&gt;
             &amp;lt;description&amp;gt;No fireTheCTO methods of the EmployeeFiring bean may be&lt;br /&gt;
                 used in this deployment&amp;lt;/description&amp;gt;&lt;br /&gt;
             &amp;lt;method&amp;gt;&lt;br /&gt;
                 &amp;lt;ejb-name&amp;gt;EmployeeFiring&amp;lt;/ejb-name&amp;gt;&lt;br /&gt;
                 &amp;lt;method-name&amp;gt;fireTheCTO&amp;lt;/method-name&amp;gt;&lt;br /&gt;
             &amp;lt;/method&amp;gt;&lt;br /&gt;
         &amp;lt;/exclude-list&amp;gt;&lt;br /&gt;
     &amp;lt;/assembly-descriptor&amp;gt;&lt;br /&gt;
 &amp;lt;/ejb-jar&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 Source: [https://access.redhat.com/site/documentation/en-US/JBoss_Enterprise_Application_Platform_Common_Criteria_Certification/5/html/Security_Guide/index.html JBoss Enterprise Application Platform Common Criteria Certification 5]&lt;br /&gt;
              [https://access.redhat.com/site/documentation/en-US/JBoss_Enterprise_Application_Platform_Common_Criteria_Certification/5/html/Security_Guide/index.html Security Guide]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If XML deployment descriptors are used to secure the application, code review should include the &amp;quot;web.xml&amp;quot; and &amp;quot;ejb-jar.xml&amp;quot; files to ensure that access controls are properly applied to the correct roles, and authentication methods are as expected.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Annotations ====&lt;br /&gt;
JEE annotations for security are defined in the [http://docs.oracle.com/javaee/6/api/javax/annotation/security/package-summary.html javax.annotation.security] package.  The available annotations are:&lt;br /&gt;
&lt;br /&gt;
 @DeclareRoles&lt;br /&gt;
 @DenyAll - no roles may invoke the method&lt;br /&gt;
 @PermitAll - all roles may invoke the method&lt;br /&gt;
 @RolesAllowed - roles permitted to invoke the method&lt;br /&gt;
 @RunAs - dynamically run the method as a particular role&lt;br /&gt;
&lt;br /&gt;
For example, the following code snippet allows employees and managers to add movies to the persistent store, anyone to list movies, but only managers may delete movies:&lt;br /&gt;
&lt;br /&gt;
 public class Movies {&lt;br /&gt;
 &lt;br /&gt;
     private EntityManager entityManager;&lt;br /&gt;
 &lt;br /&gt;
     @RolesAllowed({&amp;quot;Employee&amp;quot;, &amp;quot;Manager&amp;quot;})&lt;br /&gt;
     public void addMovie(Movie movie) throws Exception {&lt;br /&gt;
         entityManager.persist(movie);&lt;br /&gt;
     }&lt;br /&gt;
 &lt;br /&gt;
     @RolesAllowed({&amp;quot;Manager&amp;quot;})&lt;br /&gt;
     public void deleteMovie(Movie movie) throws Exception {&lt;br /&gt;
         entityManager.remove(movie);&lt;br /&gt;
     }&lt;br /&gt;
 &lt;br /&gt;
     @PermitAll&lt;br /&gt;
     public List&amp;lt;Movie&amp;gt; getMovies() throws Exception {&lt;br /&gt;
         Query query = entityManager.createQuery(&amp;quot;SELECT m from Movie as m&amp;quot;);&lt;br /&gt;
         return query.getResultList();&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Code review should look for such annotations.  If present, ensure they reflect the correct roles and permissions, and are consistent with any declared role permissions in the &amp;quot;ejb-jar.xml&amp;quot; file.&lt;br /&gt;
&lt;br /&gt;
==== Framework Specific Configuration ====&lt;br /&gt;
Some application server frameworks offer additional or enhanced security configurations.  Consult the documentation for the particular framework you are using.  Information on some of the more common frameworks follow.&lt;br /&gt;
&lt;br /&gt;
===== Apache Tomcat =====&lt;br /&gt;
The [http://tomcat.apache.org/tomcat-7.0-doc/security-howto.html#server.xml Tomcat server.xml] file defines many security related parameters:&lt;br /&gt;
&lt;br /&gt;
* Server - shutdown port&lt;br /&gt;
* Connectors - maxPostSize, maxParameterCount, server, SSLEnabled, secure, ciphers&lt;br /&gt;
* Host - autoDeploy, deployOnStartup, deployXML&lt;br /&gt;
* Context - crossContext, privileged, allowLinking&lt;br /&gt;
* Filter - Tomcat provides a number of ''filters'' which may be configured to incoming requests&lt;br /&gt;
&lt;br /&gt;
Filters are especially powerful, and a code review should validate they are used unless there is a compelling reason not to.  See [http://tomcat.apache.org/tomcat-7.0-doc/config/filter.html Container Provided Filters] for detailed information.&lt;br /&gt;
&lt;br /&gt;
The server.xml file should be reviewed to ensure security related parameters are configured as expected.&lt;br /&gt;
&lt;br /&gt;
More guidelines on securely deploying Apache Tomcat can be found in the [http://benchmarks.cisecurity.org/downloads/show-single/?file=tomcat.100 CIS Apache Tomcat 5.5/6.x Server Benchmark v1.0.0].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== Jetty =====&lt;br /&gt;
Jetty adds several security enhancements:&lt;br /&gt;
&lt;br /&gt;
* Limiting form content&lt;br /&gt;
* Obfuscating passwords&lt;br /&gt;
&lt;br /&gt;
The maximum form content size and number of form keys can be configured at server and web application level in the &amp;quot;jetty-web.xml&amp;quot; file:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;Configure class=&amp;quot;org.eclipse.jetty.webapp.WebAppContext&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
   ...&lt;br /&gt;
   &lt;br /&gt;
   &amp;lt;Set name=&amp;quot;maxFormContentSize&amp;quot;&amp;gt;200000&amp;lt;/Set&amp;gt;&lt;br /&gt;
   &amp;lt;Set name=&amp;quot;maxFormKeys&amp;quot;&amp;gt;200&amp;lt;/Set&amp;gt;&lt;br /&gt;
 &amp;lt;/Configure&amp;gt;    &lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;configure class=&amp;quot;org.eclipse.jetty.server.Server&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
   ...&lt;br /&gt;
  &lt;br /&gt;
   &amp;lt;Call name=&amp;quot;setAttribute&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;Arg&amp;gt;org.eclipse.jetty.server.Request.maxFormContentSize&amp;lt;/Arg&amp;gt;&lt;br /&gt;
     &amp;lt;Arg&amp;gt;100000&amp;lt;/Arg&amp;gt;&lt;br /&gt;
    &amp;lt;/Call&amp;gt;&lt;br /&gt;
   &amp;lt;Call name=&amp;quot;setAttribute&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;Arg&amp;gt;org.eclipse.jetty.server.Request.maxFormKeys&amp;lt;/Arg&amp;gt;&lt;br /&gt;
     &amp;lt;Arg&amp;gt;2000&amp;lt;/Arg&amp;gt;&lt;br /&gt;
    &amp;lt;/Call&amp;gt;&lt;br /&gt;
 &amp;lt;/configure&amp;gt;      &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Jetty also supports the use of obfuscated passwords in jetty XML files where a plain text password is usually needed. Here's an example setting the password for a JDBC Datasource with obfuscation (the obfuscated password is generated by Jetty org.eclipse.jetty.util.security.Password utility):&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;New id=&amp;quot;DSTest&amp;quot; class=&amp;quot;org.eclipse.jetty.plus.jndi.Resource&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Arg&amp;gt;&amp;lt;/Arg&amp;gt;&lt;br /&gt;
    &amp;lt;Arg&amp;gt;jdbc/DSTest&amp;lt;/Arg&amp;gt;&lt;br /&gt;
    &amp;lt;Arg&amp;gt;&lt;br /&gt;
      &amp;lt;New class=&amp;quot;com.jolbox.bonecp.BoneCPDataSource&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Set name=&amp;quot;driverClass&amp;quot;&amp;gt;com.mysql.jdbc.Driver&amp;lt;/Set&amp;gt;&lt;br /&gt;
        &amp;lt;Set name=&amp;quot;jdbcUrl&amp;quot;&amp;gt;jdbc:mysql://localhost:3306/foo&amp;lt;/Set&amp;gt;&lt;br /&gt;
        &amp;lt;Set name=&amp;quot;username&amp;quot;&amp;gt;dbuser&amp;lt;/Set&amp;gt;&lt;br /&gt;
        '''&amp;lt;Set name=&amp;quot;password&amp;quot;&amp;gt;'''&lt;br /&gt;
           '''&amp;lt;Call class=&amp;quot;org.eclipse.jetty.util.security.Password&amp;quot; name=&amp;quot;deobfuscate&amp;quot;&amp;gt;'''&lt;br /&gt;
                 '''&amp;lt;Arg&amp;gt;OBF:1ri71v1r1v2n1ri71shq1ri71shs1ri71v1r1v2n1ri7&amp;lt;/Arg&amp;gt;'''&lt;br /&gt;
           '''&amp;lt;/Call&amp;gt;'''&lt;br /&gt;
        '''&amp;lt;/Set&amp;gt;'''&lt;br /&gt;
        &amp;lt;Set name=&amp;quot;minConnectionsPerPartition&amp;quot;&amp;gt;5&amp;lt;/Set&amp;gt;&lt;br /&gt;
        &amp;lt;Set name=&amp;quot;maxConnectionsPerPartition&amp;quot;&amp;gt;50&amp;lt;/Set&amp;gt;&lt;br /&gt;
        &amp;lt;Set name=&amp;quot;acquireIncrement&amp;quot;&amp;gt;5&amp;lt;/Set&amp;gt;&lt;br /&gt;
        &amp;lt;Set name=&amp;quot;idleConnectionTestPeriod&amp;quot;&amp;gt;30&amp;lt;/Set&amp;gt;&lt;br /&gt;
     &amp;lt;/New&amp;gt;&lt;br /&gt;
   &amp;lt;/Arg&amp;gt;&lt;br /&gt;
 &amp;lt;/New&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====JBoss AS =====&lt;br /&gt;
JBoss Application Server, like Jetty, allows password obfuscation (called password masking in JBoss) in its XML configuration files.  After using JBoss password utility to create password mask, replace any occurrence of a masked password in XML configuration files with the following annotation:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;annotation&amp;gt;@org.jboss.security.integration.password.Password&lt;br /&gt;
                      (securityDomain=MASK_NAME,methodName=setPROPERTY_NAME)&lt;br /&gt;
 &amp;lt;/annotation&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See [http://docs.jboss.org/jbosssecurity/docs/6.0/security_guide/html_single/#Masking_Passwords Masking Passwords in XML Configuration] in the [http://docs.jboss.org/jbosssecurity/docs/6.0/security_guide/html_single/ JBoss AS Security Guide].&lt;br /&gt;
&lt;br /&gt;
===== Oracle WebLogic =====&lt;br /&gt;
WebLogic server supports additional deployment descriptors in the &amp;quot;weblogic.xml&amp;quot; file:&lt;br /&gt;
&lt;br /&gt;
* externally-defined - role to principal mappings are externally defined in WebLogic Admin Console&lt;br /&gt;
* run-as-principal-name - assign a principal to a role when running as that role&lt;br /&gt;
* run-as-role-assignment - contains the run-as-principal-name descriptor&lt;br /&gt;
* security-permission - contains security-permission-spec descriptor&lt;br /&gt;
* security-permission-spec - specify application permissions as per [http://docs.oracle.com/javase/1.5.0/docs/guide/security/PolicyFiles.html#FileSyntax Java policy file syntax]&lt;br /&gt;
* security-role-assignment - explicitly assign principals to a role&lt;br /&gt;
&lt;br /&gt;
More information on WebLogic additional deployment descriptors may be found at [http://docs.oracle.com/cd/E11035_01/wls100/security/thin_client.html#wp1046262 weblogic.xml Deployment Descriptors].&lt;br /&gt;
&lt;br /&gt;
For general guidelines on securing web applications running within WebLogic, see [http://docs.oracle.com/cd/E11035_01/wls100/security/ Programming WebLogic Security] and the NSA's [http://www.nsa.gov/ia/_files/webs/I33-004R-2005.pdf BEA WebLogic Platform Security Guide].&lt;br /&gt;
&lt;br /&gt;
===== Microsoft IIS =====&lt;br /&gt;
Microsoft Internet Information Server is not based on a JEE framework.  Security features can be configured in IIS using the Web.config (application level) or ApplicationHost.config (server level) file, in the &amp;lt;system.webServer&amp;gt;&amp;lt;security&amp;gt; section.  The types of features that may be configured include:&lt;br /&gt;
&lt;br /&gt;
* Permitted authentication methods&lt;br /&gt;
* Authorization rules&lt;br /&gt;
* Request filters and limits&lt;br /&gt;
* Use of SSL&lt;br /&gt;
* Source IP address filtering&lt;br /&gt;
&lt;br /&gt;
The Web.config and ApplicationHost.config files should be included in code review.  The &amp;lt;system.webServer&amp;gt;&amp;lt;security&amp;gt; sections should be reviewed to ensure all security configuration is as expected.&lt;br /&gt;
&lt;br /&gt;
For guidelines on securing the overall configuration of Microsoft IIS, see the [http://benchmarks.cisecurity.org/downloads/show-single/?file=iis7.130 CIS Microsoft IIS 7 Benchmark v1.3.0].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
======Authentication Methods======&lt;br /&gt;
IIS supports basic, client certificate, digest, IIS client certificate, and Windows authentication methods.   It is configured in the &amp;lt;system.webServer&amp;gt;&amp;lt;security&amp;gt;&amp;lt;authentication&amp;gt; section.  The following example disables Anonymous authentication for a site named MySite, then enables both Basic authentication and Windows authentication for the site:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;location path=&amp;quot;MySite&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;system.webServer&amp;gt;&lt;br /&gt;
       &amp;lt;security&amp;gt;&lt;br /&gt;
          &amp;lt;authentication&amp;gt;&lt;br /&gt;
             &amp;lt;anonymousAuthentication enabled=&amp;quot;false&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;basicAuthentication enabled=&amp;quot;true&amp;quot; defaultLogonDomain=&amp;quot;MySite&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;windowsAuthentication enabled=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
           &amp;lt;/authentication&amp;gt;&lt;br /&gt;
       &amp;lt;/security&amp;gt;&lt;br /&gt;
    &amp;lt;/system.webServer&amp;gt;&lt;br /&gt;
 &amp;lt;/location&amp;gt;&lt;br /&gt;
&lt;br /&gt;
======Authorization======&lt;br /&gt;
IIS authorization configuration allows specification of users access to the site or server.  It is configured in the &amp;lt;system.webServer&amp;gt;&amp;lt;security&amp;gt;&amp;lt;authorization&amp;gt; section.  The following example removes the default IIS authorization settings, which allows all users access to Web site or application content, and then configures an authorization rule that allows only users with administrator privileges to access the content:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;configuration&amp;gt;&lt;br /&gt;
    &amp;lt;system.webServer&amp;gt;&lt;br /&gt;
       &amp;lt;security&amp;gt;&lt;br /&gt;
          &amp;lt;authorization&amp;gt;&lt;br /&gt;
             &amp;lt;remove users=&amp;quot;*&amp;quot; roles=&amp;quot;&amp;quot; verbs=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;add accessType=&amp;quot;Allow&amp;quot; users=&amp;quot;&amp;quot; roles=&amp;quot;Administrators&amp;quot; /&amp;gt;&lt;br /&gt;
          &amp;lt;/authorization&amp;gt;&lt;br /&gt;
       &amp;lt;/security&amp;gt;&lt;br /&gt;
    &amp;lt;/system.webServer&amp;gt;&lt;br /&gt;
 &amp;lt;/configuration&amp;gt;&lt;br /&gt;
&lt;br /&gt;
======Request Filters and Limits======&lt;br /&gt;
IIS supports filtering, including enforcing limits, on incoming HTTP requests.  The following may be configured:&lt;br /&gt;
&lt;br /&gt;
* denyUrlSequences - list of prohibited URL patterns&lt;br /&gt;
* fileExtensions - allowed or prohibited file extensions&lt;br /&gt;
* hiddenSegments - URLs that cannot be browsed&lt;br /&gt;
* requestLimits - URL, content, query string, and HTTP header length limits&lt;br /&gt;
* verbs - allowed or prohibited verbs&lt;br /&gt;
* alwaysAllowedUrls - URLs always permitted&lt;br /&gt;
* alwaysAllowedQueryStrings - query strings always allowed&lt;br /&gt;
* denyQueryStringSequences - prohibited query strings&lt;br /&gt;
* filteringRules - custom filtering rules &lt;br /&gt;
&lt;br /&gt;
It is configured in the &amp;lt;system.webServer&amp;gt;&amp;lt;security&amp;gt;&amp;lt;requestFiltering&amp;gt; section.  The following example&lt;br /&gt;
&lt;br /&gt;
* Denies access to two URL sequences. The first sequence prevents directory transversal and the second sequence prevents access to alternate data streams.&lt;br /&gt;
* Denies access to unlisted file name extensions and unlisted HTTP verbs.&lt;br /&gt;
* Sets the maximum length for a URL to 2KB and the maximum length for a query string to 1KB.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;configuration&amp;gt;&lt;br /&gt;
    &amp;lt;system.webServer&amp;gt;&lt;br /&gt;
       &amp;lt;security&amp;gt;&lt;br /&gt;
          &amp;lt;requestFiltering&amp;gt;&lt;br /&gt;
             &amp;lt;denyUrlSequences&amp;gt;&lt;br /&gt;
                &amp;lt;add sequence=&amp;quot;..&amp;quot; /&amp;gt;&lt;br /&gt;
                &amp;lt;add sequence=&amp;quot;:&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/denyUrlSequences&amp;gt;&lt;br /&gt;
             &amp;lt;fileExtensions allowUnlisted=&amp;quot;false&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;requestLimits maxUrl=&amp;quot;2048&amp;quot; maxQueryString=&amp;quot;1024&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;verbs allowUnlisted=&amp;quot;false&amp;quot; /&amp;gt;&lt;br /&gt;
          &amp;lt;/requestFiltering&amp;gt;&lt;br /&gt;
       &amp;lt;/security&amp;gt;&lt;br /&gt;
    &amp;lt;/system.webServer&amp;gt;&lt;br /&gt;
 &amp;lt;/configuration&amp;gt;&lt;br /&gt;
&lt;br /&gt;
======Use of SSL======&lt;br /&gt;
IIS allows specifying whether SSL is supported, is required, whether client authentication is supported or required, and cipher strength.   It is configured in the &amp;lt;system.webServer&amp;gt;&amp;lt;security&amp;gt;&amp;lt;access&amp;gt; section.  The following example specifies SSL as required for all connections to the site MySite:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;location path=&amp;quot;MySite&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;system.webServer&amp;gt;&lt;br /&gt;
       &amp;lt;security&amp;gt;&lt;br /&gt;
          &amp;lt;access sslFlags=&amp;quot;ssl&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;/security&amp;gt;&lt;br /&gt;
    &amp;lt;/system.webServer&amp;gt;&lt;br /&gt;
 &amp;lt;/location&amp;gt;&lt;br /&gt;
&lt;br /&gt;
======Source IP address filtering======&lt;br /&gt;
IIS allows restrictions on source IP addresses or DNS names.  It is configured in the &amp;lt;system.webServer&amp;gt;&amp;lt;security&amp;gt;&amp;lt;ipSecurity&amp;gt; section.  The following example denies access to the IP address 192.168.100.1 and to the entire 169.254.0.0 network:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;location path=&amp;quot;Default Web Site&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;system.webServer&amp;gt;&lt;br /&gt;
       &amp;lt;security&amp;gt;&lt;br /&gt;
          &amp;lt;ipSecurity&amp;gt;&lt;br /&gt;
             &amp;lt;add ipAddress=&amp;quot;192.168.100.1&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;add ipAddress=&amp;quot;169.254.0.0&amp;quot; subnetMask=&amp;quot;255.255.0.0&amp;quot; /&amp;gt;&lt;br /&gt;
          &amp;lt;/ipSecurity&amp;gt;&lt;br /&gt;
       &amp;lt;/security&amp;gt;&lt;br /&gt;
    &amp;lt;/system.webServer&amp;gt;&lt;br /&gt;
 &amp;lt;/location&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Detailed information on IIS security configuration can be found at  [http://www.iis.net/configreference/system.webserver/security IIS Security Configuration].  Specific security feature configuration information can be found at [http://www.iis.net/configreference/system.webserver/security/authentication Authentication], [http://www.iis.net/configreference/system.webserver/security/authorization Authorization], [http://www.iis.net/configreference/system.webserver/security/access#001 SSL], [http://www.iis.net/configreference/system.webserver/security/ipsecurity Source IP], [http://www.iis.net/configreference/system.webserver/security/requestfiltering#005 Request Filtering], and [http://www.iis.net/configreference/system.webserver/security/requestfiltering/filteringrules Custom Request Filtering.]&lt;br /&gt;
&lt;br /&gt;
=== Programmatic Configuration ===&lt;br /&gt;
&lt;br /&gt;
====JEE====&lt;br /&gt;
The JEE API for programmatic security consists of methods of the EJBContext interface and the HttpServletRequest interface. These methods allow components to make business-logic decisions based on the security role of the caller or remote user (there are also methods to authenticate users, but that is outside the scope of secure deployment configuration).&lt;br /&gt;
&lt;br /&gt;
The JEE APIs that interact with JEE security configuration include:&lt;br /&gt;
&lt;br /&gt;
* ''getRemoteUser'', which determines the user name with which the client authenticated&lt;br /&gt;
* ''isUserInRole'', which determines whether a remote user is in a specific security role. &lt;br /&gt;
* ''getUserPrincipal'', which determines the principal name of the current user and returns a java.security.Principal object&lt;br /&gt;
&lt;br /&gt;
Use of these programmatic APIs should be reviewed to ensure consistency with the configuration.  Specifically, the security-role-ref element should be declared in the deployment descriptor with a role-name subelement containing the role name to be passed to the ''isUserInRole'' method.&lt;br /&gt;
&lt;br /&gt;
The following code demonstrates the use of programmatic security for the purposes of programmatic login and establishing identities and roles. This servlet does the following:&lt;br /&gt;
&lt;br /&gt;
* displays information about the current user.&lt;br /&gt;
* prompts the user to log in.&lt;br /&gt;
* prints out the information again to demonstrate the effect of the login method.&lt;br /&gt;
* Iogs the user out.&lt;br /&gt;
* prints out the information again to demonstrate the effect of the logout method.&lt;br /&gt;
&lt;br /&gt;
 package enterprise.programmatic_login;&lt;br /&gt;
 &lt;br /&gt;
 import java.io.*;&lt;br /&gt;
 import java.net.*;&lt;br /&gt;
 import javax.annotation.security.DeclareRoles;&lt;br /&gt;
 import javax.servlet.*;&lt;br /&gt;
 import javax.servlet.http.*;&lt;br /&gt;
 &lt;br /&gt;
 @DeclareRoles(&amp;quot;javaee6user&amp;quot;)&lt;br /&gt;
 public class LoginServlet extends HttpServlet {&lt;br /&gt;
 &lt;br /&gt;
     /** &lt;br /&gt;
      * Processes requests for both HTTP GET and POST methods.&lt;br /&gt;
      * @param request servlet request&lt;br /&gt;
      * @param response servlet response&lt;br /&gt;
      */&lt;br /&gt;
     protected void processRequest(HttpServletRequest request, &lt;br /&gt;
                  HttpServletResponse response)&lt;br /&gt;
             throws ServletException, IOException {&lt;br /&gt;
         response.setContentType(&amp;quot;text/html;charset=UTF-8&amp;quot;);&lt;br /&gt;
         PrintWriter out = response.getWriter();&lt;br /&gt;
         try {&lt;br /&gt;
             String userName = request.getParameter(&amp;quot;txtUserName&amp;quot;);&lt;br /&gt;
             String password = request.getParameter(&amp;quot;txtPassword&amp;quot;);&lt;br /&gt;
             &lt;br /&gt;
             &amp;lt;nowiki&amp;gt;out.println(&amp;quot;Before Login&amp;quot; + &amp;quot;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;quot;);&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             out.println(&amp;quot;IsUserInRole?..&amp;quot; &lt;br /&gt;
             &amp;lt;nowiki&amp;gt;            + request.isUserInRole(&amp;quot;javaee6user&amp;quot;)+&amp;quot;&amp;lt;br&amp;gt;&amp;quot;);&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             &amp;lt;nowiki&amp;gt;out.println(&amp;quot;getRemoteUser?..&amp;quot; + request.getRemoteUser()+&amp;quot;&amp;lt;br&amp;gt;&amp;quot;);&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             out.println(&amp;quot;getUserPrincipal?..&amp;quot; &lt;br /&gt;
              &amp;lt;nowiki&amp;gt;           + request.getUserPrincipal()+&amp;quot;&amp;lt;br&amp;gt;&amp;quot;);&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             &amp;lt;nowiki&amp;gt;out.println(&amp;quot;getAuthType?..&amp;quot; + request.getAuthType()+&amp;quot;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;quot;);&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             &lt;br /&gt;
             try {&lt;br /&gt;
                 request.login(userName, password); &lt;br /&gt;
             } catch(ServletException ex) {&lt;br /&gt;
                 out.println(&amp;quot;Login Failed with a ServletException..&amp;quot; &lt;br /&gt;
                     + ex.getMessage());&lt;br /&gt;
                 return;&lt;br /&gt;
             }&lt;br /&gt;
             &amp;lt;nowiki&amp;gt;out.println(&amp;quot;After Login...&amp;quot;+&amp;quot;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;quot;);&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             out.println(&amp;quot;IsUserInRole?..&amp;quot; &lt;br /&gt;
               &amp;lt;nowiki&amp;gt;          + request.isUserInRole(&amp;quot;javaee6user&amp;quot;)+&amp;quot;&amp;lt;br&amp;gt;&amp;quot;);&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             &amp;lt;nowiki&amp;gt;out.println(&amp;quot;getRemoteUser?..&amp;quot; + request.getRemoteUser()+&amp;quot;&amp;lt;br&amp;gt;&amp;quot;);&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             out.println(&amp;quot;getUserPrincipal?..&amp;quot; &lt;br /&gt;
              &amp;lt;nowiki&amp;gt;           + request.getUserPrincipal()+&amp;quot;&amp;lt;br&amp;gt;&amp;quot;);&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             &amp;lt;nowiki&amp;gt;out.println(&amp;quot;getAuthType?..&amp;quot; + request.getAuthType()+&amp;quot;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;quot;);&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             &lt;br /&gt;
             request.logout();&lt;br /&gt;
             &amp;lt;nowiki&amp;gt;out.println(&amp;quot;After Logout...&amp;quot;+&amp;quot;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;quot;);&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             out.println(&amp;quot;IsUserInRole?..&amp;quot; &lt;br /&gt;
              &amp;lt;nowiki&amp;gt;           + request.isUserInRole(&amp;quot;javaee6user&amp;quot;)+&amp;quot;&amp;lt;br&amp;gt;&amp;quot;);&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             &amp;lt;nowiki&amp;gt;out.println(&amp;quot;getRemoteUser?..&amp;quot; + request.getRemoteUser()+&amp;quot;&amp;lt;br&amp;gt;&amp;quot;);&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             out.println(&amp;quot;getUserPrincipal?..&amp;quot;&lt;br /&gt;
               &amp;lt;nowiki&amp;gt;          + request.getUserPrincipal()+&amp;quot;&amp;lt;br&amp;gt;&amp;quot;);&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             &amp;lt;nowiki&amp;gt;out.println(&amp;quot;getAuthType?..&amp;quot; + request.getAuthType()+&amp;quot;&amp;lt;br&amp;gt;&amp;quot;);&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
         } finally {&lt;br /&gt;
             out.close();&lt;br /&gt;
         }&lt;br /&gt;
     }&lt;br /&gt;
     ...&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
More detailed information can be found in the Java EE Tutorial: [http://docs.oracle.com/javaee/6/tutorial/doc/gjiie.html Using Programmatic Security with Web Applications].&lt;br /&gt;
&lt;br /&gt;
====IIS====&lt;br /&gt;
&lt;br /&gt;
Microsoft IIS security configuration can also be programmatically set from various languages:&lt;br /&gt;
&lt;br /&gt;
* appcmd.exe set config ...&lt;br /&gt;
* C#&lt;br /&gt;
* Visual Basic&lt;br /&gt;
* JavaScript&lt;br /&gt;
&lt;br /&gt;
For example, disabling Anonymous authentication for a site named MySite, then enabling both Basic authentication and Windows authentication for the site (as done via configuration in the section above) can be accomplished programmatically as follows:&lt;br /&gt;
&lt;br /&gt;
'''In a command script using appcmd.exe'''&lt;br /&gt;
&lt;br /&gt;
 appcmd.exe set config &amp;quot;MySite&amp;quot; -section:system.webServer/security/authentication&lt;br /&gt;
       /anonymousAuthentication /enabled:&amp;quot;False&amp;quot; /commit:apphost&lt;br /&gt;
 appcmd.exe set config &amp;quot;MySite&amp;quot; -section:system.webServer/security/authentication&lt;br /&gt;
      /basicAuthentication /enabled:&amp;quot;True&amp;quot; /commit:apphost&lt;br /&gt;
 appcmd.exe set config &amp;quot;MySite&amp;quot; -section:system.webServer/security/authentication&lt;br /&gt;
     /windowsAuthentication /enabled:&amp;quot;True&amp;quot; /commit:apphost&lt;br /&gt;
&lt;br /&gt;
'''Using C#'''&lt;br /&gt;
&lt;br /&gt;
 using System;&lt;br /&gt;
 using System.Text;&lt;br /&gt;
 using Microsoft.Web.Administration;&lt;br /&gt;
 &lt;br /&gt;
 internal static class Sample {&lt;br /&gt;
 &lt;br /&gt;
    private static void Main() {&lt;br /&gt;
 &lt;br /&gt;
       using(ServerManager serverManager = new ServerManager()) { &lt;br /&gt;
          Configuration config = serverManager.GetApplicationHostConfiguration();&lt;br /&gt;
 &lt;br /&gt;
          ConfigurationSection anonymousAuthenticationSection =&lt;br /&gt;
            config.GetSection(&amp;quot;system.webServer/security/authentication&lt;br /&gt;
                               /anonymousAuthentication&amp;quot;, &amp;quot;MySite&amp;quot;);&lt;br /&gt;
          anonymousAuthenticationSection[&amp;quot;enabled&amp;quot;] = false;&lt;br /&gt;
 &lt;br /&gt;
          ConfigurationSection basicAuthenticationSection =&lt;br /&gt;
            config.GetSection(&amp;quot;system.webServer/security/authentication&lt;br /&gt;
                                /basicAuthentication&amp;quot;, &amp;quot;MySite&amp;quot;);&lt;br /&gt;
          basicAuthenticationSection[&amp;quot;enabled&amp;quot;] = true;&lt;br /&gt;
 &lt;br /&gt;
          ConfigurationSection windowsAuthenticationSection =&lt;br /&gt;
            config.GetSection(&amp;quot;system.webServer/security/authentication&lt;br /&gt;
                              /windowsAuthentication&amp;quot;, &amp;quot;MySite&amp;quot;);&lt;br /&gt;
          windowsAuthenticationSection[&amp;quot;enabled&amp;quot;] = true;&lt;br /&gt;
 &lt;br /&gt;
          serverManager.CommitChanges();&lt;br /&gt;
       }&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When reviewing source code, special attention should be paid to configuration updates in security sections.&lt;/div&gt;</summary>
		<author><name>Jerry Kickenson</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=CRV2_SecDepConfig&amp;diff=165223</id>
		<title>CRV2 SecDepConfig</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=CRV2_SecDepConfig&amp;diff=165223"/>
				<updated>2013-12-31T18:00:48Z</updated>
		
		<summary type="html">&lt;p&gt;Jerry Kickenson: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Secure Deployment Configuration ==&lt;br /&gt;
Web applications do not execute in isolation.  They typically are deployed within an application server framework, running within an operating system on a physical host, within a network.  &lt;br /&gt;
&lt;br /&gt;
Secure operating system configuration (also called hardening) is not typically within the scope of code review.  For more information, see the [http://benchmarks.cisecurity.org/downloads/browse/index.cfm?category=benchmarks.os Center for Internet Security operating system benchmarks].&lt;br /&gt;
&lt;br /&gt;
Networks today consist of much more than routers and switches providing transport services.  Filtering switches, VLANs (virtual LANs), firewalls, WAFs (Web Application Firewall), and various middle boxes (e.g. reverse proxies, intrusion detection and prevention systems) all provide critical security services when configured to do so.   This is a big topic, but outside the scope of this web application code review guide.  For a good summary, see the SANS (System Administration, Networking, and Security) Institute [http://www.sans.org/critical-security-controls/control.php?id=10 Critical Control 10: Secure Configurations for Network Devices such as Firewalls, Routers, and Switches].&lt;br /&gt;
&lt;br /&gt;
Application server frameworks have many security related capabilities.  These capabilities are enabled and configured  declaratively.  Declarative configuration is usually done via static configuration files, typically in XML format, but may also be expressed as annotations within the code.&lt;br /&gt;
&lt;br /&gt;
Some security capabilities are accessible from within a Java program.  Programmatic security is done within the web application, using framework specific or standard Java EE APIs.&lt;br /&gt;
&lt;br /&gt;
=== Declarative Configuration ===&lt;br /&gt;
&lt;br /&gt;
When implemented using the Java Enterprise Edition (JEE) framework, the [http://docs.oracle.com/javaee/6/tutorial/doc/bnbwk.html JEE security model] may be used.  JEE uses a role-based security model, in which access to application resources is granted based on the security role. The security role is a logical grouping of principals (authenticated entities, usually a user), and access is declared by specifying a ''security constraint'' on the role.&lt;br /&gt;
&lt;br /&gt;
==== Deployment Descriptor Configuration ====&lt;br /&gt;
The constraints and roles are expressed as ''deployment descriptors'' expressed as XML elements.  Different types of components use different formats, or schemas, for their deployment descriptors:&lt;br /&gt;
&lt;br /&gt;
* Web components may use a web application deployment descriptor in the file ''web.xml''&lt;br /&gt;
* Enterprise JavaBeans components may use an EJB deployment descriptor named ''META-INF/ejb-jar.xml''&lt;br /&gt;
&lt;br /&gt;
In summary, the deployment descriptor can define resources (e.g. servlets accessible via a specific URL), which roles are authorized to access the resource, and how access is constrained (e.g. via GET but not POST).  &lt;br /&gt;
&lt;br /&gt;
The following example web component descriptor, included in the &amp;quot;web.xml&amp;quot; file, defines a Catalog servlet, a &amp;quot;manager&amp;quot; role, a SalesInfo resource within the servlet accessible via GET and POST requests, and specifies that only users with &amp;quot;manager&amp;quot; role, using SSL and successfully using HTTP basic authentication should be granted access:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;ISO-8859-1&amp;quot;?&amp;gt;&lt;br /&gt;
 &amp;lt;web-app xmlns=&amp;quot;http://java.sun.com/xml/ns/j2ee&amp;quot;&lt;br /&gt;
   xmlns:xsi=&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot;&lt;br /&gt;
   xsi:schemaLocation=&amp;quot;http://java.sun.com/xml/ns/j2ee&lt;br /&gt;
    http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd&amp;quot; version=?2.5?&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
     &amp;lt;display-name&amp;gt;A Secure Application&amp;lt;/display-name&amp;gt;&lt;br /&gt;
     &amp;lt;servlet&amp;gt;&lt;br /&gt;
       &amp;lt;servlet-name&amp;gt;catalog&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;
       &amp;lt;servlet-class&amp;gt;com.mycorp.CatalogServlet&amp;lt;/servlet-class&amp;gt;&lt;br /&gt;
       &amp;lt;init-param&amp;gt;&lt;br /&gt;
         &amp;lt;param-name&amp;gt;catalog&amp;lt;/param-name&amp;gt;&lt;br /&gt;
         &amp;lt;param-value&amp;gt;Spring&amp;lt;/param-value&amp;gt;&lt;br /&gt;
       &amp;lt;/init-param&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
       &amp;lt;nowiki&amp;gt;&amp;lt;!-- Define Security Roles --&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
       &amp;lt;security-role-ref&amp;gt;&lt;br /&gt;
         &amp;lt;role-name&amp;gt;MGR&amp;lt;/role-name&amp;gt;&lt;br /&gt;
         &amp;lt;!-- role name used in code --&amp;gt;&lt;br /&gt;
         &amp;lt;role-link&amp;gt;manager&amp;lt;/role-link&amp;gt;&lt;br /&gt;
       &amp;lt;/security-role-ref&amp;gt;&lt;br /&gt;
     &amp;lt;/servlet&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
     &amp;lt;security-role&amp;gt;&lt;br /&gt;
       &amp;lt;role-name&amp;gt;manager&amp;lt;/role-name&amp;gt;&lt;br /&gt;
     &amp;lt;/security-role&amp;gt;&lt;br /&gt;
     &amp;lt;servlet-mapping&amp;gt;&lt;br /&gt;
       &amp;lt;servlet-name&amp;gt;catalog&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;
       &amp;lt;url-pattern&amp;gt;/catalog/*&amp;lt;/url-pattern&amp;gt;&lt;br /&gt;
     &amp;lt;/servlet-mapping&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
     &amp;lt;nowiki&amp;gt;&amp;lt;!-- Define A Security Constraint --&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
     &amp;lt;security-constraint&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
     &amp;lt;nowiki&amp;gt;&amp;lt;!-- Specify the Resources to be Protected --&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
     &amp;lt;web-resource-collection&amp;gt;&lt;br /&gt;
       &amp;lt;web-resource-name&amp;gt;SalesInfo&amp;lt;/web-resource-name&amp;gt;&lt;br /&gt;
       &amp;lt;url-pattern&amp;gt;/salesinfo/*&amp;lt;/url-pattern&amp;gt;&lt;br /&gt;
       &amp;lt;http-method&amp;gt;GET&amp;lt;/http-method&amp;gt;&lt;br /&gt;
       &amp;lt;http-method&amp;gt;POST&amp;lt;/http-method&amp;gt;&lt;br /&gt;
      &amp;lt;/web-resource-collection&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
     &amp;lt;nowiki&amp;gt;&amp;lt;!-- Specify which Users Can Access Protected Resources --&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
     &amp;lt;auth-constraint&amp;gt;&lt;br /&gt;
       &amp;lt;role-name&amp;gt;manager&amp;lt;/role-name&amp;gt;&lt;br /&gt;
     &amp;lt;/auth-constraint&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
     &amp;lt;nowiki&amp;gt;&amp;lt;!-- Specify Secure Transport using SSL (confidential guarantee) --&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
     &amp;lt;user-data-constraint&amp;gt;&lt;br /&gt;
       &amp;lt;transport-guarantee&amp;gt;CONFIDENTIAL&amp;lt;/transport-guarantee&amp;gt;&lt;br /&gt;
     &amp;lt;/user-data-constraint&amp;gt;&lt;br /&gt;
     &amp;lt;/security-constraint&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
     &amp;lt;nowiki&amp;gt;&amp;lt;!-- Specify HTTP Basic Authentication Method --&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
     &amp;lt;login-config&amp;gt;&lt;br /&gt;
       &amp;lt;auth-method&amp;gt;BASIC&amp;lt;/auth-method&amp;gt;&lt;br /&gt;
       &amp;lt;realm-name&amp;gt;file&amp;lt;/realm-name&amp;gt;&lt;br /&gt;
     &amp;lt;/login-config&amp;gt;&lt;br /&gt;
 &amp;lt;/web-app&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Security roles can also be declared for enterprise Java beans in the &amp;quot;ejb-jar.xml&amp;quot; file.  For example:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;!-- A sample ejb-jar.xml fragment --&amp;gt;&lt;br /&gt;
  &amp;lt;ejb-jar&amp;gt;&lt;br /&gt;
     &amp;lt;!-- ... --&amp;gt;&lt;br /&gt;
     &amp;lt;assembly-descriptor&amp;gt;&lt;br /&gt;
         &amp;lt;security-role&amp;gt;&lt;br /&gt;
             &amp;lt;description&amp;gt;The single application role&amp;lt;/description&amp;gt;&lt;br /&gt;
             &amp;lt;role-name&amp;gt;TheApplicationRole&amp;lt;/role-name&amp;gt;&lt;br /&gt;
         &amp;lt;/security-role&amp;gt;&lt;br /&gt;
     &amp;lt;/assembly-descriptor&amp;gt;&lt;br /&gt;
 &amp;lt;/ejb-jar&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For beans, however, rather than specifying access to resources within servlets, access to bean methods is specified.  The following example illustrates several types of method access constraints for several beans:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;ejb-jar&amp;gt;&lt;br /&gt;
     &amp;lt;assembly-descriptor&amp;gt;&lt;br /&gt;
         &amp;lt;method-permission&amp;gt;&lt;br /&gt;
             &amp;lt;description&amp;gt;The employee and temp-employee roles may access any&lt;br /&gt;
                 method of the EmployeeService bean &amp;lt;/description&amp;gt;&lt;br /&gt;
             &amp;lt;role-name&amp;gt;employee&amp;lt;/role-name&amp;gt;&lt;br /&gt;
             &amp;lt;role-name&amp;gt;temp-employee&amp;lt;/role-name&amp;gt;&lt;br /&gt;
             &amp;lt;method&amp;gt;&lt;br /&gt;
                 &amp;lt;ejb-name&amp;gt;EmployeeService&amp;lt;/ejb-name&amp;gt;&lt;br /&gt;
                 &amp;lt;method-name&amp;gt;*&amp;lt;/method-name&amp;gt;&lt;br /&gt;
             &amp;lt;/method&amp;gt;&lt;br /&gt;
         &amp;lt;/method-permission&amp;gt;&lt;br /&gt;
         &amp;lt;method-permission&amp;gt;&lt;br /&gt;
             &amp;lt;description&amp;gt;The employee role may access the findByPrimaryKey,&lt;br /&gt;
                 getEmployeeInfo, and the updateEmployeeInfo(String) method of&lt;br /&gt;
                 the AardvarkPayroll bean &amp;lt;/description&amp;gt;&lt;br /&gt;
             &amp;lt;role-name&amp;gt;employee&amp;lt;/role-name&amp;gt;&lt;br /&gt;
             &amp;lt;method&amp;gt;&lt;br /&gt;
                 &amp;lt;ejb-name&amp;gt;AardvarkPayroll&amp;lt;/ejb-name&amp;gt;&lt;br /&gt;
                 &amp;lt;method-name&amp;gt;findByPrimaryKey&amp;lt;/method-name&amp;gt;&lt;br /&gt;
             &amp;lt;/method&amp;gt;&lt;br /&gt;
             &amp;lt;method&amp;gt;&lt;br /&gt;
                 &amp;lt;ejb-name&amp;gt;AardvarkPayroll&amp;lt;/ejb-name&amp;gt;&lt;br /&gt;
                 &amp;lt;method-name&amp;gt;getEmployeeInfo&amp;lt;/method-name&amp;gt;&lt;br /&gt;
             &amp;lt;/method&amp;gt;&lt;br /&gt;
             &amp;lt;method&amp;gt;&lt;br /&gt;
                 &amp;lt;ejb-name&amp;gt;AardvarkPayroll&amp;lt;/ejb-name&amp;gt;&lt;br /&gt;
                 &amp;lt;method-name&amp;gt;updateEmployeeInfo&amp;lt;/method-name&amp;gt;&lt;br /&gt;
                 &amp;lt;method-params&amp;gt;&lt;br /&gt;
                     &amp;lt;method-param&amp;gt;java.lang.String&amp;lt;/method-param&amp;gt;&lt;br /&gt;
                 &amp;lt;/method-params&amp;gt;&lt;br /&gt;
             &amp;lt;/method&amp;gt;&lt;br /&gt;
         &amp;lt;/method-permission&amp;gt;&lt;br /&gt;
         &amp;lt;method-permission&amp;gt;&lt;br /&gt;
             &amp;lt;description&amp;gt;The admin role may access any method of the&lt;br /&gt;
                 EmployeeServiceAdmin bean &amp;lt;/description&amp;gt;&lt;br /&gt;
             &amp;lt;role-name&amp;gt;admin&amp;lt;/role-name&amp;gt;&lt;br /&gt;
             &amp;lt;method&amp;gt;&lt;br /&gt;
                 &amp;lt;ejb-name&amp;gt;EmployeeServiceAdmin&amp;lt;/ejb-name&amp;gt;&lt;br /&gt;
                 &amp;lt;method-name&amp;gt;*&amp;lt;/method-name&amp;gt;&lt;br /&gt;
             &amp;lt;/method&amp;gt;&lt;br /&gt;
         &amp;lt;/method-permission&amp;gt;&lt;br /&gt;
         &amp;lt;method-permission&amp;gt;&lt;br /&gt;
             &amp;lt;description&amp;gt;Any authenticated user may access any method of the&lt;br /&gt;
                 EmployeeServiceHelp bean&amp;lt;/description&amp;gt;&lt;br /&gt;
             &amp;lt;unchecked/&amp;gt;&lt;br /&gt;
             &amp;lt;method&amp;gt;&lt;br /&gt;
                 &amp;lt;ejb-name&amp;gt;EmployeeServiceHelp&amp;lt;/ejb-name&amp;gt;&lt;br /&gt;
                 &amp;lt;method-name&amp;gt;*&amp;lt;/method-name&amp;gt;&lt;br /&gt;
             &amp;lt;/method&amp;gt;&lt;br /&gt;
         &amp;lt;/method-permission&amp;gt;&lt;br /&gt;
         &amp;lt;exclude-list&amp;gt;&lt;br /&gt;
             &amp;lt;description&amp;gt;No fireTheCTO methods of the EmployeeFiring bean may be&lt;br /&gt;
                 used in this deployment&amp;lt;/description&amp;gt;&lt;br /&gt;
             &amp;lt;method&amp;gt;&lt;br /&gt;
                 &amp;lt;ejb-name&amp;gt;EmployeeFiring&amp;lt;/ejb-name&amp;gt;&lt;br /&gt;
                 &amp;lt;method-name&amp;gt;fireTheCTO&amp;lt;/method-name&amp;gt;&lt;br /&gt;
             &amp;lt;/method&amp;gt;&lt;br /&gt;
         &amp;lt;/exclude-list&amp;gt;&lt;br /&gt;
     &amp;lt;/assembly-descriptor&amp;gt;&lt;br /&gt;
 &amp;lt;/ejb-jar&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 Source: [https://access.redhat.com/site/documentation/en-US/JBoss_Enterprise_Application_Platform_Common_Criteria_Certification/5/html/Security_Guide/index.html JBoss Enterprise Application Platform Common Criteria Certification 5]&lt;br /&gt;
              [https://access.redhat.com/site/documentation/en-US/JBoss_Enterprise_Application_Platform_Common_Criteria_Certification/5/html/Security_Guide/index.html Security Guide]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If XML deployment descriptors are used to secure the application, code review should include the &amp;quot;web.xml&amp;quot; and &amp;quot;ejb-jar.xml&amp;quot; files to ensure that access controls are properly applied to the correct roles, and authentication methods are as expected.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Annotations ====&lt;br /&gt;
JEE annotations for security are defined in the [http://docs.oracle.com/javaee/6/api/javax/annotation/security/package-summary.html javax.annotation.security] package.  The available annotations are:&lt;br /&gt;
&lt;br /&gt;
 @DeclareRoles&lt;br /&gt;
 @DenyAll - no roles may invoke the method&lt;br /&gt;
 @PermitAll - all roles may invoke the method&lt;br /&gt;
 @RolesAllowed - roles permitted to invoke the method&lt;br /&gt;
 @RunAs - dynamically run the method as a particular role&lt;br /&gt;
&lt;br /&gt;
For example, the following code snippet allows employees and managers to add movies to the persistent store, anyone to list movies, but only managers may delete movies:&lt;br /&gt;
&lt;br /&gt;
 public class Movies {&lt;br /&gt;
 &lt;br /&gt;
     private EntityManager entityManager;&lt;br /&gt;
 &lt;br /&gt;
     @RolesAllowed({&amp;quot;Employee&amp;quot;, &amp;quot;Manager&amp;quot;})&lt;br /&gt;
     public void addMovie(Movie movie) throws Exception {&lt;br /&gt;
         entityManager.persist(movie);&lt;br /&gt;
     }&lt;br /&gt;
 &lt;br /&gt;
     @RolesAllowed({&amp;quot;Manager&amp;quot;})&lt;br /&gt;
     public void deleteMovie(Movie movie) throws Exception {&lt;br /&gt;
         entityManager.remove(movie);&lt;br /&gt;
     }&lt;br /&gt;
 &lt;br /&gt;
     @PermitAll&lt;br /&gt;
     public List&amp;lt;Movie&amp;gt; getMovies() throws Exception {&lt;br /&gt;
         Query query = entityManager.createQuery(&amp;quot;SELECT m from Movie as m&amp;quot;);&lt;br /&gt;
         return query.getResultList();&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Code review should look for such annotations.  If present, ensure they reflect the correct roles and permissions, and are consistent with any declared role permissions in the &amp;quot;ejb-jar.xml&amp;quot; file.&lt;br /&gt;
&lt;br /&gt;
==== Framework Specific Configuration ====&lt;br /&gt;
Some application server frameworks offer additional or enhanced security configurations.  Consult the documentation for the particular framework you are using.  Information on some of the more common frameworks follow.&lt;br /&gt;
&lt;br /&gt;
===== Apache Tomcat =====&lt;br /&gt;
The [http://tomcat.apache.org/tomcat-7.0-doc/security-howto.html#server.xml Tomcat server.xml] file defines many security related parameters:&lt;br /&gt;
&lt;br /&gt;
* Server - shutdown port&lt;br /&gt;
* Connectors - maxPostSize, maxParameterCount, server, SSLEnabled, secure, ciphers&lt;br /&gt;
* Host - autoDeploy, deployOnStartup, deployXML&lt;br /&gt;
* Context - crossContext, privileged, allowLinking&lt;br /&gt;
* Filter - Tomcat provides a number of ''filters'' which may be configured to incoming requests&lt;br /&gt;
&lt;br /&gt;
Filters are especially powerful, and a code review should validate they are used unless there is a compelling reason not to.  See [http://tomcat.apache.org/tomcat-7.0-doc/config/filter.html Container Provided Filters] for detailed information.&lt;br /&gt;
&lt;br /&gt;
The server.xml file should be reviewed to ensure security related parameters are configured as expected.&lt;br /&gt;
&lt;br /&gt;
More guidelines on securely deploying Apache Tomcat can be found in the [http://benchmarks.cisecurity.org/downloads/show-single/?file=tomcat.100 CIS Apache Tomcat 5.5/6.x Server Benchmark v1.0.0].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== Jetty =====&lt;br /&gt;
Jetty adds several security enhancements:&lt;br /&gt;
&lt;br /&gt;
* Limiting form content&lt;br /&gt;
* Obfuscating passwords&lt;br /&gt;
&lt;br /&gt;
The maximum form content size and number of form keys can be configured at server and web application level in the &amp;quot;jetty-web.xml&amp;quot; file:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;Configure class=&amp;quot;org.eclipse.jetty.webapp.WebAppContext&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
   ...&lt;br /&gt;
   &lt;br /&gt;
   &amp;lt;Set name=&amp;quot;maxFormContentSize&amp;quot;&amp;gt;200000&amp;lt;/Set&amp;gt;&lt;br /&gt;
   &amp;lt;Set name=&amp;quot;maxFormKeys&amp;quot;&amp;gt;200&amp;lt;/Set&amp;gt;&lt;br /&gt;
 &amp;lt;/Configure&amp;gt;    &lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;configure class=&amp;quot;org.eclipse.jetty.server.Server&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
   ...&lt;br /&gt;
  &lt;br /&gt;
   &amp;lt;Call name=&amp;quot;setAttribute&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;Arg&amp;gt;org.eclipse.jetty.server.Request.maxFormContentSize&amp;lt;/Arg&amp;gt;&lt;br /&gt;
     &amp;lt;Arg&amp;gt;100000&amp;lt;/Arg&amp;gt;&lt;br /&gt;
    &amp;lt;/Call&amp;gt;&lt;br /&gt;
   &amp;lt;Call name=&amp;quot;setAttribute&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;Arg&amp;gt;org.eclipse.jetty.server.Request.maxFormKeys&amp;lt;/Arg&amp;gt;&lt;br /&gt;
     &amp;lt;Arg&amp;gt;2000&amp;lt;/Arg&amp;gt;&lt;br /&gt;
    &amp;lt;/Call&amp;gt;&lt;br /&gt;
 &amp;lt;/configure&amp;gt;      &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Jetty also supports the use of obfuscated passwords in jetty XML files where a plain text password is usually needed. Here's an example setting the password for a JDBC Datasource with obfuscation (the obfuscated password is generated by Jetty org.eclipse.jetty.util.security.Password utility):&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;New id=&amp;quot;DSTest&amp;quot; class=&amp;quot;org.eclipse.jetty.plus.jndi.Resource&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Arg&amp;gt;&amp;lt;/Arg&amp;gt;&lt;br /&gt;
    &amp;lt;Arg&amp;gt;jdbc/DSTest&amp;lt;/Arg&amp;gt;&lt;br /&gt;
    &amp;lt;Arg&amp;gt;&lt;br /&gt;
      &amp;lt;New class=&amp;quot;com.jolbox.bonecp.BoneCPDataSource&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Set name=&amp;quot;driverClass&amp;quot;&amp;gt;com.mysql.jdbc.Driver&amp;lt;/Set&amp;gt;&lt;br /&gt;
        &amp;lt;Set name=&amp;quot;jdbcUrl&amp;quot;&amp;gt;jdbc:mysql://localhost:3306/foo&amp;lt;/Set&amp;gt;&lt;br /&gt;
        &amp;lt;Set name=&amp;quot;username&amp;quot;&amp;gt;dbuser&amp;lt;/Set&amp;gt;&lt;br /&gt;
        '''&amp;lt;Set name=&amp;quot;password&amp;quot;&amp;gt;'''&lt;br /&gt;
           '''&amp;lt;Call class=&amp;quot;org.eclipse.jetty.util.security.Password&amp;quot; name=&amp;quot;deobfuscate&amp;quot;&amp;gt;'''&lt;br /&gt;
                 '''&amp;lt;Arg&amp;gt;OBF:1ri71v1r1v2n1ri71shq1ri71shs1ri71v1r1v2n1ri7&amp;lt;/Arg&amp;gt;'''&lt;br /&gt;
           '''&amp;lt;/Call&amp;gt;'''&lt;br /&gt;
        '''&amp;lt;/Set&amp;gt;'''&lt;br /&gt;
        &amp;lt;Set name=&amp;quot;minConnectionsPerPartition&amp;quot;&amp;gt;5&amp;lt;/Set&amp;gt;&lt;br /&gt;
        &amp;lt;Set name=&amp;quot;maxConnectionsPerPartition&amp;quot;&amp;gt;50&amp;lt;/Set&amp;gt;&lt;br /&gt;
        &amp;lt;Set name=&amp;quot;acquireIncrement&amp;quot;&amp;gt;5&amp;lt;/Set&amp;gt;&lt;br /&gt;
        &amp;lt;Set name=&amp;quot;idleConnectionTestPeriod&amp;quot;&amp;gt;30&amp;lt;/Set&amp;gt;&lt;br /&gt;
     &amp;lt;/New&amp;gt;&lt;br /&gt;
   &amp;lt;/Arg&amp;gt;&lt;br /&gt;
 &amp;lt;/New&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====JBoss AS =====&lt;br /&gt;
JBoss Application Server, like Jetty, allows password obfuscation (called password masking in JBoss) in its XML configuration files.  After using JBoss password utility to create password mask, replace any occurrence of a masked password in XML configuration files with the following annotation:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;annotation&amp;gt;@org.jboss.security.integration.password.Password&lt;br /&gt;
                      (securityDomain=MASK_NAME,methodName=setPROPERTY_NAME)&lt;br /&gt;
 &amp;lt;/annotation&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See [http://docs.jboss.org/jbosssecurity/docs/6.0/security_guide/html_single/#Masking_Passwords Masking Passwords in XML Configuration] in the [http://docs.jboss.org/jbosssecurity/docs/6.0/security_guide/html_single/ JBoss AS Security Guide].&lt;br /&gt;
&lt;br /&gt;
===== Oracle WebLogic =====&lt;br /&gt;
WebLogic server supports additional deployment descriptors in the &amp;quot;weblogic.xml&amp;quot; file:&lt;br /&gt;
&lt;br /&gt;
* externally-defined - role to principal mappings are externally defined in WebLogic Admin Console&lt;br /&gt;
* run-as-principal-name - assign a principal to a role when running as that role&lt;br /&gt;
* run-as-role-assignment - contains the run-as-principal-name descriptor&lt;br /&gt;
* security-permission - contains security-permission-spec descriptor&lt;br /&gt;
* security-permission-spec - specify application permissions as per [http://docs.oracle.com/javase/1.5.0/docs/guide/security/PolicyFiles.html#FileSyntax Java policy file syntax]&lt;br /&gt;
* security-role-assignment - explicitly assign principals to a role&lt;br /&gt;
&lt;br /&gt;
More information on WebLogic additional deployment descriptors may be found at [http://docs.oracle.com/cd/E11035_01/wls100/security/thin_client.html#wp1046262 weblogic.xml Deployment Descriptors].&lt;br /&gt;
&lt;br /&gt;
For general guidelines on securing web applications running within WebLogic, see [http://docs.oracle.com/cd/E11035_01/wls100/security/ Programming WebLogic Security] and the NSA's [http://www.nsa.gov/ia/_files/webs/I33-004R-2005.pdf BEA WebLogic Platform Security Guide].&lt;br /&gt;
&lt;br /&gt;
===== Microsoft IIS =====&lt;br /&gt;
Microsoft Internet Information Server is not based on a JEE framework.  Security features can be configured in IIS using the Web.config (application level) or ApplicationHost.config (server level) file, in the &amp;lt;system.webServer&amp;gt;&amp;lt;security&amp;gt; section.  The types of features that may be configured include:&lt;br /&gt;
&lt;br /&gt;
* Permitted authentication methods&lt;br /&gt;
* Authorization rules&lt;br /&gt;
* Request filters and limits&lt;br /&gt;
* Use of SSL&lt;br /&gt;
* Source IP address filtering&lt;br /&gt;
&lt;br /&gt;
The Web.config and ApplicationHost.config files should be included in code review.  The &amp;lt;system.webServer&amp;gt;&amp;lt;security&amp;gt; sections should be reviewed to ensure all security configuration is as expected.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
======Authentication Methods======&lt;br /&gt;
IIS supports basic, client certificate, digest, IIS client certificate, and Windows authentication methods.   It is configured in the &amp;lt;system.webServer&amp;gt;&amp;lt;security&amp;gt;&amp;lt;authentication&amp;gt; section.  The following example disables Anonymous authentication for a site named MySite, then enables both Basic authentication and Windows authentication for the site:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;location path=&amp;quot;MySite&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;system.webServer&amp;gt;&lt;br /&gt;
       &amp;lt;security&amp;gt;&lt;br /&gt;
          &amp;lt;authentication&amp;gt;&lt;br /&gt;
             &amp;lt;anonymousAuthentication enabled=&amp;quot;false&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;basicAuthentication enabled=&amp;quot;true&amp;quot; defaultLogonDomain=&amp;quot;MySite&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;windowsAuthentication enabled=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
           &amp;lt;/authentication&amp;gt;&lt;br /&gt;
       &amp;lt;/security&amp;gt;&lt;br /&gt;
    &amp;lt;/system.webServer&amp;gt;&lt;br /&gt;
 &amp;lt;/location&amp;gt;&lt;br /&gt;
&lt;br /&gt;
======Authorization======&lt;br /&gt;
IIS authorization configuration allows specification of users access to the site or server.  It is configured in the &amp;lt;system.webServer&amp;gt;&amp;lt;security&amp;gt;&amp;lt;authorization&amp;gt; section.  The following example removes the default IIS authorization settings, which allows all users access to Web site or application content, and then configures an authorization rule that allows only users with administrator privileges to access the content:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;configuration&amp;gt;&lt;br /&gt;
    &amp;lt;system.webServer&amp;gt;&lt;br /&gt;
       &amp;lt;security&amp;gt;&lt;br /&gt;
          &amp;lt;authorization&amp;gt;&lt;br /&gt;
             &amp;lt;remove users=&amp;quot;*&amp;quot; roles=&amp;quot;&amp;quot; verbs=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;add accessType=&amp;quot;Allow&amp;quot; users=&amp;quot;&amp;quot; roles=&amp;quot;Administrators&amp;quot; /&amp;gt;&lt;br /&gt;
          &amp;lt;/authorization&amp;gt;&lt;br /&gt;
       &amp;lt;/security&amp;gt;&lt;br /&gt;
    &amp;lt;/system.webServer&amp;gt;&lt;br /&gt;
 &amp;lt;/configuration&amp;gt;&lt;br /&gt;
&lt;br /&gt;
======Request Filters and Limits======&lt;br /&gt;
IIS supports filtering, including enforcing limits, on incoming HTTP requests.  The following may be configured:&lt;br /&gt;
&lt;br /&gt;
* denyUrlSequences - list of prohibited URL patterns&lt;br /&gt;
* fileExtensions - allowed or prohibited file extensions&lt;br /&gt;
* hiddenSegments - URLs that cannot be browsed&lt;br /&gt;
* requestLimits - URL, content, query string, and HTTP header length limits&lt;br /&gt;
* verbs - allowed or prohibited verbs&lt;br /&gt;
* alwaysAllowedUrls - URLs always permitted&lt;br /&gt;
* alwaysAllowedQueryStrings - query strings always allowed&lt;br /&gt;
* denyQueryStringSequences - prohibited query strings&lt;br /&gt;
* filteringRules - custom filtering rules &lt;br /&gt;
&lt;br /&gt;
It is configured in the &amp;lt;system.webServer&amp;gt;&amp;lt;security&amp;gt;&amp;lt;requestFiltering&amp;gt; section.  The following example&lt;br /&gt;
&lt;br /&gt;
* Denies access to two URL sequences. The first sequence prevents directory transversal and the second sequence prevents access to alternate data streams.&lt;br /&gt;
* Denies access to unlisted file name extensions and unlisted HTTP verbs.&lt;br /&gt;
* Sets the maximum length for a URL to 2KB and the maximum length for a query string to 1KB.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;configuration&amp;gt;&lt;br /&gt;
    &amp;lt;system.webServer&amp;gt;&lt;br /&gt;
       &amp;lt;security&amp;gt;&lt;br /&gt;
          &amp;lt;requestFiltering&amp;gt;&lt;br /&gt;
             &amp;lt;denyUrlSequences&amp;gt;&lt;br /&gt;
                &amp;lt;add sequence=&amp;quot;..&amp;quot; /&amp;gt;&lt;br /&gt;
                &amp;lt;add sequence=&amp;quot;:&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/denyUrlSequences&amp;gt;&lt;br /&gt;
             &amp;lt;fileExtensions allowUnlisted=&amp;quot;false&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;requestLimits maxUrl=&amp;quot;2048&amp;quot; maxQueryString=&amp;quot;1024&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;verbs allowUnlisted=&amp;quot;false&amp;quot; /&amp;gt;&lt;br /&gt;
          &amp;lt;/requestFiltering&amp;gt;&lt;br /&gt;
       &amp;lt;/security&amp;gt;&lt;br /&gt;
    &amp;lt;/system.webServer&amp;gt;&lt;br /&gt;
 &amp;lt;/configuration&amp;gt;&lt;br /&gt;
&lt;br /&gt;
======Use of SSL======&lt;br /&gt;
IIS allows specifying whether SSL is supported, is required, whether client authentication is supported or required, and cipher strength.   It is configured in the &amp;lt;system.webServer&amp;gt;&amp;lt;security&amp;gt;&amp;lt;access&amp;gt; section.  The following example specifies SSL as required for all connections to the site MySite:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;location path=&amp;quot;MySite&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;system.webServer&amp;gt;&lt;br /&gt;
       &amp;lt;security&amp;gt;&lt;br /&gt;
          &amp;lt;access sslFlags=&amp;quot;ssl&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;/security&amp;gt;&lt;br /&gt;
    &amp;lt;/system.webServer&amp;gt;&lt;br /&gt;
 &amp;lt;/location&amp;gt;&lt;br /&gt;
&lt;br /&gt;
======Source IP address filtering======&lt;br /&gt;
IIS allows restrictions on source IP addresses or DNS names.  It is configured in the &amp;lt;system.webServer&amp;gt;&amp;lt;security&amp;gt;&amp;lt;ipSecurity&amp;gt; section.  The following example denies access to the IP address 192.168.100.1 and to the entire 169.254.0.0 network:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;location path=&amp;quot;Default Web Site&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;system.webServer&amp;gt;&lt;br /&gt;
       &amp;lt;security&amp;gt;&lt;br /&gt;
          &amp;lt;ipSecurity&amp;gt;&lt;br /&gt;
             &amp;lt;add ipAddress=&amp;quot;192.168.100.1&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;add ipAddress=&amp;quot;169.254.0.0&amp;quot; subnetMask=&amp;quot;255.255.0.0&amp;quot; /&amp;gt;&lt;br /&gt;
          &amp;lt;/ipSecurity&amp;gt;&lt;br /&gt;
       &amp;lt;/security&amp;gt;&lt;br /&gt;
    &amp;lt;/system.webServer&amp;gt;&lt;br /&gt;
 &amp;lt;/location&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Detailed information on IIS security configuration can be found at  [http://www.iis.net/configreference/system.webserver/security IIS Security Configuration].  Specific security feature configuration information can be found at [http://www.iis.net/configreference/system.webserver/security/authentication Authentication], [http://www.iis.net/configreference/system.webserver/security/authorization Authorization], [http://www.iis.net/configreference/system.webserver/security/access#001 SSL], [http://www.iis.net/configreference/system.webserver/security/ipsecurity Source IP], [http://www.iis.net/configreference/system.webserver/security/requestfiltering#005 Request Filtering], and [http://www.iis.net/configreference/system.webserver/security/requestfiltering/filteringrules Custom Request Filtering.]&lt;br /&gt;
&lt;br /&gt;
=== Programmatic Configuration ===&lt;br /&gt;
&lt;br /&gt;
====JEE====&lt;br /&gt;
The JEE API for programmatic security consists of methods of the EJBContext interface and the HttpServletRequest interface. These methods allow components to make business-logic decisions based on the security role of the caller or remote user (there are also methods to authenticate users, but that is outside the scope of secure deployment configuration).&lt;br /&gt;
&lt;br /&gt;
The JEE APIs that interact with JEE security configuration include:&lt;br /&gt;
&lt;br /&gt;
* ''getRemoteUser'', which determines the user name with which the client authenticated&lt;br /&gt;
* ''isUserInRole'', which determines whether a remote user is in a specific security role. &lt;br /&gt;
* ''getUserPrincipal'', which determines the principal name of the current user and returns a java.security.Principal object&lt;br /&gt;
&lt;br /&gt;
Use of these programmatic APIs should be reviewed to ensure consistency with the configuration.  Specifically, the security-role-ref element should be declared in the deployment descriptor with a role-name subelement containing the role name to be passed to the ''isUserInRole'' method.&lt;br /&gt;
&lt;br /&gt;
The following code demonstrates the use of programmatic security for the purposes of programmatic login and establishing identities and roles. This servlet does the following:&lt;br /&gt;
&lt;br /&gt;
* displays information about the current user.&lt;br /&gt;
* prompts the user to log in.&lt;br /&gt;
* prints out the information again to demonstrate the effect of the login method.&lt;br /&gt;
* Iogs the user out.&lt;br /&gt;
* prints out the information again to demonstrate the effect of the logout method.&lt;br /&gt;
&lt;br /&gt;
 package enterprise.programmatic_login;&lt;br /&gt;
 &lt;br /&gt;
 import java.io.*;&lt;br /&gt;
 import java.net.*;&lt;br /&gt;
 import javax.annotation.security.DeclareRoles;&lt;br /&gt;
 import javax.servlet.*;&lt;br /&gt;
 import javax.servlet.http.*;&lt;br /&gt;
 &lt;br /&gt;
 @DeclareRoles(&amp;quot;javaee6user&amp;quot;)&lt;br /&gt;
 public class LoginServlet extends HttpServlet {&lt;br /&gt;
 &lt;br /&gt;
     /** &lt;br /&gt;
      * Processes requests for both HTTP GET and POST methods.&lt;br /&gt;
      * @param request servlet request&lt;br /&gt;
      * @param response servlet response&lt;br /&gt;
      */&lt;br /&gt;
     protected void processRequest(HttpServletRequest request, &lt;br /&gt;
                  HttpServletResponse response)&lt;br /&gt;
             throws ServletException, IOException {&lt;br /&gt;
         response.setContentType(&amp;quot;text/html;charset=UTF-8&amp;quot;);&lt;br /&gt;
         PrintWriter out = response.getWriter();&lt;br /&gt;
         try {&lt;br /&gt;
             String userName = request.getParameter(&amp;quot;txtUserName&amp;quot;);&lt;br /&gt;
             String password = request.getParameter(&amp;quot;txtPassword&amp;quot;);&lt;br /&gt;
             &lt;br /&gt;
             &amp;lt;nowiki&amp;gt;out.println(&amp;quot;Before Login&amp;quot; + &amp;quot;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;quot;);&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             out.println(&amp;quot;IsUserInRole?..&amp;quot; &lt;br /&gt;
             &amp;lt;nowiki&amp;gt;            + request.isUserInRole(&amp;quot;javaee6user&amp;quot;)+&amp;quot;&amp;lt;br&amp;gt;&amp;quot;);&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             &amp;lt;nowiki&amp;gt;out.println(&amp;quot;getRemoteUser?..&amp;quot; + request.getRemoteUser()+&amp;quot;&amp;lt;br&amp;gt;&amp;quot;);&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             out.println(&amp;quot;getUserPrincipal?..&amp;quot; &lt;br /&gt;
              &amp;lt;nowiki&amp;gt;           + request.getUserPrincipal()+&amp;quot;&amp;lt;br&amp;gt;&amp;quot;);&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             &amp;lt;nowiki&amp;gt;out.println(&amp;quot;getAuthType?..&amp;quot; + request.getAuthType()+&amp;quot;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;quot;);&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             &lt;br /&gt;
             try {&lt;br /&gt;
                 request.login(userName, password); &lt;br /&gt;
             } catch(ServletException ex) {&lt;br /&gt;
                 out.println(&amp;quot;Login Failed with a ServletException..&amp;quot; &lt;br /&gt;
                     + ex.getMessage());&lt;br /&gt;
                 return;&lt;br /&gt;
             }&lt;br /&gt;
             &amp;lt;nowiki&amp;gt;out.println(&amp;quot;After Login...&amp;quot;+&amp;quot;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;quot;);&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             out.println(&amp;quot;IsUserInRole?..&amp;quot; &lt;br /&gt;
               &amp;lt;nowiki&amp;gt;          + request.isUserInRole(&amp;quot;javaee6user&amp;quot;)+&amp;quot;&amp;lt;br&amp;gt;&amp;quot;);&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             &amp;lt;nowiki&amp;gt;out.println(&amp;quot;getRemoteUser?..&amp;quot; + request.getRemoteUser()+&amp;quot;&amp;lt;br&amp;gt;&amp;quot;);&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             out.println(&amp;quot;getUserPrincipal?..&amp;quot; &lt;br /&gt;
              &amp;lt;nowiki&amp;gt;           + request.getUserPrincipal()+&amp;quot;&amp;lt;br&amp;gt;&amp;quot;);&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             &amp;lt;nowiki&amp;gt;out.println(&amp;quot;getAuthType?..&amp;quot; + request.getAuthType()+&amp;quot;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;quot;);&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             &lt;br /&gt;
             request.logout();&lt;br /&gt;
             &amp;lt;nowiki&amp;gt;out.println(&amp;quot;After Logout...&amp;quot;+&amp;quot;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;quot;);&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             out.println(&amp;quot;IsUserInRole?..&amp;quot; &lt;br /&gt;
              &amp;lt;nowiki&amp;gt;           + request.isUserInRole(&amp;quot;javaee6user&amp;quot;)+&amp;quot;&amp;lt;br&amp;gt;&amp;quot;);&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             &amp;lt;nowiki&amp;gt;out.println(&amp;quot;getRemoteUser?..&amp;quot; + request.getRemoteUser()+&amp;quot;&amp;lt;br&amp;gt;&amp;quot;);&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             out.println(&amp;quot;getUserPrincipal?..&amp;quot;&lt;br /&gt;
               &amp;lt;nowiki&amp;gt;          + request.getUserPrincipal()+&amp;quot;&amp;lt;br&amp;gt;&amp;quot;);&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             &amp;lt;nowiki&amp;gt;out.println(&amp;quot;getAuthType?..&amp;quot; + request.getAuthType()+&amp;quot;&amp;lt;br&amp;gt;&amp;quot;);&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
         } finally {&lt;br /&gt;
             out.close();&lt;br /&gt;
         }&lt;br /&gt;
     }&lt;br /&gt;
     ...&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
More detailed information can be found in the Java EE Tutorial: [http://docs.oracle.com/javaee/6/tutorial/doc/gjiie.html Using Programmatic Security with Web Applications].&lt;br /&gt;
&lt;br /&gt;
====IIS====&lt;br /&gt;
&lt;br /&gt;
Microsoft IIS security configuration can also be programmatically set from various languages:&lt;br /&gt;
&lt;br /&gt;
* appcmd.exe set config ...&lt;br /&gt;
* C#&lt;br /&gt;
* Visual Basic&lt;br /&gt;
* JavaScript&lt;br /&gt;
&lt;br /&gt;
For example, disabling Anonymous authentication for a site named MySite, then enabling both Basic authentication and Windows authentication for the site (as done via configuration in the section above) can be accomplished programmatically as follows:&lt;br /&gt;
&lt;br /&gt;
'''In a command script using appcmd.exe'''&lt;br /&gt;
&lt;br /&gt;
 appcmd.exe set config &amp;quot;MySite&amp;quot; -section:system.webServer/security/authentication&lt;br /&gt;
       /anonymousAuthentication /enabled:&amp;quot;False&amp;quot; /commit:apphost&lt;br /&gt;
 appcmd.exe set config &amp;quot;MySite&amp;quot; -section:system.webServer/security/authentication&lt;br /&gt;
      /basicAuthentication /enabled:&amp;quot;True&amp;quot; /commit:apphost&lt;br /&gt;
 appcmd.exe set config &amp;quot;MySite&amp;quot; -section:system.webServer/security/authentication&lt;br /&gt;
     /windowsAuthentication /enabled:&amp;quot;True&amp;quot; /commit:apphost&lt;br /&gt;
&lt;br /&gt;
'''Using C#'''&lt;br /&gt;
&lt;br /&gt;
 using System;&lt;br /&gt;
 using System.Text;&lt;br /&gt;
 using Microsoft.Web.Administration;&lt;br /&gt;
 &lt;br /&gt;
 internal static class Sample {&lt;br /&gt;
 &lt;br /&gt;
    private static void Main() {&lt;br /&gt;
 &lt;br /&gt;
       using(ServerManager serverManager = new ServerManager()) { &lt;br /&gt;
          Configuration config = serverManager.GetApplicationHostConfiguration();&lt;br /&gt;
 &lt;br /&gt;
          ConfigurationSection anonymousAuthenticationSection =&lt;br /&gt;
            config.GetSection(&amp;quot;system.webServer/security/authentication&lt;br /&gt;
                               /anonymousAuthentication&amp;quot;, &amp;quot;MySite&amp;quot;);&lt;br /&gt;
          anonymousAuthenticationSection[&amp;quot;enabled&amp;quot;] = false;&lt;br /&gt;
 &lt;br /&gt;
          ConfigurationSection basicAuthenticationSection =&lt;br /&gt;
            config.GetSection(&amp;quot;system.webServer/security/authentication&lt;br /&gt;
                                /basicAuthentication&amp;quot;, &amp;quot;MySite&amp;quot;);&lt;br /&gt;
          basicAuthenticationSection[&amp;quot;enabled&amp;quot;] = true;&lt;br /&gt;
 &lt;br /&gt;
          ConfigurationSection windowsAuthenticationSection =&lt;br /&gt;
            config.GetSection(&amp;quot;system.webServer/security/authentication&lt;br /&gt;
                              /windowsAuthentication&amp;quot;, &amp;quot;MySite&amp;quot;);&lt;br /&gt;
          windowsAuthenticationSection[&amp;quot;enabled&amp;quot;] = true;&lt;br /&gt;
 &lt;br /&gt;
          serverManager.CommitChanges();&lt;br /&gt;
       }&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When reviewing source code, special attention should be paid to configuration updates in security sections.&lt;/div&gt;</summary>
		<author><name>Jerry Kickenson</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=CRV2_SecDepConfig&amp;diff=165222</id>
		<title>CRV2 SecDepConfig</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=CRV2_SecDepConfig&amp;diff=165222"/>
				<updated>2013-12-31T17:42:43Z</updated>
		
		<summary type="html">&lt;p&gt;Jerry Kickenson: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Secure Deployment Configuration ==&lt;br /&gt;
Web applications do not execute in isolation.  They typically are deployed within an application server framework, running within an operating system on a physical host, within a network.  &lt;br /&gt;
&lt;br /&gt;
Secure operating system configuration (also called hardening) is not typically within the scope of code review.  For more information, see the [http://benchmarks.cisecurity.org/downloads/browse/index.cfm?category=benchmarks.os Center for Internet Security operating system benchmarks].&lt;br /&gt;
&lt;br /&gt;
Networks today consist of much more than routers and switches providing transport services.  Filtering switches, VLANs (virtual LANs), firewalls, WAFs (Web Application Firewall), and various middle boxes (e.g. reverse proxies, intrusion detection and prevention systems) all provide critical security services when configured to do so.   This is a big topic, but outside the scope of this web application code review guide.  For a good summary, see the SANS (System Administration, Networking, and Security) Institute [http://www.sans.org/critical-security-controls/control.php?id=10 Critical Control 10: Secure Configurations for Network Devices such as Firewalls, Routers, and Switches].&lt;br /&gt;
&lt;br /&gt;
Application server frameworks have many security related capabilities.  These capabilities are enabled and configured  declaratively.  Declarative configuration is usually done via static configuration files, typically in XML format, but may also be expressed as annotations within the code.&lt;br /&gt;
&lt;br /&gt;
Some security capabilities are accessible from within a Java program.  Programmatic security is done within the web application, using framework specific or standard Java EE APIs.&lt;br /&gt;
&lt;br /&gt;
=== Declarative Configuration ===&lt;br /&gt;
&lt;br /&gt;
When implemented using the Java Enterprise Edition (JEE) framework, the [http://docs.oracle.com/javaee/6/tutorial/doc/bnbwk.html JEE security model] may be used.  JEE uses a role-based security model, in which access to application resources is granted based on the security role. The security role is a logical grouping of principals (authenticated entities, usually a user), and access is declared by specifying a ''security constraint'' on the role.&lt;br /&gt;
&lt;br /&gt;
==== Deployment Descriptor Configuration ====&lt;br /&gt;
The constraints and roles are expressed as ''deployment descriptors'' expressed as XML elements.  Different types of components use different formats, or schemas, for their deployment descriptors:&lt;br /&gt;
&lt;br /&gt;
* Web components may use a web application deployment descriptor in the file ''web.xml''&lt;br /&gt;
* Enterprise JavaBeans components may use an EJB deployment descriptor named ''META-INF/ejb-jar.xml''&lt;br /&gt;
&lt;br /&gt;
In summary, the deployment descriptor can define resources (e.g. servlets accessible via a specific URL), which roles are authorized to access the resource, and how access is constrained (e.g. via GET but not POST).  &lt;br /&gt;
&lt;br /&gt;
The following example web component descriptor, included in the &amp;quot;web.xml&amp;quot; file, defines a Catalog servlet, a &amp;quot;manager&amp;quot; role, a SalesInfo resource within the servlet accessible via GET and POST requests, and specifies that only users with &amp;quot;manager&amp;quot; role, using SSL and successfully using HTTP basic authentication should be granted access:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;ISO-8859-1&amp;quot;?&amp;gt;&lt;br /&gt;
 &amp;lt;web-app xmlns=&amp;quot;http://java.sun.com/xml/ns/j2ee&amp;quot;&lt;br /&gt;
   xmlns:xsi=&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot;&lt;br /&gt;
   xsi:schemaLocation=&amp;quot;http://java.sun.com/xml/ns/j2ee&lt;br /&gt;
    http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd&amp;quot; version=?2.5?&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
     &amp;lt;display-name&amp;gt;A Secure Application&amp;lt;/display-name&amp;gt;&lt;br /&gt;
     &amp;lt;servlet&amp;gt;&lt;br /&gt;
       &amp;lt;servlet-name&amp;gt;catalog&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;
       &amp;lt;servlet-class&amp;gt;com.mycorp.CatalogServlet&amp;lt;/servlet-class&amp;gt;&lt;br /&gt;
       &amp;lt;init-param&amp;gt;&lt;br /&gt;
         &amp;lt;param-name&amp;gt;catalog&amp;lt;/param-name&amp;gt;&lt;br /&gt;
         &amp;lt;param-value&amp;gt;Spring&amp;lt;/param-value&amp;gt;&lt;br /&gt;
       &amp;lt;/init-param&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
       &amp;lt;nowiki&amp;gt;&amp;lt;!-- Define Security Roles --&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
       &amp;lt;security-role-ref&amp;gt;&lt;br /&gt;
         &amp;lt;role-name&amp;gt;MGR&amp;lt;/role-name&amp;gt;&lt;br /&gt;
         &amp;lt;!-- role name used in code --&amp;gt;&lt;br /&gt;
         &amp;lt;role-link&amp;gt;manager&amp;lt;/role-link&amp;gt;&lt;br /&gt;
       &amp;lt;/security-role-ref&amp;gt;&lt;br /&gt;
     &amp;lt;/servlet&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
     &amp;lt;security-role&amp;gt;&lt;br /&gt;
       &amp;lt;role-name&amp;gt;manager&amp;lt;/role-name&amp;gt;&lt;br /&gt;
     &amp;lt;/security-role&amp;gt;&lt;br /&gt;
     &amp;lt;servlet-mapping&amp;gt;&lt;br /&gt;
       &amp;lt;servlet-name&amp;gt;catalog&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;
       &amp;lt;url-pattern&amp;gt;/catalog/*&amp;lt;/url-pattern&amp;gt;&lt;br /&gt;
     &amp;lt;/servlet-mapping&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
     &amp;lt;nowiki&amp;gt;&amp;lt;!-- Define A Security Constraint --&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
     &amp;lt;security-constraint&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
     &amp;lt;nowiki&amp;gt;&amp;lt;!-- Specify the Resources to be Protected --&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
     &amp;lt;web-resource-collection&amp;gt;&lt;br /&gt;
       &amp;lt;web-resource-name&amp;gt;SalesInfo&amp;lt;/web-resource-name&amp;gt;&lt;br /&gt;
       &amp;lt;url-pattern&amp;gt;/salesinfo/*&amp;lt;/url-pattern&amp;gt;&lt;br /&gt;
       &amp;lt;http-method&amp;gt;GET&amp;lt;/http-method&amp;gt;&lt;br /&gt;
       &amp;lt;http-method&amp;gt;POST&amp;lt;/http-method&amp;gt;&lt;br /&gt;
      &amp;lt;/web-resource-collection&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
     &amp;lt;nowiki&amp;gt;&amp;lt;!-- Specify which Users Can Access Protected Resources --&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
     &amp;lt;auth-constraint&amp;gt;&lt;br /&gt;
       &amp;lt;role-name&amp;gt;manager&amp;lt;/role-name&amp;gt;&lt;br /&gt;
     &amp;lt;/auth-constraint&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
     &amp;lt;nowiki&amp;gt;&amp;lt;!-- Specify Secure Transport using SSL (confidential guarantee) --&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
     &amp;lt;user-data-constraint&amp;gt;&lt;br /&gt;
       &amp;lt;transport-guarantee&amp;gt;CONFIDENTIAL&amp;lt;/transport-guarantee&amp;gt;&lt;br /&gt;
     &amp;lt;/user-data-constraint&amp;gt;&lt;br /&gt;
     &amp;lt;/security-constraint&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
     &amp;lt;nowiki&amp;gt;&amp;lt;!-- Specify HTTP Basic Authentication Method --&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
     &amp;lt;login-config&amp;gt;&lt;br /&gt;
       &amp;lt;auth-method&amp;gt;BASIC&amp;lt;/auth-method&amp;gt;&lt;br /&gt;
       &amp;lt;realm-name&amp;gt;file&amp;lt;/realm-name&amp;gt;&lt;br /&gt;
     &amp;lt;/login-config&amp;gt;&lt;br /&gt;
 &amp;lt;/web-app&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Security roles can also be declared for enterprise Java beans in the &amp;quot;ejb-jar.xml&amp;quot; file.  For example:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;!-- A sample ejb-jar.xml fragment --&amp;gt;&lt;br /&gt;
  &amp;lt;ejb-jar&amp;gt;&lt;br /&gt;
     &amp;lt;!-- ... --&amp;gt;&lt;br /&gt;
     &amp;lt;assembly-descriptor&amp;gt;&lt;br /&gt;
         &amp;lt;security-role&amp;gt;&lt;br /&gt;
             &amp;lt;description&amp;gt;The single application role&amp;lt;/description&amp;gt;&lt;br /&gt;
             &amp;lt;role-name&amp;gt;TheApplicationRole&amp;lt;/role-name&amp;gt;&lt;br /&gt;
         &amp;lt;/security-role&amp;gt;&lt;br /&gt;
     &amp;lt;/assembly-descriptor&amp;gt;&lt;br /&gt;
 &amp;lt;/ejb-jar&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For beans, however, rather than specifying access to resources within servlets, access to bean methods is specified.  The following example illustrates several types of method access constraints for several beans:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;ejb-jar&amp;gt;&lt;br /&gt;
     &amp;lt;assembly-descriptor&amp;gt;&lt;br /&gt;
         &amp;lt;method-permission&amp;gt;&lt;br /&gt;
             &amp;lt;description&amp;gt;The employee and temp-employee roles may access any&lt;br /&gt;
                 method of the EmployeeService bean &amp;lt;/description&amp;gt;&lt;br /&gt;
             &amp;lt;role-name&amp;gt;employee&amp;lt;/role-name&amp;gt;&lt;br /&gt;
             &amp;lt;role-name&amp;gt;temp-employee&amp;lt;/role-name&amp;gt;&lt;br /&gt;
             &amp;lt;method&amp;gt;&lt;br /&gt;
                 &amp;lt;ejb-name&amp;gt;EmployeeService&amp;lt;/ejb-name&amp;gt;&lt;br /&gt;
                 &amp;lt;method-name&amp;gt;*&amp;lt;/method-name&amp;gt;&lt;br /&gt;
             &amp;lt;/method&amp;gt;&lt;br /&gt;
         &amp;lt;/method-permission&amp;gt;&lt;br /&gt;
         &amp;lt;method-permission&amp;gt;&lt;br /&gt;
             &amp;lt;description&amp;gt;The employee role may access the findByPrimaryKey,&lt;br /&gt;
                 getEmployeeInfo, and the updateEmployeeInfo(String) method of&lt;br /&gt;
                 the AardvarkPayroll bean &amp;lt;/description&amp;gt;&lt;br /&gt;
             &amp;lt;role-name&amp;gt;employee&amp;lt;/role-name&amp;gt;&lt;br /&gt;
             &amp;lt;method&amp;gt;&lt;br /&gt;
                 &amp;lt;ejb-name&amp;gt;AardvarkPayroll&amp;lt;/ejb-name&amp;gt;&lt;br /&gt;
                 &amp;lt;method-name&amp;gt;findByPrimaryKey&amp;lt;/method-name&amp;gt;&lt;br /&gt;
             &amp;lt;/method&amp;gt;&lt;br /&gt;
             &amp;lt;method&amp;gt;&lt;br /&gt;
                 &amp;lt;ejb-name&amp;gt;AardvarkPayroll&amp;lt;/ejb-name&amp;gt;&lt;br /&gt;
                 &amp;lt;method-name&amp;gt;getEmployeeInfo&amp;lt;/method-name&amp;gt;&lt;br /&gt;
             &amp;lt;/method&amp;gt;&lt;br /&gt;
             &amp;lt;method&amp;gt;&lt;br /&gt;
                 &amp;lt;ejb-name&amp;gt;AardvarkPayroll&amp;lt;/ejb-name&amp;gt;&lt;br /&gt;
                 &amp;lt;method-name&amp;gt;updateEmployeeInfo&amp;lt;/method-name&amp;gt;&lt;br /&gt;
                 &amp;lt;method-params&amp;gt;&lt;br /&gt;
                     &amp;lt;method-param&amp;gt;java.lang.String&amp;lt;/method-param&amp;gt;&lt;br /&gt;
                 &amp;lt;/method-params&amp;gt;&lt;br /&gt;
             &amp;lt;/method&amp;gt;&lt;br /&gt;
         &amp;lt;/method-permission&amp;gt;&lt;br /&gt;
         &amp;lt;method-permission&amp;gt;&lt;br /&gt;
             &amp;lt;description&amp;gt;The admin role may access any method of the&lt;br /&gt;
                 EmployeeServiceAdmin bean &amp;lt;/description&amp;gt;&lt;br /&gt;
             &amp;lt;role-name&amp;gt;admin&amp;lt;/role-name&amp;gt;&lt;br /&gt;
             &amp;lt;method&amp;gt;&lt;br /&gt;
                 &amp;lt;ejb-name&amp;gt;EmployeeServiceAdmin&amp;lt;/ejb-name&amp;gt;&lt;br /&gt;
                 &amp;lt;method-name&amp;gt;*&amp;lt;/method-name&amp;gt;&lt;br /&gt;
             &amp;lt;/method&amp;gt;&lt;br /&gt;
         &amp;lt;/method-permission&amp;gt;&lt;br /&gt;
         &amp;lt;method-permission&amp;gt;&lt;br /&gt;
             &amp;lt;description&amp;gt;Any authenticated user may access any method of the&lt;br /&gt;
                 EmployeeServiceHelp bean&amp;lt;/description&amp;gt;&lt;br /&gt;
             &amp;lt;unchecked/&amp;gt;&lt;br /&gt;
             &amp;lt;method&amp;gt;&lt;br /&gt;
                 &amp;lt;ejb-name&amp;gt;EmployeeServiceHelp&amp;lt;/ejb-name&amp;gt;&lt;br /&gt;
                 &amp;lt;method-name&amp;gt;*&amp;lt;/method-name&amp;gt;&lt;br /&gt;
             &amp;lt;/method&amp;gt;&lt;br /&gt;
         &amp;lt;/method-permission&amp;gt;&lt;br /&gt;
         &amp;lt;exclude-list&amp;gt;&lt;br /&gt;
             &amp;lt;description&amp;gt;No fireTheCTO methods of the EmployeeFiring bean may be&lt;br /&gt;
                 used in this deployment&amp;lt;/description&amp;gt;&lt;br /&gt;
             &amp;lt;method&amp;gt;&lt;br /&gt;
                 &amp;lt;ejb-name&amp;gt;EmployeeFiring&amp;lt;/ejb-name&amp;gt;&lt;br /&gt;
                 &amp;lt;method-name&amp;gt;fireTheCTO&amp;lt;/method-name&amp;gt;&lt;br /&gt;
             &amp;lt;/method&amp;gt;&lt;br /&gt;
         &amp;lt;/exclude-list&amp;gt;&lt;br /&gt;
     &amp;lt;/assembly-descriptor&amp;gt;&lt;br /&gt;
 &amp;lt;/ejb-jar&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 Source: [https://access.redhat.com/site/documentation/en-US/JBoss_Enterprise_Application_Platform_Common_Criteria_Certification/5/html/Security_Guide/index.html JBoss Enterprise Application Platform Common Criteria Certification 5]&lt;br /&gt;
              [https://access.redhat.com/site/documentation/en-US/JBoss_Enterprise_Application_Platform_Common_Criteria_Certification/5/html/Security_Guide/index.html Security Guide]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If XML deployment descriptors are used to secure the application, code review should include the &amp;quot;web.xml&amp;quot; and &amp;quot;ejb-jar.xml&amp;quot; files to ensure that access controls are properly applied to the correct roles, and authentication methods are as expected.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Annotations ====&lt;br /&gt;
JEE annotations for security are defined in the [http://docs.oracle.com/javaee/6/api/javax/annotation/security/package-summary.html javax.annotation.security] package.  The available annotations are:&lt;br /&gt;
&lt;br /&gt;
 @DeclareRoles&lt;br /&gt;
 @DenyAll - no roles may invoke the method&lt;br /&gt;
 @PermitAll - all roles may invoke the method&lt;br /&gt;
 @RolesAllowed - roles permitted to invoke the method&lt;br /&gt;
 @RunAs - dynamically run the method as a particular role&lt;br /&gt;
&lt;br /&gt;
For example, the following code snippet allows employees and managers to add movies to the persistent store, anyone to list movies, but only managers may delete movies:&lt;br /&gt;
&lt;br /&gt;
 public class Movies {&lt;br /&gt;
 &lt;br /&gt;
     private EntityManager entityManager;&lt;br /&gt;
 &lt;br /&gt;
     @RolesAllowed({&amp;quot;Employee&amp;quot;, &amp;quot;Manager&amp;quot;})&lt;br /&gt;
     public void addMovie(Movie movie) throws Exception {&lt;br /&gt;
         entityManager.persist(movie);&lt;br /&gt;
     }&lt;br /&gt;
 &lt;br /&gt;
     @RolesAllowed({&amp;quot;Manager&amp;quot;})&lt;br /&gt;
     public void deleteMovie(Movie movie) throws Exception {&lt;br /&gt;
         entityManager.remove(movie);&lt;br /&gt;
     }&lt;br /&gt;
 &lt;br /&gt;
     @PermitAll&lt;br /&gt;
     public List&amp;lt;Movie&amp;gt; getMovies() throws Exception {&lt;br /&gt;
         Query query = entityManager.createQuery(&amp;quot;SELECT m from Movie as m&amp;quot;);&lt;br /&gt;
         return query.getResultList();&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Code review should look for such annotations.  If present, ensure they reflect the correct roles and permissions, and are consistent with any declared role permissions in the &amp;quot;ejb-jar.xml&amp;quot; file.&lt;br /&gt;
&lt;br /&gt;
==== Framework Specific Configuration ====&lt;br /&gt;
Some application server frameworks offer additional or enhanced security configurations.  Consult the documentation for the particular framework you are using.  Information on some of the more common frameworks follow.&lt;br /&gt;
&lt;br /&gt;
===== Apache Tomcat =====&lt;br /&gt;
The [http://tomcat.apache.org/tomcat-7.0-doc/security-howto.html#server.xml Tomcat server.xml] file defines many security related parameters:&lt;br /&gt;
&lt;br /&gt;
* Server - shutdown port&lt;br /&gt;
* Connectors - maxPostSize, maxParameterCount, server, SSLEnabled, secure, ciphers&lt;br /&gt;
* Host - autoDeploy, deployOnStartup, deployXML&lt;br /&gt;
* Context - crossContext, privileged, allowLinking&lt;br /&gt;
* Filter - Tomcat provides a number of ''filters'' which may be configured to incoming requests&lt;br /&gt;
&lt;br /&gt;
Filters are especially powerful, and a code review should validate they are used unless there is a compelling reason not to.  See [http://tomcat.apache.org/tomcat-7.0-doc/config/filter.html Container Provided Filters] for detailed information.&lt;br /&gt;
&lt;br /&gt;
The server.xml file should be reviewed to ensure security related parameters are configured as expected.&lt;br /&gt;
&lt;br /&gt;
More guidelines on securely deploying Apache Tomcat can be found in the [http://benchmarks.cisecurity.org/downloads/show-single/?file=tomcat.100 CIS Apache Tomcat 5.5/6.x Server Benchmark v1.0.0].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== Jetty =====&lt;br /&gt;
Jetty adds several security enhancements:&lt;br /&gt;
&lt;br /&gt;
* Limiting form content&lt;br /&gt;
* Obfuscating passwords&lt;br /&gt;
&lt;br /&gt;
The maximum form content size and number of form keys can be configured at server and web application level in the &amp;quot;jetty-web.xml&amp;quot; file:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;Configure class=&amp;quot;org.eclipse.jetty.webapp.WebAppContext&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
   ...&lt;br /&gt;
   &lt;br /&gt;
   &amp;lt;Set name=&amp;quot;maxFormContentSize&amp;quot;&amp;gt;200000&amp;lt;/Set&amp;gt;&lt;br /&gt;
   &amp;lt;Set name=&amp;quot;maxFormKeys&amp;quot;&amp;gt;200&amp;lt;/Set&amp;gt;&lt;br /&gt;
 &amp;lt;/Configure&amp;gt;    &lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;configure class=&amp;quot;org.eclipse.jetty.server.Server&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
   ...&lt;br /&gt;
  &lt;br /&gt;
   &amp;lt;Call name=&amp;quot;setAttribute&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;Arg&amp;gt;org.eclipse.jetty.server.Request.maxFormContentSize&amp;lt;/Arg&amp;gt;&lt;br /&gt;
     &amp;lt;Arg&amp;gt;100000&amp;lt;/Arg&amp;gt;&lt;br /&gt;
    &amp;lt;/Call&amp;gt;&lt;br /&gt;
   &amp;lt;Call name=&amp;quot;setAttribute&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;Arg&amp;gt;org.eclipse.jetty.server.Request.maxFormKeys&amp;lt;/Arg&amp;gt;&lt;br /&gt;
     &amp;lt;Arg&amp;gt;2000&amp;lt;/Arg&amp;gt;&lt;br /&gt;
    &amp;lt;/Call&amp;gt;&lt;br /&gt;
 &amp;lt;/configure&amp;gt;      &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Jetty also supports the use of obfuscated passwords in jetty XML files where a plain text password is usually needed. Here's an example setting the password for a JDBC Datasource with obfuscation (the obfuscated password is generated by Jetty org.eclipse.jetty.util.security.Password utility):&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;New id=&amp;quot;DSTest&amp;quot; class=&amp;quot;org.eclipse.jetty.plus.jndi.Resource&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Arg&amp;gt;&amp;lt;/Arg&amp;gt;&lt;br /&gt;
    &amp;lt;Arg&amp;gt;jdbc/DSTest&amp;lt;/Arg&amp;gt;&lt;br /&gt;
    &amp;lt;Arg&amp;gt;&lt;br /&gt;
      &amp;lt;New class=&amp;quot;com.jolbox.bonecp.BoneCPDataSource&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Set name=&amp;quot;driverClass&amp;quot;&amp;gt;com.mysql.jdbc.Driver&amp;lt;/Set&amp;gt;&lt;br /&gt;
        &amp;lt;Set name=&amp;quot;jdbcUrl&amp;quot;&amp;gt;jdbc:mysql://localhost:3306/foo&amp;lt;/Set&amp;gt;&lt;br /&gt;
        &amp;lt;Set name=&amp;quot;username&amp;quot;&amp;gt;dbuser&amp;lt;/Set&amp;gt;&lt;br /&gt;
        '''&amp;lt;Set name=&amp;quot;password&amp;quot;&amp;gt;'''&lt;br /&gt;
           '''&amp;lt;Call class=&amp;quot;org.eclipse.jetty.util.security.Password&amp;quot; name=&amp;quot;deobfuscate&amp;quot;&amp;gt;'''&lt;br /&gt;
                 '''&amp;lt;Arg&amp;gt;OBF:1ri71v1r1v2n1ri71shq1ri71shs1ri71v1r1v2n1ri7&amp;lt;/Arg&amp;gt;'''&lt;br /&gt;
           '''&amp;lt;/Call&amp;gt;'''&lt;br /&gt;
        '''&amp;lt;/Set&amp;gt;'''&lt;br /&gt;
        &amp;lt;Set name=&amp;quot;minConnectionsPerPartition&amp;quot;&amp;gt;5&amp;lt;/Set&amp;gt;&lt;br /&gt;
        &amp;lt;Set name=&amp;quot;maxConnectionsPerPartition&amp;quot;&amp;gt;50&amp;lt;/Set&amp;gt;&lt;br /&gt;
        &amp;lt;Set name=&amp;quot;acquireIncrement&amp;quot;&amp;gt;5&amp;lt;/Set&amp;gt;&lt;br /&gt;
        &amp;lt;Set name=&amp;quot;idleConnectionTestPeriod&amp;quot;&amp;gt;30&amp;lt;/Set&amp;gt;&lt;br /&gt;
     &amp;lt;/New&amp;gt;&lt;br /&gt;
   &amp;lt;/Arg&amp;gt;&lt;br /&gt;
 &amp;lt;/New&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====JBoss AS =====&lt;br /&gt;
JBoss Application Server, like Jetty, allows password obfuscation (called password masking in JBoss) in its XML configuration files.  After using JBoss password utility to create password mask, replace any occurrence of a masked password in XML configuration files with the following annotation:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;annotation&amp;gt;@org.jboss.security.integration.password.Password&lt;br /&gt;
                      (securityDomain=MASK_NAME,methodName=setPROPERTY_NAME)&lt;br /&gt;
 &amp;lt;/annotation&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See [http://docs.jboss.org/jbosssecurity/docs/6.0/security_guide/html_single/#Masking_Passwords Masking Passwords in XML Configuration] in the [http://docs.jboss.org/jbosssecurity/docs/6.0/security_guide/html_single/ JBoss AS Security Guide].&lt;br /&gt;
&lt;br /&gt;
===== Oracle WebLogic =====&lt;br /&gt;
WebLogic server supports additional deployment descriptors in the &amp;quot;weblogic.xml&amp;quot; file:&lt;br /&gt;
&lt;br /&gt;
* externally-defined - role to principal mappings are externally defined in WebLogic Admin Console&lt;br /&gt;
* run-as-principal-name - assign a principal to a role when running as that role&lt;br /&gt;
* run-as-role-assignment - contains the run-as-principal-name descriptor&lt;br /&gt;
* security-permission - contains security-permission-spec descriptor&lt;br /&gt;
* security-permission-spec - specify application permissions as per [http://docs.oracle.com/javase/1.5.0/docs/guide/security/PolicyFiles.html#FileSyntax Java policy file syntax]&lt;br /&gt;
* security-role-assignment - explicitly assign principals to a role&lt;br /&gt;
&lt;br /&gt;
More information on WebLogic additional deployment descriptors may be found at [http://docs.oracle.com/cd/E11035_01/wls100/security/thin_client.html#wp1046262 weblogic.xml Deployment Descriptors].&lt;br /&gt;
&lt;br /&gt;
For general guidelines on securing web applications running within WebLogic, see [http://docs.oracle.com/cd/E11035_01/wls100/security/ Programming WebLogic Security] and the NSA's [http://www.nsa.gov/ia/_files/webs/I33-004R-2005.pdf BEA WebLogic Platform Security Guide].&lt;br /&gt;
&lt;br /&gt;
===== Microsoft IIS =====&lt;br /&gt;
Microsoft Internet Information Server is not based on a JEE framework.  Security features can be configured in IIS using the Web.config (application level) or ApplicationHost.config (server level) file, in the &amp;lt;system.webServer&amp;gt;&amp;lt;security&amp;gt; section.  The types of features that may be configured include:&lt;br /&gt;
&lt;br /&gt;
* Permitted authentication methods&lt;br /&gt;
* Authorization rules&lt;br /&gt;
* Request filters and limits&lt;br /&gt;
* Use of SSL&lt;br /&gt;
* Source IP address filtering&lt;br /&gt;
&lt;br /&gt;
The Web.config and ApplicationHost.config files should be included in code review.  The &amp;lt;system.webServer&amp;gt;&amp;lt;security&amp;gt; sections should be reviewed to ensure all security configuration is as expected.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
======Authentication Methods======&lt;br /&gt;
IIS supports basic, client certificate, digest, IIS client certificate, and Windows authentication methods.   It is configured in the &amp;lt;system.webServer&amp;gt;&amp;lt;security&amp;gt;&amp;lt;authentication&amp;gt; section.  The following example disables Anonymous authentication for a site named MySite, then enables both Basic authentication and Windows authentication for the site:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;location path=&amp;quot;MySite&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;system.webServer&amp;gt;&lt;br /&gt;
       &amp;lt;security&amp;gt;&lt;br /&gt;
          &amp;lt;authentication&amp;gt;&lt;br /&gt;
             &amp;lt;anonymousAuthentication enabled=&amp;quot;false&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;basicAuthentication enabled=&amp;quot;true&amp;quot; defaultLogonDomain=&amp;quot;MySite&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;windowsAuthentication enabled=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
           &amp;lt;/authentication&amp;gt;&lt;br /&gt;
       &amp;lt;/security&amp;gt;&lt;br /&gt;
    &amp;lt;/system.webServer&amp;gt;&lt;br /&gt;
 &amp;lt;/location&amp;gt;&lt;br /&gt;
&lt;br /&gt;
======Authorization======&lt;br /&gt;
IIS authorization configuration allows specification of users access to the site or server.  It is configured in the &amp;lt;system.webServer&amp;gt;&amp;lt;security&amp;gt;&amp;lt;authorization&amp;gt; section.  The following example removes the default IIS authorization settings, which allows all users access to Web site or application content, and then configures an authorization rule that allows only users with administrator privileges to access the content:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;configuration&amp;gt;&lt;br /&gt;
    &amp;lt;system.webServer&amp;gt;&lt;br /&gt;
       &amp;lt;security&amp;gt;&lt;br /&gt;
          &amp;lt;authorization&amp;gt;&lt;br /&gt;
             &amp;lt;remove users=&amp;quot;*&amp;quot; roles=&amp;quot;&amp;quot; verbs=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;add accessType=&amp;quot;Allow&amp;quot; users=&amp;quot;&amp;quot; roles=&amp;quot;Administrators&amp;quot; /&amp;gt;&lt;br /&gt;
          &amp;lt;/authorization&amp;gt;&lt;br /&gt;
       &amp;lt;/security&amp;gt;&lt;br /&gt;
    &amp;lt;/system.webServer&amp;gt;&lt;br /&gt;
 &amp;lt;/configuration&amp;gt;&lt;br /&gt;
&lt;br /&gt;
======Request Filters and Limits======&lt;br /&gt;
IIS supports filtering, including enforcing limits, on incoming HTTP requests.  The following may be configured:&lt;br /&gt;
&lt;br /&gt;
* denyUrlSequences - list of prohibited URL patterns&lt;br /&gt;
* fileExtensions - allowed or prohibited file extensions&lt;br /&gt;
* hiddenSegments - URLs that cannot be browsed&lt;br /&gt;
* requestLimits - URL, content, query string, and HTTP header length limits&lt;br /&gt;
* verbs - allowed or prohibited verbs&lt;br /&gt;
* alwaysAllowedUrls - URLs always permitted&lt;br /&gt;
* alwaysAllowedQueryStrings - query strings always allowed&lt;br /&gt;
* denyQueryStringSequences - prohibited query strings&lt;br /&gt;
* filteringRules - custom filtering rules &lt;br /&gt;
&lt;br /&gt;
It is configured in the &amp;lt;system.webServer&amp;gt;&amp;lt;security&amp;gt;&amp;lt;requestFiltering&amp;gt; section.  The following example&lt;br /&gt;
&lt;br /&gt;
* Denies access to two URL sequences. The first sequence prevents directory transversal and the second sequence prevents access to alternate data streams.&lt;br /&gt;
* Denies access to unlisted file name extensions and unlisted HTTP verbs.&lt;br /&gt;
* Sets the maximum length for a URL to 2KB and the maximum length for a query string to 1KB.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;configuration&amp;gt;&lt;br /&gt;
    &amp;lt;system.webServer&amp;gt;&lt;br /&gt;
       &amp;lt;security&amp;gt;&lt;br /&gt;
          &amp;lt;requestFiltering&amp;gt;&lt;br /&gt;
             &amp;lt;denyUrlSequences&amp;gt;&lt;br /&gt;
                &amp;lt;add sequence=&amp;quot;..&amp;quot; /&amp;gt;&lt;br /&gt;
                &amp;lt;add sequence=&amp;quot;:&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/denyUrlSequences&amp;gt;&lt;br /&gt;
             &amp;lt;fileExtensions allowUnlisted=&amp;quot;false&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;requestLimits maxUrl=&amp;quot;2048&amp;quot; maxQueryString=&amp;quot;1024&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;verbs allowUnlisted=&amp;quot;false&amp;quot; /&amp;gt;&lt;br /&gt;
          &amp;lt;/requestFiltering&amp;gt;&lt;br /&gt;
       &amp;lt;/security&amp;gt;&lt;br /&gt;
    &amp;lt;/system.webServer&amp;gt;&lt;br /&gt;
 &amp;lt;/configuration&amp;gt;&lt;br /&gt;
&lt;br /&gt;
======Use of SSL======&lt;br /&gt;
IIS allows specifying whether SSL is supported, is required, whether client authentication is supported or required, and cipher strength.   It is configured in the &amp;lt;system.webServer&amp;gt;&amp;lt;security&amp;gt;&amp;lt;access&amp;gt; section.  The following example specifies SSL as required for all connections to the site MySite:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;location path=&amp;quot;MySite&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;system.webServer&amp;gt;&lt;br /&gt;
       &amp;lt;security&amp;gt;&lt;br /&gt;
          &amp;lt;access sslFlags=&amp;quot;ssl&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;/security&amp;gt;&lt;br /&gt;
    &amp;lt;/system.webServer&amp;gt;&lt;br /&gt;
 &amp;lt;/location&amp;gt;&lt;br /&gt;
&lt;br /&gt;
======Source IP address filtering======&lt;br /&gt;
IIS allows restrictions on source IP addresses or DNS names.  It is configured in the &amp;lt;system.webServer&amp;gt;&amp;lt;security&amp;gt;&amp;lt;ipSecurity&amp;gt; section.  The following example denies access to the IP address 192.168.100.1 and to the entire 169.254.0.0 network:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;location path=&amp;quot;Default Web Site&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;system.webServer&amp;gt;&lt;br /&gt;
       &amp;lt;security&amp;gt;&lt;br /&gt;
          &amp;lt;ipSecurity&amp;gt;&lt;br /&gt;
             &amp;lt;add ipAddress=&amp;quot;192.168.100.1&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;add ipAddress=&amp;quot;169.254.0.0&amp;quot; subnetMask=&amp;quot;255.255.0.0&amp;quot; /&amp;gt;&lt;br /&gt;
          &amp;lt;/ipSecurity&amp;gt;&lt;br /&gt;
       &amp;lt;/security&amp;gt;&lt;br /&gt;
    &amp;lt;/system.webServer&amp;gt;&lt;br /&gt;
 &amp;lt;/location&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Detailed information on IIS security configuration can be found at  [http://www.iis.net/configreference/system.webserver/security IIS Security Configuration].  Specific security feature configuration information can be found at [http://www.iis.net/configreference/system.webserver/security/authentication Authentication], [http://www.iis.net/configreference/system.webserver/security/authorization Authorization], [http://www.iis.net/configreference/system.webserver/security/access#001 SSL], [http://www.iis.net/configreference/system.webserver/security/ipsecurity Source IP], [http://www.iis.net/configreference/system.webserver/security/requestfiltering#005 Request Filtering], and [http://www.iis.net/configreference/system.webserver/security/requestfiltering/filteringrules Custom Request Filtering.]&lt;br /&gt;
&lt;br /&gt;
=== Programmatic Configuration ===&lt;br /&gt;
&lt;br /&gt;
The JEE API for programmatic security consists of methods of the EJBContext interface and the HttpServletRequest interface. These methods allow components to make business-logic decisions based on the security role of the caller or remote user.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Microsoft IIS security configuration can also be programmatically set from various languages:&lt;br /&gt;
&lt;br /&gt;
* appcmd.exe set config ...&lt;br /&gt;
* C#&lt;br /&gt;
* Visual Basic&lt;br /&gt;
* JavaScript&lt;br /&gt;
&lt;br /&gt;
For example, disabling Anonymous authentication for a site named MySite, then enabling both Basic authentication and Windows authentication for the site (as done via configuration in the section above) can be accomplished programmatically as follows:&lt;br /&gt;
&lt;br /&gt;
'''In a command script using appcmd.exe'''&lt;br /&gt;
&lt;br /&gt;
 appcmd.exe set config &amp;quot;MySite&amp;quot; -section:system.webServer/security/authentication&lt;br /&gt;
       /anonymousAuthentication /enabled:&amp;quot;False&amp;quot; /commit:apphost&lt;br /&gt;
 appcmd.exe set config &amp;quot;MySite&amp;quot; -section:system.webServer/security/authentication&lt;br /&gt;
      /basicAuthentication /enabled:&amp;quot;True&amp;quot; /commit:apphost&lt;br /&gt;
 appcmd.exe set config &amp;quot;MySite&amp;quot; -section:system.webServer/security/authentication&lt;br /&gt;
     /windowsAuthentication /enabled:&amp;quot;True&amp;quot; /commit:apphost&lt;br /&gt;
&lt;br /&gt;
'''Using C#'''&lt;br /&gt;
&lt;br /&gt;
 using System;&lt;br /&gt;
 using System.Text;&lt;br /&gt;
 using Microsoft.Web.Administration;&lt;br /&gt;
 &lt;br /&gt;
 internal static class Sample {&lt;br /&gt;
 &lt;br /&gt;
    private static void Main() {&lt;br /&gt;
 &lt;br /&gt;
       using(ServerManager serverManager = new ServerManager()) { &lt;br /&gt;
          Configuration config = serverManager.GetApplicationHostConfiguration();&lt;br /&gt;
 &lt;br /&gt;
          ConfigurationSection anonymousAuthenticationSection =&lt;br /&gt;
            config.GetSection(&amp;quot;system.webServer/security/authentication&lt;br /&gt;
                               /anonymousAuthentication&amp;quot;, &amp;quot;MySite&amp;quot;);&lt;br /&gt;
          anonymousAuthenticationSection[&amp;quot;enabled&amp;quot;] = false;&lt;br /&gt;
 &lt;br /&gt;
          ConfigurationSection basicAuthenticationSection =&lt;br /&gt;
            config.GetSection(&amp;quot;system.webServer/security/authentication&lt;br /&gt;
                                /basicAuthentication&amp;quot;, &amp;quot;MySite&amp;quot;);&lt;br /&gt;
          basicAuthenticationSection[&amp;quot;enabled&amp;quot;] = true;&lt;br /&gt;
 &lt;br /&gt;
          ConfigurationSection windowsAuthenticationSection =&lt;br /&gt;
            config.GetSection(&amp;quot;system.webServer/security/authentication&lt;br /&gt;
                              /windowsAuthentication&amp;quot;, &amp;quot;MySite&amp;quot;);&lt;br /&gt;
          windowsAuthenticationSection[&amp;quot;enabled&amp;quot;] = true;&lt;br /&gt;
 &lt;br /&gt;
          serverManager.CommitChanges();&lt;br /&gt;
       }&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When reviewing source code, special attention should be paid to configuration updates in security sections.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== References===&lt;/div&gt;</summary>
		<author><name>Jerry Kickenson</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Talk:CRV2_SecDepConfig&amp;diff=165216</id>
		<title>Talk:CRV2 SecDepConfig</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Talk:CRV2_SecDepConfig&amp;diff=165216"/>
				<updated>2013-12-31T04:24:24Z</updated>
		
		<summary type="html">&lt;p&gt;Jerry Kickenson: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I've put some notes in here for expansion, I realise I'm not down as the author but wanted to share some thoughts. These are sketchy notes atm but will expand.&lt;br /&gt;
&lt;br /&gt;
The aim of the process is to ensure only users with required access have permission to push to production&lt;br /&gt;
&lt;br /&gt;
* Developer pushes to version control &amp;amp; submits pull request&lt;br /&gt;
* Lead developer performs review process&lt;br /&gt;
* Lead Developer pulls changes to master&lt;br /&gt;
&lt;br /&gt;
'''Capistrano for automated deployment'''&lt;br /&gt;
* Create capdeploy user on $evironment with write permissions on relevant directories&lt;br /&gt;
* SSH key authentication only&lt;br /&gt;
* Capistrano ''cap deploy $environment'' pushes to correct environment&lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
=== Comment ===&lt;br /&gt;
Sorry, I missed this comment before adding content, and I had a very different interpretation.  Since this is a code review guide, I interpreted &amp;quot;Secure Deployment Configuration&amp;quot; as guidelines for reviewing web application deployment configuration to ensure the deployed configuration is secure.  Secure deployment of files to production is of course also important, but I'm not sure it is a code review topic.  Of course, we can revert all my additions and I can try to put some content in on authorized deployment to production.  --[[User:Jerry Kickenson|Jerry Kickenson]] ([[User talk:Jerry Kickenson|talk]]) 22:24, 30 December 2013 (CST)&lt;/div&gt;</summary>
		<author><name>Jerry Kickenson</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=CRV2_SecDepConfig&amp;diff=165215</id>
		<title>CRV2 SecDepConfig</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=CRV2_SecDepConfig&amp;diff=165215"/>
				<updated>2013-12-31T04:12:57Z</updated>
		
		<summary type="html">&lt;p&gt;Jerry Kickenson: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Secure Deployment Configuration ==&lt;br /&gt;
Web applications do not execute in isolation.  They typically are deployed within an application server framework, running within an operating system on a physical host, within a network.  &lt;br /&gt;
&lt;br /&gt;
Secure operating system configuration (also called hardening) is not typically within the scope of code review.  For more information, see the [http://benchmarks.cisecurity.org/downloads/browse/index.cfm?category=benchmarks.os Center for Internet Security operating system benchmarks].&lt;br /&gt;
&lt;br /&gt;
Networks today consist of much more than routers and switches providing transport services.  Filtering switches, VLANs (virtual LANs), firewalls, WAFs (Web Application Firewall), and various middle boxes (e.g. reverse proxies, intrusion detection and prevention systems) all provide critical security services when configured to do so.   This is a big topic, but outside the scope of this web application code review guide.  For a good summary, see the SANS (System Administration, Networking, and Security) Institute [http://www.sans.org/critical-security-controls/control.php?id=10 Critical Control 10: Secure Configurations for Network Devices such as Firewalls, Routers, and Switches].&lt;br /&gt;
&lt;br /&gt;
Application server frameworks have many security related capabilities.  These capabilities are enabled and configured  declaratively.  Declarative configuration is usually done via static configuration files, typically in XML format, but may also be expressed as annotations within the code.&lt;br /&gt;
&lt;br /&gt;
Some security capabilities are accessible from within a Java program.  Programmatic security is done within the web application, using framework specific or standard Java EE APIs.&lt;br /&gt;
&lt;br /&gt;
=== Declarative Configuration ===&lt;br /&gt;
&lt;br /&gt;
When implemented using the Java Enterprise Edition (JEE) framework, the [http://docs.oracle.com/javaee/6/tutorial/doc/bnbwk.html JEE security model] may be used.  JEE uses a role-based security model, in which access to application resources is granted based on the security role. The security role is a logical grouping of principals (authenticated entities, usually a user), and access is declared by specifying a ''security constraint'' on the role.&lt;br /&gt;
&lt;br /&gt;
==== Deployment Descriptor Configuration ====&lt;br /&gt;
The constraints and roles are expressed as ''deployment descriptors'' expressed as XML elements.  Different types of components use different formats, or schemas, for their deployment descriptors:&lt;br /&gt;
&lt;br /&gt;
* Web components may use a web application deployment descriptor in the file ''web.xml''&lt;br /&gt;
* Enterprise JavaBeans components may use an EJB deployment descriptor named ''META-INF/ejb-jar.xml''&lt;br /&gt;
&lt;br /&gt;
In summary, the deployment descriptor can define resources (e.g. servlets accessible via a specific URL), which roles are authorized to access the resource, and how access is constrained (e.g. via GET but not POST).  &lt;br /&gt;
&lt;br /&gt;
The following example web component descriptor, included in the &amp;quot;web.xml&amp;quot; file, defines a Catalog servlet, a &amp;quot;manager&amp;quot; role, a SalesInfo resource within the servlet accessible via GET and POST requests, and specifies that only users with &amp;quot;manager&amp;quot; role, using SSL and successfully using HTTP basic authentication should be granted access:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;ISO-8859-1&amp;quot;?&amp;gt;&lt;br /&gt;
 &amp;lt;web-app xmlns=&amp;quot;http://java.sun.com/xml/ns/j2ee&amp;quot;&lt;br /&gt;
   xmlns:xsi=&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot;&lt;br /&gt;
   xsi:schemaLocation=&amp;quot;http://java.sun.com/xml/ns/j2ee&lt;br /&gt;
    http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd&amp;quot; version=?2.5?&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
     &amp;lt;display-name&amp;gt;A Secure Application&amp;lt;/display-name&amp;gt;&lt;br /&gt;
     &amp;lt;servlet&amp;gt;&lt;br /&gt;
       &amp;lt;servlet-name&amp;gt;catalog&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;
       &amp;lt;servlet-class&amp;gt;com.mycorp.CatalogServlet&amp;lt;/servlet-class&amp;gt;&lt;br /&gt;
       &amp;lt;init-param&amp;gt;&lt;br /&gt;
         &amp;lt;param-name&amp;gt;catalog&amp;lt;/param-name&amp;gt;&lt;br /&gt;
         &amp;lt;param-value&amp;gt;Spring&amp;lt;/param-value&amp;gt;&lt;br /&gt;
       &amp;lt;/init-param&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
       &amp;lt;nowiki&amp;gt;&amp;lt;!-- Define Security Roles --&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
       &amp;lt;security-role-ref&amp;gt;&lt;br /&gt;
         &amp;lt;role-name&amp;gt;MGR&amp;lt;/role-name&amp;gt;&lt;br /&gt;
         &amp;lt;!-- role name used in code --&amp;gt;&lt;br /&gt;
         &amp;lt;role-link&amp;gt;manager&amp;lt;/role-link&amp;gt;&lt;br /&gt;
       &amp;lt;/security-role-ref&amp;gt;&lt;br /&gt;
     &amp;lt;/servlet&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
     &amp;lt;security-role&amp;gt;&lt;br /&gt;
       &amp;lt;role-name&amp;gt;manager&amp;lt;/role-name&amp;gt;&lt;br /&gt;
     &amp;lt;/security-role&amp;gt;&lt;br /&gt;
     &amp;lt;servlet-mapping&amp;gt;&lt;br /&gt;
       &amp;lt;servlet-name&amp;gt;catalog&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;
       &amp;lt;url-pattern&amp;gt;/catalog/*&amp;lt;/url-pattern&amp;gt;&lt;br /&gt;
     &amp;lt;/servlet-mapping&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
     &amp;lt;nowiki&amp;gt;&amp;lt;!-- Define A Security Constraint --&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
     &amp;lt;security-constraint&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
     &amp;lt;nowiki&amp;gt;&amp;lt;!-- Specify the Resources to be Protected --&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
     &amp;lt;web-resource-collection&amp;gt;&lt;br /&gt;
       &amp;lt;web-resource-name&amp;gt;SalesInfo&amp;lt;/web-resource-name&amp;gt;&lt;br /&gt;
       &amp;lt;url-pattern&amp;gt;/salesinfo/*&amp;lt;/url-pattern&amp;gt;&lt;br /&gt;
       &amp;lt;http-method&amp;gt;GET&amp;lt;/http-method&amp;gt;&lt;br /&gt;
       &amp;lt;http-method&amp;gt;POST&amp;lt;/http-method&amp;gt;&lt;br /&gt;
      &amp;lt;/web-resource-collection&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
     &amp;lt;nowiki&amp;gt;&amp;lt;!-- Specify which Users Can Access Protected Resources --&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
     &amp;lt;auth-constraint&amp;gt;&lt;br /&gt;
       &amp;lt;role-name&amp;gt;manager&amp;lt;/role-name&amp;gt;&lt;br /&gt;
     &amp;lt;/auth-constraint&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
     &amp;lt;nowiki&amp;gt;&amp;lt;!-- Specify Secure Transport using SSL (confidential guarantee) --&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
     &amp;lt;user-data-constraint&amp;gt;&lt;br /&gt;
       &amp;lt;transport-guarantee&amp;gt;CONFIDENTIAL&amp;lt;/transport-guarantee&amp;gt;&lt;br /&gt;
     &amp;lt;/user-data-constraint&amp;gt;&lt;br /&gt;
     &amp;lt;/security-constraint&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
     &amp;lt;nowiki&amp;gt;&amp;lt;!-- Specify HTTP Basic Authentication Method --&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
     &amp;lt;login-config&amp;gt;&lt;br /&gt;
       &amp;lt;auth-method&amp;gt;BASIC&amp;lt;/auth-method&amp;gt;&lt;br /&gt;
       &amp;lt;realm-name&amp;gt;file&amp;lt;/realm-name&amp;gt;&lt;br /&gt;
     &amp;lt;/login-config&amp;gt;&lt;br /&gt;
 &amp;lt;/web-app&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Security roles can also be declared for enterprise Java beans in the &amp;quot;ejb-jar.xml&amp;quot; file.  For example:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;!-- A sample ejb-jar.xml fragment --&amp;gt;&lt;br /&gt;
  &amp;lt;ejb-jar&amp;gt;&lt;br /&gt;
     &amp;lt;!-- ... --&amp;gt;&lt;br /&gt;
     &amp;lt;assembly-descriptor&amp;gt;&lt;br /&gt;
         &amp;lt;security-role&amp;gt;&lt;br /&gt;
             &amp;lt;description&amp;gt;The single application role&amp;lt;/description&amp;gt;&lt;br /&gt;
             &amp;lt;role-name&amp;gt;TheApplicationRole&amp;lt;/role-name&amp;gt;&lt;br /&gt;
         &amp;lt;/security-role&amp;gt;&lt;br /&gt;
     &amp;lt;/assembly-descriptor&amp;gt;&lt;br /&gt;
 &amp;lt;/ejb-jar&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For beans, however, rather than specifying access to resources within servlets, access to bean methods is specified.  The following example illustrates several types of method access constraints for several beans:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;ejb-jar&amp;gt;&lt;br /&gt;
     &amp;lt;assembly-descriptor&amp;gt;&lt;br /&gt;
         &amp;lt;method-permission&amp;gt;&lt;br /&gt;
             &amp;lt;description&amp;gt;The employee and temp-employee roles may access any&lt;br /&gt;
                 method of the EmployeeService bean &amp;lt;/description&amp;gt;&lt;br /&gt;
             &amp;lt;role-name&amp;gt;employee&amp;lt;/role-name&amp;gt;&lt;br /&gt;
             &amp;lt;role-name&amp;gt;temp-employee&amp;lt;/role-name&amp;gt;&lt;br /&gt;
             &amp;lt;method&amp;gt;&lt;br /&gt;
                 &amp;lt;ejb-name&amp;gt;EmployeeService&amp;lt;/ejb-name&amp;gt;&lt;br /&gt;
                 &amp;lt;method-name&amp;gt;*&amp;lt;/method-name&amp;gt;&lt;br /&gt;
             &amp;lt;/method&amp;gt;&lt;br /&gt;
         &amp;lt;/method-permission&amp;gt;&lt;br /&gt;
         &amp;lt;method-permission&amp;gt;&lt;br /&gt;
             &amp;lt;description&amp;gt;The employee role may access the findByPrimaryKey,&lt;br /&gt;
                 getEmployeeInfo, and the updateEmployeeInfo(String) method of&lt;br /&gt;
                 the AardvarkPayroll bean &amp;lt;/description&amp;gt;&lt;br /&gt;
             &amp;lt;role-name&amp;gt;employee&amp;lt;/role-name&amp;gt;&lt;br /&gt;
             &amp;lt;method&amp;gt;&lt;br /&gt;
                 &amp;lt;ejb-name&amp;gt;AardvarkPayroll&amp;lt;/ejb-name&amp;gt;&lt;br /&gt;
                 &amp;lt;method-name&amp;gt;findByPrimaryKey&amp;lt;/method-name&amp;gt;&lt;br /&gt;
             &amp;lt;/method&amp;gt;&lt;br /&gt;
             &amp;lt;method&amp;gt;&lt;br /&gt;
                 &amp;lt;ejb-name&amp;gt;AardvarkPayroll&amp;lt;/ejb-name&amp;gt;&lt;br /&gt;
                 &amp;lt;method-name&amp;gt;getEmployeeInfo&amp;lt;/method-name&amp;gt;&lt;br /&gt;
             &amp;lt;/method&amp;gt;&lt;br /&gt;
             &amp;lt;method&amp;gt;&lt;br /&gt;
                 &amp;lt;ejb-name&amp;gt;AardvarkPayroll&amp;lt;/ejb-name&amp;gt;&lt;br /&gt;
                 &amp;lt;method-name&amp;gt;updateEmployeeInfo&amp;lt;/method-name&amp;gt;&lt;br /&gt;
                 &amp;lt;method-params&amp;gt;&lt;br /&gt;
                     &amp;lt;method-param&amp;gt;java.lang.String&amp;lt;/method-param&amp;gt;&lt;br /&gt;
                 &amp;lt;/method-params&amp;gt;&lt;br /&gt;
             &amp;lt;/method&amp;gt;&lt;br /&gt;
         &amp;lt;/method-permission&amp;gt;&lt;br /&gt;
         &amp;lt;method-permission&amp;gt;&lt;br /&gt;
             &amp;lt;description&amp;gt;The admin role may access any method of the&lt;br /&gt;
                 EmployeeServiceAdmin bean &amp;lt;/description&amp;gt;&lt;br /&gt;
             &amp;lt;role-name&amp;gt;admin&amp;lt;/role-name&amp;gt;&lt;br /&gt;
             &amp;lt;method&amp;gt;&lt;br /&gt;
                 &amp;lt;ejb-name&amp;gt;EmployeeServiceAdmin&amp;lt;/ejb-name&amp;gt;&lt;br /&gt;
                 &amp;lt;method-name&amp;gt;*&amp;lt;/method-name&amp;gt;&lt;br /&gt;
             &amp;lt;/method&amp;gt;&lt;br /&gt;
         &amp;lt;/method-permission&amp;gt;&lt;br /&gt;
         &amp;lt;method-permission&amp;gt;&lt;br /&gt;
             &amp;lt;description&amp;gt;Any authenticated user may access any method of the&lt;br /&gt;
                 EmployeeServiceHelp bean&amp;lt;/description&amp;gt;&lt;br /&gt;
             &amp;lt;unchecked/&amp;gt;&lt;br /&gt;
             &amp;lt;method&amp;gt;&lt;br /&gt;
                 &amp;lt;ejb-name&amp;gt;EmployeeServiceHelp&amp;lt;/ejb-name&amp;gt;&lt;br /&gt;
                 &amp;lt;method-name&amp;gt;*&amp;lt;/method-name&amp;gt;&lt;br /&gt;
             &amp;lt;/method&amp;gt;&lt;br /&gt;
         &amp;lt;/method-permission&amp;gt;&lt;br /&gt;
         &amp;lt;exclude-list&amp;gt;&lt;br /&gt;
             &amp;lt;description&amp;gt;No fireTheCTO methods of the EmployeeFiring bean may be&lt;br /&gt;
                 used in this deployment&amp;lt;/description&amp;gt;&lt;br /&gt;
             &amp;lt;method&amp;gt;&lt;br /&gt;
                 &amp;lt;ejb-name&amp;gt;EmployeeFiring&amp;lt;/ejb-name&amp;gt;&lt;br /&gt;
                 &amp;lt;method-name&amp;gt;fireTheCTO&amp;lt;/method-name&amp;gt;&lt;br /&gt;
             &amp;lt;/method&amp;gt;&lt;br /&gt;
         &amp;lt;/exclude-list&amp;gt;&lt;br /&gt;
     &amp;lt;/assembly-descriptor&amp;gt;&lt;br /&gt;
 &amp;lt;/ejb-jar&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 Source: [https://access.redhat.com/site/documentation/en-US/JBoss_Enterprise_Application_Platform_Common_Criteria_Certification/5/html/Security_Guide/index.html JBoss Enterprise Application Platform Common Criteria Certification 5]&lt;br /&gt;
              [https://access.redhat.com/site/documentation/en-US/JBoss_Enterprise_Application_Platform_Common_Criteria_Certification/5/html/Security_Guide/index.html Security Guide]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If XML deployment descriptors are used to secure the application, code review should include the &amp;quot;web.xml&amp;quot; and &amp;quot;ejb-jar.xml&amp;quot; files to ensure that access controls are properly applied to the correct roles, and authentication methods are as expected.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Annotations ====&lt;br /&gt;
JEE annotations for security are defined in the [http://docs.oracle.com/javaee/6/api/javax/annotation/security/package-summary.html javax.annotation.security] package.  The available annotations are:&lt;br /&gt;
&lt;br /&gt;
 @DeclareRoles&lt;br /&gt;
 @DenyAll - no roles may invoke the method&lt;br /&gt;
 @PermitAll - all roles may invoke the method&lt;br /&gt;
 @RolesAllowed - roles permitted to invoke the method&lt;br /&gt;
 @RunAs - dynamically run the method as a particular role&lt;br /&gt;
&lt;br /&gt;
For example, the following code snippet allows employees and managers to add movies to the persistent store, anyone to list movies, but only managers may delete movies:&lt;br /&gt;
&lt;br /&gt;
 public class Movies {&lt;br /&gt;
 &lt;br /&gt;
     private EntityManager entityManager;&lt;br /&gt;
 &lt;br /&gt;
     @RolesAllowed({&amp;quot;Employee&amp;quot;, &amp;quot;Manager&amp;quot;})&lt;br /&gt;
     public void addMovie(Movie movie) throws Exception {&lt;br /&gt;
         entityManager.persist(movie);&lt;br /&gt;
     }&lt;br /&gt;
 &lt;br /&gt;
     @RolesAllowed({&amp;quot;Manager&amp;quot;})&lt;br /&gt;
     public void deleteMovie(Movie movie) throws Exception {&lt;br /&gt;
         entityManager.remove(movie);&lt;br /&gt;
     }&lt;br /&gt;
 &lt;br /&gt;
     @PermitAll&lt;br /&gt;
     public List&amp;lt;Movie&amp;gt; getMovies() throws Exception {&lt;br /&gt;
         Query query = entityManager.createQuery(&amp;quot;SELECT m from Movie as m&amp;quot;);&lt;br /&gt;
         return query.getResultList();&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Code review should look for such annotations.  If present, ensure they reflect the correct roles and permissions, and are consistent with any declared role permissions in the &amp;quot;ejb-jar.xml&amp;quot; file.&lt;br /&gt;
&lt;br /&gt;
==== Framework Specific Configuration ====&lt;br /&gt;
Some application server frameworks offer additional or enhanced security configurations.  Consult the documentation for the particular framework you are using.  Information on some of the more common frameworks follow.&lt;br /&gt;
&lt;br /&gt;
===== Apache Tomcat =====&lt;br /&gt;
The [http://tomcat.apache.org/tomcat-7.0-doc/security-howto.html#server.xml Tomcat server.xml] file defines many security related parameters:&lt;br /&gt;
&lt;br /&gt;
* Server - shutdown port&lt;br /&gt;
* Connectors - maxPostSize, maxParameterCount, server, SSLEnabled, secure, ciphers&lt;br /&gt;
* Host - autoDeploy, deployOnStartup, deployXML&lt;br /&gt;
* Context - crossContext, privileged, allowLinking&lt;br /&gt;
* Filter - Tomcat provides a number of ''filters'' which may be configured to incoming requests&lt;br /&gt;
&lt;br /&gt;
Filters are especially powerful, and a code review should validate they are used unless there is a compelling reason not to.  See [http://tomcat.apache.org/tomcat-7.0-doc/config/filter.html Container Provided Filters] for detailed information.&lt;br /&gt;
&lt;br /&gt;
The server.xml file should be reviewed to ensure security related parameters are configured as expected.&lt;br /&gt;
&lt;br /&gt;
More guidelines on securely deploying Apache Tomcat can be found in the [http://benchmarks.cisecurity.org/downloads/show-single/?file=tomcat.100 CIS Apache Tomcat 5.5/6.x Server Benchmark v1.0.0].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== Jetty =====&lt;br /&gt;
Jetty adds several security enhancements:&lt;br /&gt;
&lt;br /&gt;
* Limiting form content&lt;br /&gt;
* Obfuscating passwords&lt;br /&gt;
&lt;br /&gt;
The maximum form content size and number of form keys can be configured at server and web application level in the &amp;quot;jetty-web.xml&amp;quot; file:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;Configure class=&amp;quot;org.eclipse.jetty.webapp.WebAppContext&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
   ...&lt;br /&gt;
   &lt;br /&gt;
   &amp;lt;Set name=&amp;quot;maxFormContentSize&amp;quot;&amp;gt;200000&amp;lt;/Set&amp;gt;&lt;br /&gt;
   &amp;lt;Set name=&amp;quot;maxFormKeys&amp;quot;&amp;gt;200&amp;lt;/Set&amp;gt;&lt;br /&gt;
 &amp;lt;/Configure&amp;gt;    &lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;configure class=&amp;quot;org.eclipse.jetty.server.Server&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
   ...&lt;br /&gt;
  &lt;br /&gt;
   &amp;lt;Call name=&amp;quot;setAttribute&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;Arg&amp;gt;org.eclipse.jetty.server.Request.maxFormContentSize&amp;lt;/Arg&amp;gt;&lt;br /&gt;
     &amp;lt;Arg&amp;gt;100000&amp;lt;/Arg&amp;gt;&lt;br /&gt;
    &amp;lt;/Call&amp;gt;&lt;br /&gt;
   &amp;lt;Call name=&amp;quot;setAttribute&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;Arg&amp;gt;org.eclipse.jetty.server.Request.maxFormKeys&amp;lt;/Arg&amp;gt;&lt;br /&gt;
     &amp;lt;Arg&amp;gt;2000&amp;lt;/Arg&amp;gt;&lt;br /&gt;
    &amp;lt;/Call&amp;gt;&lt;br /&gt;
 &amp;lt;/configure&amp;gt;      &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Jetty also supports the use of obfuscated passwords in jetty XML files where a plain text password is usually needed. Here's an example setting the password for a JDBC Datasource with obfuscation (the obfuscated password is generated by Jetty org.eclipse.jetty.util.security.Password utility):&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;New id=&amp;quot;DSTest&amp;quot; class=&amp;quot;org.eclipse.jetty.plus.jndi.Resource&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Arg&amp;gt;&amp;lt;/Arg&amp;gt;&lt;br /&gt;
    &amp;lt;Arg&amp;gt;jdbc/DSTest&amp;lt;/Arg&amp;gt;&lt;br /&gt;
    &amp;lt;Arg&amp;gt;&lt;br /&gt;
      &amp;lt;New class=&amp;quot;com.jolbox.bonecp.BoneCPDataSource&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Set name=&amp;quot;driverClass&amp;quot;&amp;gt;com.mysql.jdbc.Driver&amp;lt;/Set&amp;gt;&lt;br /&gt;
        &amp;lt;Set name=&amp;quot;jdbcUrl&amp;quot;&amp;gt;jdbc:mysql://localhost:3306/foo&amp;lt;/Set&amp;gt;&lt;br /&gt;
        &amp;lt;Set name=&amp;quot;username&amp;quot;&amp;gt;dbuser&amp;lt;/Set&amp;gt;&lt;br /&gt;
        '''&amp;lt;Set name=&amp;quot;password&amp;quot;&amp;gt;'''&lt;br /&gt;
           '''&amp;lt;Call class=&amp;quot;org.eclipse.jetty.util.security.Password&amp;quot; name=&amp;quot;deobfuscate&amp;quot;&amp;gt;'''&lt;br /&gt;
                 '''&amp;lt;Arg&amp;gt;OBF:1ri71v1r1v2n1ri71shq1ri71shs1ri71v1r1v2n1ri7&amp;lt;/Arg&amp;gt;'''&lt;br /&gt;
           '''&amp;lt;/Call&amp;gt;'''&lt;br /&gt;
        '''&amp;lt;/Set&amp;gt;'''&lt;br /&gt;
        &amp;lt;Set name=&amp;quot;minConnectionsPerPartition&amp;quot;&amp;gt;5&amp;lt;/Set&amp;gt;&lt;br /&gt;
        &amp;lt;Set name=&amp;quot;maxConnectionsPerPartition&amp;quot;&amp;gt;50&amp;lt;/Set&amp;gt;&lt;br /&gt;
        &amp;lt;Set name=&amp;quot;acquireIncrement&amp;quot;&amp;gt;5&amp;lt;/Set&amp;gt;&lt;br /&gt;
        &amp;lt;Set name=&amp;quot;idleConnectionTestPeriod&amp;quot;&amp;gt;30&amp;lt;/Set&amp;gt;&lt;br /&gt;
     &amp;lt;/New&amp;gt;&lt;br /&gt;
   &amp;lt;/Arg&amp;gt;&lt;br /&gt;
 &amp;lt;/New&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====JBoss AS =====&lt;br /&gt;
JBoss Application Server, like Jetty, allows password obfuscation (called password masking in JBoss) in its XML configuration files.  After using JBoss password utility to create password mask, replace any occurrence of a masked password in XML configuration files with the following annotation:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;annotation&amp;gt;@org.jboss.security.integration.password.Password&lt;br /&gt;
                      (securityDomain=MASK_NAME,methodName=setPROPERTY_NAME)&lt;br /&gt;
 &amp;lt;/annotation&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See [http://docs.jboss.org/jbosssecurity/docs/6.0/security_guide/html_single/#Masking_Passwords Masking Passwords in XML Configuration] in the [http://docs.jboss.org/jbosssecurity/docs/6.0/security_guide/html_single/ JBoss AS Security Guide].&lt;br /&gt;
&lt;br /&gt;
===== Oracle WebLogic =====&lt;br /&gt;
WebLogic server supports additional deployment descriptors in the &amp;quot;weblogic.xml&amp;quot; file:&lt;br /&gt;
&lt;br /&gt;
* externally-defined - role to principal mappings are externally defined in WebLogic Admin Console&lt;br /&gt;
* run-as-principal-name - assign a principal to a role when running as that role&lt;br /&gt;
* run-as-role-assignment - contains the run-as-principal-name descriptor&lt;br /&gt;
* security-permission - contains security-permission-spec descriptor&lt;br /&gt;
* security-permission-spec - specify application permissions as per [http://docs.oracle.com/javase/1.5.0/docs/guide/security/PolicyFiles.html#FileSyntax Java policy file syntax]&lt;br /&gt;
* security-role-assignment - explicitly assign principals to a role&lt;br /&gt;
&lt;br /&gt;
More information on WebLogic additional deployment descriptors may be found at [http://docs.oracle.com/cd/E11035_01/wls100/security/thin_client.html#wp1046262 weblogic.xml Deployment Descriptors].&lt;br /&gt;
&lt;br /&gt;
For general guidelines on securing web applications running within WebLogic, see [http://docs.oracle.com/cd/E11035_01/wls100/security/ Programming WebLogic Security] and the NSA's [http://www.nsa.gov/ia/_files/webs/I33-004R-2005.pdf BEA WebLogic Platform Security Guide].&lt;br /&gt;
&lt;br /&gt;
===== Microsoft IIS =====&lt;br /&gt;
&lt;br /&gt;
=== Programmatic Configuration ===&lt;br /&gt;
&lt;br /&gt;
The JEE API for programmatic security consists of methods of the EJBContext interface and the HttpServletRequest interface. These methods allow components to make business-logic decisions based on the security role of the caller or remote user.&lt;br /&gt;
&lt;br /&gt;
=== References===&lt;/div&gt;</summary>
		<author><name>Jerry Kickenson</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=CRV2_SecDepConfig&amp;diff=165214</id>
		<title>CRV2 SecDepConfig</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=CRV2_SecDepConfig&amp;diff=165214"/>
				<updated>2013-12-31T04:08:46Z</updated>
		
		<summary type="html">&lt;p&gt;Jerry Kickenson: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Secure Deployment Configuration ==&lt;br /&gt;
Web applications do not execute in isolation.  They typically are deployed within an application server framework, running within an operating system on a physical host, within a network.  &lt;br /&gt;
&lt;br /&gt;
Secure operating system configuration (also called hardening) is not typically within the scope of code review.  For more information, see the [http://benchmarks.cisecurity.org/downloads/browse/index.cfm?category=benchmarks.os Center for Internet Security operating system benchmarks].&lt;br /&gt;
&lt;br /&gt;
Networks today consist of much more than routers and switches providing transport services.  Filtering switches, VLANs (virtual LANs), firewalls, WAFs (Web Application Firewall), and various middle boxes (e.g. reverse proxies, intrusion detection and prevention systems) all provide critical security services when configured to do so.   This is a big topic, but outside the scope of this web application code review guide.  For a good summary, see the SANS (System Administration, Networking, and Security) Institute [http://www.sans.org/critical-security-controls/control.php?id=10 Critical Control 10: Secure Configurations for Network Devices such as Firewalls, Routers, and Switches].&lt;br /&gt;
&lt;br /&gt;
Application server frameworks have many security related capabilities.  These capabilities are enabled and configured  declaratively.  Declarative configuration is usually done via static configuration files, typically in XML format, but may also be expressed as annotations within the code.&lt;br /&gt;
&lt;br /&gt;
Some security capabilities are accessible from within a Java program.  Programmatic security is done within the web application, using framework specific or standard Java EE APIs.&lt;br /&gt;
&lt;br /&gt;
=== Declarative Configuration ===&lt;br /&gt;
&lt;br /&gt;
When implemented using the Java Enterprise Edition (JEE) framework, the [http://docs.oracle.com/javaee/6/tutorial/doc/bnbwk.html JEE security model] may be used.  JEE uses a role-based security model, in which access to application resources is granted based on the security role. The security role is a logical grouping of principals (authenticated entities, usually a user), and access is declared by specifying a ''security constraint'' on the role.&lt;br /&gt;
&lt;br /&gt;
==== Deployment Descriptor Configuration ====&lt;br /&gt;
The constraints and roles are expressed as ''deployment descriptors'' expressed as XML elements.  Different types of components use different formats, or schemas, for their deployment descriptors:&lt;br /&gt;
&lt;br /&gt;
* Web components may use a web application deployment descriptor in the file ''web.xml''&lt;br /&gt;
* Enterprise JavaBeans components may use an EJB deployment descriptor named ''META-INF/ejb-jar.xml''&lt;br /&gt;
&lt;br /&gt;
In summary, the deployment descriptor can define resources (e.g. servlets accessible via a specific URL), which roles are authorized to access the resource, and how access is constrained (e.g. via GET but not POST).  &lt;br /&gt;
&lt;br /&gt;
The following example web component descriptor, included in the &amp;quot;web.xml&amp;quot; file, defines a Catalog servlet, a &amp;quot;manager&amp;quot; role, a SalesInfo resource within the servlet accessible via GET and POST requests, and specifies that only users with &amp;quot;manager&amp;quot; role, using SSL and successfully using HTTP basic authentication should be granted access:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;ISO-8859-1&amp;quot;?&amp;gt;&lt;br /&gt;
 &amp;lt;web-app xmlns=&amp;quot;http://java.sun.com/xml/ns/j2ee&amp;quot;&lt;br /&gt;
   xmlns:xsi=&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot;&lt;br /&gt;
   xsi:schemaLocation=&amp;quot;http://java.sun.com/xml/ns/j2ee&lt;br /&gt;
    http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd&amp;quot; version=?2.5?&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
     &amp;lt;display-name&amp;gt;A Secure Application&amp;lt;/display-name&amp;gt;&lt;br /&gt;
     &amp;lt;servlet&amp;gt;&lt;br /&gt;
       &amp;lt;servlet-name&amp;gt;catalog&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;
       &amp;lt;servlet-class&amp;gt;com.mycorp.CatalogServlet&amp;lt;/servlet-class&amp;gt;&lt;br /&gt;
       &amp;lt;init-param&amp;gt;&lt;br /&gt;
         &amp;lt;param-name&amp;gt;catalog&amp;lt;/param-name&amp;gt;&lt;br /&gt;
         &amp;lt;param-value&amp;gt;Spring&amp;lt;/param-value&amp;gt;&lt;br /&gt;
       &amp;lt;/init-param&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
       &amp;lt;nowiki&amp;gt;&amp;lt;!-- Define Security Roles --&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
       &amp;lt;security-role-ref&amp;gt;&lt;br /&gt;
         &amp;lt;role-name&amp;gt;MGR&amp;lt;/role-name&amp;gt;&lt;br /&gt;
         &amp;lt;!-- role name used in code --&amp;gt;&lt;br /&gt;
         &amp;lt;role-link&amp;gt;manager&amp;lt;/role-link&amp;gt;&lt;br /&gt;
       &amp;lt;/security-role-ref&amp;gt;&lt;br /&gt;
     &amp;lt;/servlet&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
     &amp;lt;security-role&amp;gt;&lt;br /&gt;
       &amp;lt;role-name&amp;gt;manager&amp;lt;/role-name&amp;gt;&lt;br /&gt;
     &amp;lt;/security-role&amp;gt;&lt;br /&gt;
     &amp;lt;servlet-mapping&amp;gt;&lt;br /&gt;
       &amp;lt;servlet-name&amp;gt;catalog&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;
       &amp;lt;url-pattern&amp;gt;/catalog/*&amp;lt;/url-pattern&amp;gt;&lt;br /&gt;
     &amp;lt;/servlet-mapping&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
     &amp;lt;nowiki&amp;gt;&amp;lt;!-- Define A Security Constraint --&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
     &amp;lt;security-constraint&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
     &amp;lt;nowiki&amp;gt;&amp;lt;!-- Specify the Resources to be Protected --&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
     &amp;lt;web-resource-collection&amp;gt;&lt;br /&gt;
       &amp;lt;web-resource-name&amp;gt;SalesInfo&amp;lt;/web-resource-name&amp;gt;&lt;br /&gt;
       &amp;lt;url-pattern&amp;gt;/salesinfo/*&amp;lt;/url-pattern&amp;gt;&lt;br /&gt;
       &amp;lt;http-method&amp;gt;GET&amp;lt;/http-method&amp;gt;&lt;br /&gt;
       &amp;lt;http-method&amp;gt;POST&amp;lt;/http-method&amp;gt;&lt;br /&gt;
      &amp;lt;/web-resource-collection&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
     &amp;lt;nowiki&amp;gt;&amp;lt;!-- Specify which Users Can Access Protected Resources --&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
     &amp;lt;auth-constraint&amp;gt;&lt;br /&gt;
       &amp;lt;role-name&amp;gt;manager&amp;lt;/role-name&amp;gt;&lt;br /&gt;
     &amp;lt;/auth-constraint&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
     &amp;lt;nowiki&amp;gt;&amp;lt;!-- Specify Secure Transport using SSL (confidential guarantee) --&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
     &amp;lt;user-data-constraint&amp;gt;&lt;br /&gt;
       &amp;lt;transport-guarantee&amp;gt;CONFIDENTIAL&amp;lt;/transport-guarantee&amp;gt;&lt;br /&gt;
     &amp;lt;/user-data-constraint&amp;gt;&lt;br /&gt;
     &amp;lt;/security-constraint&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
     &amp;lt;nowiki&amp;gt;&amp;lt;!-- Specify HTTP Basic Authentication Method --&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
     &amp;lt;login-config&amp;gt;&lt;br /&gt;
       &amp;lt;auth-method&amp;gt;BASIC&amp;lt;/auth-method&amp;gt;&lt;br /&gt;
       &amp;lt;realm-name&amp;gt;file&amp;lt;/realm-name&amp;gt;&lt;br /&gt;
     &amp;lt;/login-config&amp;gt;&lt;br /&gt;
 &amp;lt;/web-app&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Security roles can also be declared for enterprise Java beans in the &amp;quot;ejb-jar.xml&amp;quot; file.  For example:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;!-- A sample ejb-jar.xml fragment --&amp;gt;&lt;br /&gt;
  &amp;lt;ejb-jar&amp;gt;&lt;br /&gt;
     &amp;lt;!-- ... --&amp;gt;&lt;br /&gt;
     &amp;lt;assembly-descriptor&amp;gt;&lt;br /&gt;
         &amp;lt;security-role&amp;gt;&lt;br /&gt;
             &amp;lt;description&amp;gt;The single application role&amp;lt;/description&amp;gt;&lt;br /&gt;
             &amp;lt;role-name&amp;gt;TheApplicationRole&amp;lt;/role-name&amp;gt;&lt;br /&gt;
         &amp;lt;/security-role&amp;gt;&lt;br /&gt;
     &amp;lt;/assembly-descriptor&amp;gt;&lt;br /&gt;
 &amp;lt;/ejb-jar&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For beans, however, rather than specifying access to resources within servlets, access to bean methods is specified.  The following example illustrates several types of method access constraints for several beans:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;ejb-jar&amp;gt;&lt;br /&gt;
     &amp;lt;assembly-descriptor&amp;gt;&lt;br /&gt;
         &amp;lt;method-permission&amp;gt;&lt;br /&gt;
             &amp;lt;description&amp;gt;The employee and temp-employee roles may access any&lt;br /&gt;
                 method of the EmployeeService bean &amp;lt;/description&amp;gt;&lt;br /&gt;
             &amp;lt;role-name&amp;gt;employee&amp;lt;/role-name&amp;gt;&lt;br /&gt;
             &amp;lt;role-name&amp;gt;temp-employee&amp;lt;/role-name&amp;gt;&lt;br /&gt;
             &amp;lt;method&amp;gt;&lt;br /&gt;
                 &amp;lt;ejb-name&amp;gt;EmployeeService&amp;lt;/ejb-name&amp;gt;&lt;br /&gt;
                 &amp;lt;method-name&amp;gt;*&amp;lt;/method-name&amp;gt;&lt;br /&gt;
             &amp;lt;/method&amp;gt;&lt;br /&gt;
         &amp;lt;/method-permission&amp;gt;&lt;br /&gt;
         &amp;lt;method-permission&amp;gt;&lt;br /&gt;
             &amp;lt;description&amp;gt;The employee role may access the findByPrimaryKey,&lt;br /&gt;
                 getEmployeeInfo, and the updateEmployeeInfo(String) method of&lt;br /&gt;
                 the AardvarkPayroll bean &amp;lt;/description&amp;gt;&lt;br /&gt;
             &amp;lt;role-name&amp;gt;employee&amp;lt;/role-name&amp;gt;&lt;br /&gt;
             &amp;lt;method&amp;gt;&lt;br /&gt;
                 &amp;lt;ejb-name&amp;gt;AardvarkPayroll&amp;lt;/ejb-name&amp;gt;&lt;br /&gt;
                 &amp;lt;method-name&amp;gt;findByPrimaryKey&amp;lt;/method-name&amp;gt;&lt;br /&gt;
             &amp;lt;/method&amp;gt;&lt;br /&gt;
             &amp;lt;method&amp;gt;&lt;br /&gt;
                 &amp;lt;ejb-name&amp;gt;AardvarkPayroll&amp;lt;/ejb-name&amp;gt;&lt;br /&gt;
                 &amp;lt;method-name&amp;gt;getEmployeeInfo&amp;lt;/method-name&amp;gt;&lt;br /&gt;
             &amp;lt;/method&amp;gt;&lt;br /&gt;
             &amp;lt;method&amp;gt;&lt;br /&gt;
                 &amp;lt;ejb-name&amp;gt;AardvarkPayroll&amp;lt;/ejb-name&amp;gt;&lt;br /&gt;
                 &amp;lt;method-name&amp;gt;updateEmployeeInfo&amp;lt;/method-name&amp;gt;&lt;br /&gt;
                 &amp;lt;method-params&amp;gt;&lt;br /&gt;
                     &amp;lt;method-param&amp;gt;java.lang.String&amp;lt;/method-param&amp;gt;&lt;br /&gt;
                 &amp;lt;/method-params&amp;gt;&lt;br /&gt;
             &amp;lt;/method&amp;gt;&lt;br /&gt;
         &amp;lt;/method-permission&amp;gt;&lt;br /&gt;
         &amp;lt;method-permission&amp;gt;&lt;br /&gt;
             &amp;lt;description&amp;gt;The admin role may access any method of the&lt;br /&gt;
                 EmployeeServiceAdmin bean &amp;lt;/description&amp;gt;&lt;br /&gt;
             &amp;lt;role-name&amp;gt;admin&amp;lt;/role-name&amp;gt;&lt;br /&gt;
             &amp;lt;method&amp;gt;&lt;br /&gt;
                 &amp;lt;ejb-name&amp;gt;EmployeeServiceAdmin&amp;lt;/ejb-name&amp;gt;&lt;br /&gt;
                 &amp;lt;method-name&amp;gt;*&amp;lt;/method-name&amp;gt;&lt;br /&gt;
             &amp;lt;/method&amp;gt;&lt;br /&gt;
         &amp;lt;/method-permission&amp;gt;&lt;br /&gt;
         &amp;lt;method-permission&amp;gt;&lt;br /&gt;
             &amp;lt;description&amp;gt;Any authenticated user may access any method of the&lt;br /&gt;
                 EmployeeServiceHelp bean&amp;lt;/description&amp;gt;&lt;br /&gt;
             &amp;lt;unchecked/&amp;gt;&lt;br /&gt;
             &amp;lt;method&amp;gt;&lt;br /&gt;
                 &amp;lt;ejb-name&amp;gt;EmployeeServiceHelp&amp;lt;/ejb-name&amp;gt;&lt;br /&gt;
                 &amp;lt;method-name&amp;gt;*&amp;lt;/method-name&amp;gt;&lt;br /&gt;
             &amp;lt;/method&amp;gt;&lt;br /&gt;
         &amp;lt;/method-permission&amp;gt;&lt;br /&gt;
         &amp;lt;exclude-list&amp;gt;&lt;br /&gt;
             &amp;lt;description&amp;gt;No fireTheCTO methods of the EmployeeFiring bean may be&lt;br /&gt;
                 used in this deployment&amp;lt;/description&amp;gt;&lt;br /&gt;
             &amp;lt;method&amp;gt;&lt;br /&gt;
                 &amp;lt;ejb-name&amp;gt;EmployeeFiring&amp;lt;/ejb-name&amp;gt;&lt;br /&gt;
                 &amp;lt;method-name&amp;gt;fireTheCTO&amp;lt;/method-name&amp;gt;&lt;br /&gt;
             &amp;lt;/method&amp;gt;&lt;br /&gt;
         &amp;lt;/exclude-list&amp;gt;&lt;br /&gt;
     &amp;lt;/assembly-descriptor&amp;gt;&lt;br /&gt;
 &amp;lt;/ejb-jar&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 Source: [https://access.redhat.com/site/documentation/en-US/JBoss_Enterprise_Application_Platform_Common_Criteria_Certification/5/html/Security_Guide/index.html JBoss Enterprise Application Platform Common Criteria Certification 5]&lt;br /&gt;
              [https://access.redhat.com/site/documentation/en-US/JBoss_Enterprise_Application_Platform_Common_Criteria_Certification/5/html/Security_Guide/index.html Security Guide]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If XML deployment descriptors are used to secure the application, code review should include the &amp;quot;web.xml&amp;quot; and &amp;quot;ejb-jar.xml&amp;quot; files to ensure that access controls are properly applied to the correct roles, and authentication methods are as expected.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Annotations ====&lt;br /&gt;
JEE annotations for security are defined in the [http://docs.oracle.com/javaee/6/api/javax/annotation/security/package-summary.html javax.annotation.security] package.  The available annotations are:&lt;br /&gt;
&lt;br /&gt;
 @DeclareRoles&lt;br /&gt;
 @DenyAll - no roles may invoke the method&lt;br /&gt;
 @PermitAll - all roles may invoke the method&lt;br /&gt;
 @RolesAllowed - roles permitted to invoke the method&lt;br /&gt;
 @RunAs - dynamically run the method as a particular role&lt;br /&gt;
&lt;br /&gt;
For example, the following code snippet allows employees and managers to add movies to the persistent store, anyone to list movies, but only managers may delete movies:&lt;br /&gt;
&lt;br /&gt;
 public class Movies {&lt;br /&gt;
 &lt;br /&gt;
     private EntityManager entityManager;&lt;br /&gt;
 &lt;br /&gt;
     @RolesAllowed({&amp;quot;Employee&amp;quot;, &amp;quot;Manager&amp;quot;})&lt;br /&gt;
     public void addMovie(Movie movie) throws Exception {&lt;br /&gt;
         entityManager.persist(movie);&lt;br /&gt;
     }&lt;br /&gt;
 &lt;br /&gt;
     @RolesAllowed({&amp;quot;Manager&amp;quot;})&lt;br /&gt;
     public void deleteMovie(Movie movie) throws Exception {&lt;br /&gt;
         entityManager.remove(movie);&lt;br /&gt;
     }&lt;br /&gt;
 &lt;br /&gt;
     @PermitAll&lt;br /&gt;
     public List&amp;lt;Movie&amp;gt; getMovies() throws Exception {&lt;br /&gt;
         Query query = entityManager.createQuery(&amp;quot;SELECT m from Movie as m&amp;quot;);&lt;br /&gt;
         return query.getResultList();&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Code review should look for such annotations.  If present, ensure they reflect the correct roles and permissions, and are consistent with any declared role permissions in the &amp;quot;ejb-jar.xml&amp;quot; file.&lt;br /&gt;
&lt;br /&gt;
==== Framework Specific Configuration ====&lt;br /&gt;
Some application server frameworks offer additional or enhanced security configurations.  Consult the documentation for the particular framework you are using.  Information on some of the more common frameworks follow.&lt;br /&gt;
&lt;br /&gt;
===== Apache Tomcat =====&lt;br /&gt;
The [http://tomcat.apache.org/tomcat-7.0-doc/security-howto.html#server.xml Tomcat server.xml] file defines many security related parameters:&lt;br /&gt;
&lt;br /&gt;
* Server - shutdown port&lt;br /&gt;
* Connectors - maxPostSize, maxParameterCount, server, SSLEnabled, secure, ciphers&lt;br /&gt;
* Host - autoDeploy, deployOnStartup, deployXML&lt;br /&gt;
* Context - crossContext, privileged, allowLinking&lt;br /&gt;
* Filter - Tomcat provides a number of ''filters'' which may be configured to incoming requests&lt;br /&gt;
&lt;br /&gt;
Filters are especially powerful, and a code review should validate they are used unless there is a compelling reason not to.  See [http://tomcat.apache.org/tomcat-7.0-doc/config/filter.html Container Provided Filters] for detailed information.&lt;br /&gt;
&lt;br /&gt;
The server.xml file should be reviewed to ensure security related parameters are configured as expected.&lt;br /&gt;
&lt;br /&gt;
More guidelines on securely deploying Apache Tomcat can be found in the [http://benchmarks.cisecurity.org/downloads/show-single/?file=tomcat.100 CIS Apache Tomcat 5.5/6.x Server Benchmark v1.0.0].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== Jetty =====&lt;br /&gt;
Jetty adds several security enhancements:&lt;br /&gt;
&lt;br /&gt;
* Limiting form content&lt;br /&gt;
* Obfuscating passwords&lt;br /&gt;
&lt;br /&gt;
The maximum form content size and number of form keys can be configured at server and web application level in the &amp;quot;jetty-web.xml&amp;quot; file:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;Configure class=&amp;quot;org.eclipse.jetty.webapp.WebAppContext&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
   ...&lt;br /&gt;
   &lt;br /&gt;
   &amp;lt;Set name=&amp;quot;maxFormContentSize&amp;quot;&amp;gt;200000&amp;lt;/Set&amp;gt;&lt;br /&gt;
   &amp;lt;Set name=&amp;quot;maxFormKeys&amp;quot;&amp;gt;200&amp;lt;/Set&amp;gt;&lt;br /&gt;
 &amp;lt;/Configure&amp;gt;    &lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;configure class=&amp;quot;org.eclipse.jetty.server.Server&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
   ...&lt;br /&gt;
  &lt;br /&gt;
   &amp;lt;Call name=&amp;quot;setAttribute&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;Arg&amp;gt;org.eclipse.jetty.server.Request.maxFormContentSize&amp;lt;/Arg&amp;gt;&lt;br /&gt;
     &amp;lt;Arg&amp;gt;100000&amp;lt;/Arg&amp;gt;&lt;br /&gt;
    &amp;lt;/Call&amp;gt;&lt;br /&gt;
   &amp;lt;Call name=&amp;quot;setAttribute&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;Arg&amp;gt;org.eclipse.jetty.server.Request.maxFormKeys&amp;lt;/Arg&amp;gt;&lt;br /&gt;
     &amp;lt;Arg&amp;gt;2000&amp;lt;/Arg&amp;gt;&lt;br /&gt;
    &amp;lt;/Call&amp;gt;&lt;br /&gt;
 &amp;lt;/configure&amp;gt;      &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Jetty also supports the use of obfuscated passwords in jetty XML files where a plain text password is usually needed. Here's an example setting the password for a JDBC Datasource with obfuscation (the obfuscated password is generated by Jetty org.eclipse.jetty.util.security.Password utility):&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;New id=&amp;quot;DSTest&amp;quot; class=&amp;quot;org.eclipse.jetty.plus.jndi.Resource&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Arg&amp;gt;&amp;lt;/Arg&amp;gt;&lt;br /&gt;
    &amp;lt;Arg&amp;gt;jdbc/DSTest&amp;lt;/Arg&amp;gt;&lt;br /&gt;
    &amp;lt;Arg&amp;gt;&lt;br /&gt;
      &amp;lt;New class=&amp;quot;com.jolbox.bonecp.BoneCPDataSource&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Set name=&amp;quot;driverClass&amp;quot;&amp;gt;com.mysql.jdbc.Driver&amp;lt;/Set&amp;gt;&lt;br /&gt;
        &amp;lt;Set name=&amp;quot;jdbcUrl&amp;quot;&amp;gt;jdbc:mysql://localhost:3306/foo&amp;lt;/Set&amp;gt;&lt;br /&gt;
        &amp;lt;Set name=&amp;quot;username&amp;quot;&amp;gt;dbuser&amp;lt;/Set&amp;gt;&lt;br /&gt;
        '''&amp;lt;Set name=&amp;quot;password&amp;quot;&amp;gt;'''&lt;br /&gt;
           '''&amp;lt;Call class=&amp;quot;org.eclipse.jetty.util.security.Password&amp;quot; name=&amp;quot;deobfuscate&amp;quot;&amp;gt;'''&lt;br /&gt;
                 '''&amp;lt;Arg&amp;gt;OBF:1ri71v1r1v2n1ri71shq1ri71shs1ri71v1r1v2n1ri7&amp;lt;/Arg&amp;gt;'''&lt;br /&gt;
           '''&amp;lt;/Call&amp;gt;'''&lt;br /&gt;
        '''&amp;lt;/Set&amp;gt;'''&lt;br /&gt;
        &amp;lt;Set name=&amp;quot;minConnectionsPerPartition&amp;quot;&amp;gt;5&amp;lt;/Set&amp;gt;&lt;br /&gt;
        &amp;lt;Set name=&amp;quot;maxConnectionsPerPartition&amp;quot;&amp;gt;50&amp;lt;/Set&amp;gt;&lt;br /&gt;
        &amp;lt;Set name=&amp;quot;acquireIncrement&amp;quot;&amp;gt;5&amp;lt;/Set&amp;gt;&lt;br /&gt;
        &amp;lt;Set name=&amp;quot;idleConnectionTestPeriod&amp;quot;&amp;gt;30&amp;lt;/Set&amp;gt;&lt;br /&gt;
     &amp;lt;/New&amp;gt;&lt;br /&gt;
   &amp;lt;/Arg&amp;gt;&lt;br /&gt;
 &amp;lt;/New&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====JBoss AS =====&lt;br /&gt;
JBoss Application Server, like Jetty, allows password obfuscation (called password masking in JBoss) in its XML configuration files.  After using JBoss password utility to create password mask, replace any occurrence of a masked password in XML configuration files with the following annotation:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;annotation&amp;gt;@org.jboss.security.integration.password.Password&lt;br /&gt;
                      (securityDomain=MASK_NAME,methodName=setPROPERTY_NAME)&lt;br /&gt;
 &amp;lt;/annotation&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See [http://docs.jboss.org/jbosssecurity/docs/6.0/security_guide/html_single/#Masking_Passwords Masking Passwords in XML Configuration] in the [http://docs.jboss.org/jbosssecurity/docs/6.0/security_guide/html_single/ JBoss AS Security Guide].&lt;br /&gt;
&lt;br /&gt;
===== Oracle WebLogic =====&lt;br /&gt;
WebLogic server supports additional deployment descriptors in the &amp;quot;weblogic.xml&amp;quot; file:&lt;br /&gt;
&lt;br /&gt;
* externally-defined - role to principal mappings are externally defined in WebLogic Admin Console&lt;br /&gt;
* run-as-principal-name - assign a principal to a role when running as that role&lt;br /&gt;
* run-as-role-assignment - contains the run-as-principal-name descriptor&lt;br /&gt;
* security-permission - contains security-permission-spec descriptor&lt;br /&gt;
* security-permission-spec - specify application permissions as per [http://docs.oracle.com/javase/1.5.0/docs/guide/security/PolicyFiles.html#FileSyntax Java policy file syntax]&lt;br /&gt;
* security-role-assignment - explicitly assign principals to a role&lt;br /&gt;
&lt;br /&gt;
More information on WebLogic additional deployment descriptors may be found at [http://docs.oracle.com/cd/E11035_01/wls100/security/thin_client.html#wp1046262 weblogic.xml Deployment Descriptors].&lt;br /&gt;
&lt;br /&gt;
For general guidelines on securing web applications running within WebLogic, see [http://docs.oracle.com/cd/E11035_01/wls100/security/ Programming WebLogic Security] and the NSA's [http://www.nsa.gov/ia/_files/webs/I33-004R-2005.pdf BEA WebLogic Platform Security Guide].&lt;br /&gt;
&lt;br /&gt;
===== Microsoft IIS =====&lt;br /&gt;
&lt;br /&gt;
=== Programmatic Configuration ===&lt;br /&gt;
&lt;br /&gt;
The JEE API for programmatic security consists of methods of the EJBContext interface and the HttpServletRequest interface. These methods allow components to make business-logic decisions based on the security role of the caller or remote user.&lt;/div&gt;</summary>
		<author><name>Jerry Kickenson</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=CRV2_SecDepConfig&amp;diff=165213</id>
		<title>CRV2 SecDepConfig</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=CRV2_SecDepConfig&amp;diff=165213"/>
				<updated>2013-12-31T03:53:07Z</updated>
		
		<summary type="html">&lt;p&gt;Jerry Kickenson: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Secure Deployment Configuration ==&lt;br /&gt;
Web applications do not execute in isolation.  They typically are deployed within an application server framework, running within an operating system on a physical host, within a network.  &lt;br /&gt;
&lt;br /&gt;
Secure operating system configuration (also called hardening) is not typically within the scope of code review.  For more information, see the [http://benchmarks.cisecurity.org/downloads/browse/index.cfm?category=benchmarks.os Center for Internet Security operating system benchmarks].&lt;br /&gt;
&lt;br /&gt;
Networks today consist of much more than routers and switches providing transport services.  Filtering switches, VLANs (virtual LANs), firewalls, WAFs (Web Application Firewall), and various middle boxes (e.g. reverse proxies, intrusion detection and prevention systems) all provide critical security services when configured to do so.   This is a big topic, but outside the scope of this web application code review guide.  For a good summary, see the SANS (System Administration, Networking, and Security) Institute [http://www.sans.org/critical-security-controls/control.php?id=10 Critical Control 10: Secure Configurations for Network Devices such as Firewalls, Routers, and Switches].&lt;br /&gt;
&lt;br /&gt;
Application server frameworks have many security related capabilities.  These capabilities are enabled and configured  declaratively.  Declarative configuration is usually done via static configuration files, typically in XML format, but may also be expressed as annotations within the code.&lt;br /&gt;
&lt;br /&gt;
Some security capabilities are accessible from within a Java program.  Programmatic security is done within the web application, using framework specific or standard Java EE APIs.&lt;br /&gt;
&lt;br /&gt;
=== Declarative Configuration ===&lt;br /&gt;
&lt;br /&gt;
When implemented using the Java Enterprise Edition (JEE) framework, the [http://docs.oracle.com/javaee/6/tutorial/doc/bnbwk.html JEE security model] may be used.  JEE uses a role-based security model, in which access to application resources is granted based on the security role. The security role is a logical grouping of principals (authenticated entities, usually a user), and access is declared by specifying a ''security constraint'' on the role.&lt;br /&gt;
&lt;br /&gt;
==== Deployment Descriptor Configuration ====&lt;br /&gt;
The constraints and roles are expressed as ''deployment descriptors'' expressed as XML elements.  Different types of components use different formats, or schemas, for their deployment descriptors:&lt;br /&gt;
&lt;br /&gt;
* Web components may use a web application deployment descriptor in the file ''web.xml''&lt;br /&gt;
* Enterprise JavaBeans components may use an EJB deployment descriptor named ''META-INF/ejb-jar.xml''&lt;br /&gt;
&lt;br /&gt;
In summary, the deployment descriptor can define resources (e.g. servlets accessible via a specific URL), which roles are authorized to access the resource, and how access is constrained (e.g. via GET but not POST).  &lt;br /&gt;
&lt;br /&gt;
The following example web component descriptor, included in the &amp;quot;web.xml&amp;quot; file, defines a Catalog servlet, a &amp;quot;manager&amp;quot; role, a SalesInfo resource within the servlet accessible via GET and POST requests, and specifies that only users with &amp;quot;manager&amp;quot; role, using SSL and successfully using HTTP basic authentication should be granted access:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;ISO-8859-1&amp;quot;?&amp;gt;&lt;br /&gt;
 &amp;lt;web-app xmlns=&amp;quot;http://java.sun.com/xml/ns/j2ee&amp;quot;&lt;br /&gt;
   xmlns:xsi=&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot;&lt;br /&gt;
   xsi:schemaLocation=&amp;quot;http://java.sun.com/xml/ns/j2ee&lt;br /&gt;
    http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd&amp;quot; version=?2.5?&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
     &amp;lt;display-name&amp;gt;A Secure Application&amp;lt;/display-name&amp;gt;&lt;br /&gt;
     &amp;lt;servlet&amp;gt;&lt;br /&gt;
       &amp;lt;servlet-name&amp;gt;catalog&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;
       &amp;lt;servlet-class&amp;gt;com.mycorp.CatalogServlet&amp;lt;/servlet-class&amp;gt;&lt;br /&gt;
       &amp;lt;init-param&amp;gt;&lt;br /&gt;
         &amp;lt;param-name&amp;gt;catalog&amp;lt;/param-name&amp;gt;&lt;br /&gt;
         &amp;lt;param-value&amp;gt;Spring&amp;lt;/param-value&amp;gt;&lt;br /&gt;
       &amp;lt;/init-param&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
       &amp;lt;nowiki&amp;gt;&amp;lt;!-- Define Security Roles --&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
       &amp;lt;security-role-ref&amp;gt;&lt;br /&gt;
         &amp;lt;role-name&amp;gt;MGR&amp;lt;/role-name&amp;gt;&lt;br /&gt;
         &amp;lt;!-- role name used in code --&amp;gt;&lt;br /&gt;
         &amp;lt;role-link&amp;gt;manager&amp;lt;/role-link&amp;gt;&lt;br /&gt;
       &amp;lt;/security-role-ref&amp;gt;&lt;br /&gt;
     &amp;lt;/servlet&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
     &amp;lt;security-role&amp;gt;&lt;br /&gt;
       &amp;lt;role-name&amp;gt;manager&amp;lt;/role-name&amp;gt;&lt;br /&gt;
     &amp;lt;/security-role&amp;gt;&lt;br /&gt;
     &amp;lt;servlet-mapping&amp;gt;&lt;br /&gt;
       &amp;lt;servlet-name&amp;gt;catalog&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;
       &amp;lt;url-pattern&amp;gt;/catalog/*&amp;lt;/url-pattern&amp;gt;&lt;br /&gt;
     &amp;lt;/servlet-mapping&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
     &amp;lt;nowiki&amp;gt;&amp;lt;!-- Define A Security Constraint --&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
     &amp;lt;security-constraint&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
     &amp;lt;nowiki&amp;gt;&amp;lt;!-- Specify the Resources to be Protected --&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
     &amp;lt;web-resource-collection&amp;gt;&lt;br /&gt;
       &amp;lt;web-resource-name&amp;gt;SalesInfo&amp;lt;/web-resource-name&amp;gt;&lt;br /&gt;
       &amp;lt;url-pattern&amp;gt;/salesinfo/*&amp;lt;/url-pattern&amp;gt;&lt;br /&gt;
       &amp;lt;http-method&amp;gt;GET&amp;lt;/http-method&amp;gt;&lt;br /&gt;
       &amp;lt;http-method&amp;gt;POST&amp;lt;/http-method&amp;gt;&lt;br /&gt;
      &amp;lt;/web-resource-collection&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
     &amp;lt;nowiki&amp;gt;&amp;lt;!-- Specify which Users Can Access Protected Resources --&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
     &amp;lt;auth-constraint&amp;gt;&lt;br /&gt;
       &amp;lt;role-name&amp;gt;manager&amp;lt;/role-name&amp;gt;&lt;br /&gt;
     &amp;lt;/auth-constraint&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
     &amp;lt;nowiki&amp;gt;&amp;lt;!-- Specify Secure Transport using SSL (confidential guarantee) --&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
     &amp;lt;user-data-constraint&amp;gt;&lt;br /&gt;
       &amp;lt;transport-guarantee&amp;gt;CONFIDENTIAL&amp;lt;/transport-guarantee&amp;gt;&lt;br /&gt;
     &amp;lt;/user-data-constraint&amp;gt;&lt;br /&gt;
     &amp;lt;/security-constraint&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
     &amp;lt;nowiki&amp;gt;&amp;lt;!-- Specify HTTP Basic Authentication Method --&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
     &amp;lt;login-config&amp;gt;&lt;br /&gt;
       &amp;lt;auth-method&amp;gt;BASIC&amp;lt;/auth-method&amp;gt;&lt;br /&gt;
       &amp;lt;realm-name&amp;gt;file&amp;lt;/realm-name&amp;gt;&lt;br /&gt;
     &amp;lt;/login-config&amp;gt;&lt;br /&gt;
 &amp;lt;/web-app&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Security roles can also be declared for enterprise Java beans in the &amp;quot;ejb-jar.xml&amp;quot; file.  For example:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;!-- A sample ejb-jar.xml fragment --&amp;gt;&lt;br /&gt;
  &amp;lt;ejb-jar&amp;gt;&lt;br /&gt;
     &amp;lt;!-- ... --&amp;gt;&lt;br /&gt;
     &amp;lt;assembly-descriptor&amp;gt;&lt;br /&gt;
         &amp;lt;security-role&amp;gt;&lt;br /&gt;
             &amp;lt;description&amp;gt;The single application role&amp;lt;/description&amp;gt;&lt;br /&gt;
             &amp;lt;role-name&amp;gt;TheApplicationRole&amp;lt;/role-name&amp;gt;&lt;br /&gt;
         &amp;lt;/security-role&amp;gt;&lt;br /&gt;
     &amp;lt;/assembly-descriptor&amp;gt;&lt;br /&gt;
 &amp;lt;/ejb-jar&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For beans, however, rather than specifying access to resources within servlets, access to bean methods is specified.  The following example illustrates several types of method access constraints for several beans:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;ejb-jar&amp;gt;&lt;br /&gt;
     &amp;lt;assembly-descriptor&amp;gt;&lt;br /&gt;
         &amp;lt;method-permission&amp;gt;&lt;br /&gt;
             &amp;lt;description&amp;gt;The employee and temp-employee roles may access any&lt;br /&gt;
                 method of the EmployeeService bean &amp;lt;/description&amp;gt;&lt;br /&gt;
             &amp;lt;role-name&amp;gt;employee&amp;lt;/role-name&amp;gt;&lt;br /&gt;
             &amp;lt;role-name&amp;gt;temp-employee&amp;lt;/role-name&amp;gt;&lt;br /&gt;
             &amp;lt;method&amp;gt;&lt;br /&gt;
                 &amp;lt;ejb-name&amp;gt;EmployeeService&amp;lt;/ejb-name&amp;gt;&lt;br /&gt;
                 &amp;lt;method-name&amp;gt;*&amp;lt;/method-name&amp;gt;&lt;br /&gt;
             &amp;lt;/method&amp;gt;&lt;br /&gt;
         &amp;lt;/method-permission&amp;gt;&lt;br /&gt;
         &amp;lt;method-permission&amp;gt;&lt;br /&gt;
             &amp;lt;description&amp;gt;The employee role may access the findByPrimaryKey,&lt;br /&gt;
                 getEmployeeInfo, and the updateEmployeeInfo(String) method of&lt;br /&gt;
                 the AardvarkPayroll bean &amp;lt;/description&amp;gt;&lt;br /&gt;
             &amp;lt;role-name&amp;gt;employee&amp;lt;/role-name&amp;gt;&lt;br /&gt;
             &amp;lt;method&amp;gt;&lt;br /&gt;
                 &amp;lt;ejb-name&amp;gt;AardvarkPayroll&amp;lt;/ejb-name&amp;gt;&lt;br /&gt;
                 &amp;lt;method-name&amp;gt;findByPrimaryKey&amp;lt;/method-name&amp;gt;&lt;br /&gt;
             &amp;lt;/method&amp;gt;&lt;br /&gt;
             &amp;lt;method&amp;gt;&lt;br /&gt;
                 &amp;lt;ejb-name&amp;gt;AardvarkPayroll&amp;lt;/ejb-name&amp;gt;&lt;br /&gt;
                 &amp;lt;method-name&amp;gt;getEmployeeInfo&amp;lt;/method-name&amp;gt;&lt;br /&gt;
             &amp;lt;/method&amp;gt;&lt;br /&gt;
             &amp;lt;method&amp;gt;&lt;br /&gt;
                 &amp;lt;ejb-name&amp;gt;AardvarkPayroll&amp;lt;/ejb-name&amp;gt;&lt;br /&gt;
                 &amp;lt;method-name&amp;gt;updateEmployeeInfo&amp;lt;/method-name&amp;gt;&lt;br /&gt;
                 &amp;lt;method-params&amp;gt;&lt;br /&gt;
                     &amp;lt;method-param&amp;gt;java.lang.String&amp;lt;/method-param&amp;gt;&lt;br /&gt;
                 &amp;lt;/method-params&amp;gt;&lt;br /&gt;
             &amp;lt;/method&amp;gt;&lt;br /&gt;
         &amp;lt;/method-permission&amp;gt;&lt;br /&gt;
         &amp;lt;method-permission&amp;gt;&lt;br /&gt;
             &amp;lt;description&amp;gt;The admin role may access any method of the&lt;br /&gt;
                 EmployeeServiceAdmin bean &amp;lt;/description&amp;gt;&lt;br /&gt;
             &amp;lt;role-name&amp;gt;admin&amp;lt;/role-name&amp;gt;&lt;br /&gt;
             &amp;lt;method&amp;gt;&lt;br /&gt;
                 &amp;lt;ejb-name&amp;gt;EmployeeServiceAdmin&amp;lt;/ejb-name&amp;gt;&lt;br /&gt;
                 &amp;lt;method-name&amp;gt;*&amp;lt;/method-name&amp;gt;&lt;br /&gt;
             &amp;lt;/method&amp;gt;&lt;br /&gt;
         &amp;lt;/method-permission&amp;gt;&lt;br /&gt;
         &amp;lt;method-permission&amp;gt;&lt;br /&gt;
             &amp;lt;description&amp;gt;Any authenticated user may access any method of the&lt;br /&gt;
                 EmployeeServiceHelp bean&amp;lt;/description&amp;gt;&lt;br /&gt;
             &amp;lt;unchecked/&amp;gt;&lt;br /&gt;
             &amp;lt;method&amp;gt;&lt;br /&gt;
                 &amp;lt;ejb-name&amp;gt;EmployeeServiceHelp&amp;lt;/ejb-name&amp;gt;&lt;br /&gt;
                 &amp;lt;method-name&amp;gt;*&amp;lt;/method-name&amp;gt;&lt;br /&gt;
             &amp;lt;/method&amp;gt;&lt;br /&gt;
         &amp;lt;/method-permission&amp;gt;&lt;br /&gt;
         &amp;lt;exclude-list&amp;gt;&lt;br /&gt;
             &amp;lt;description&amp;gt;No fireTheCTO methods of the EmployeeFiring bean may be&lt;br /&gt;
                 used in this deployment&amp;lt;/description&amp;gt;&lt;br /&gt;
             &amp;lt;method&amp;gt;&lt;br /&gt;
                 &amp;lt;ejb-name&amp;gt;EmployeeFiring&amp;lt;/ejb-name&amp;gt;&lt;br /&gt;
                 &amp;lt;method-name&amp;gt;fireTheCTO&amp;lt;/method-name&amp;gt;&lt;br /&gt;
             &amp;lt;/method&amp;gt;&lt;br /&gt;
         &amp;lt;/exclude-list&amp;gt;&lt;br /&gt;
     &amp;lt;/assembly-descriptor&amp;gt;&lt;br /&gt;
 &amp;lt;/ejb-jar&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 Source: [https://access.redhat.com/site/documentation/en-US/JBoss_Enterprise_Application_Platform_Common_Criteria_Certification/5/html/Security_Guide/index.html JBoss Enterprise Application Platform Common Criteria Certification 5]&lt;br /&gt;
              [https://access.redhat.com/site/documentation/en-US/JBoss_Enterprise_Application_Platform_Common_Criteria_Certification/5/html/Security_Guide/index.html Security Guide]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If XML deployment descriptors are used to secure the application, code review should include the &amp;quot;web.xml&amp;quot; and &amp;quot;ejb-jar.xml&amp;quot; files to ensure that access controls are properly applied to the correct roles, and authentication methods are as expected.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Annotations ====&lt;br /&gt;
JEE annotations for security are defined in the [http://docs.oracle.com/javaee/6/api/javax/annotation/security/package-summary.html javax.annotation.security] package.  The available annotations are:&lt;br /&gt;
&lt;br /&gt;
 @DeclareRoles&lt;br /&gt;
 @DenyAll - no roles may invoke the method&lt;br /&gt;
 @PermitAll - all roles may invoke the method&lt;br /&gt;
 @RolesAllowed - roles permitted to invoke the method&lt;br /&gt;
 @RunAs - dynamically run the method as a particular role&lt;br /&gt;
&lt;br /&gt;
For example, the following code snippet allows employees and managers to add movies to the persistent store, anyone to list movies, but only managers may delete movies:&lt;br /&gt;
&lt;br /&gt;
 public class Movies {&lt;br /&gt;
 &lt;br /&gt;
     private EntityManager entityManager;&lt;br /&gt;
 &lt;br /&gt;
     @RolesAllowed({&amp;quot;Employee&amp;quot;, &amp;quot;Manager&amp;quot;})&lt;br /&gt;
     public void addMovie(Movie movie) throws Exception {&lt;br /&gt;
         entityManager.persist(movie);&lt;br /&gt;
     }&lt;br /&gt;
 &lt;br /&gt;
     @RolesAllowed({&amp;quot;Manager&amp;quot;})&lt;br /&gt;
     public void deleteMovie(Movie movie) throws Exception {&lt;br /&gt;
         entityManager.remove(movie);&lt;br /&gt;
     }&lt;br /&gt;
 &lt;br /&gt;
     @PermitAll&lt;br /&gt;
     public List&amp;lt;Movie&amp;gt; getMovies() throws Exception {&lt;br /&gt;
         Query query = entityManager.createQuery(&amp;quot;SELECT m from Movie as m&amp;quot;);&lt;br /&gt;
         return query.getResultList();&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Code review should look for such annotations.  If present, ensure they reflect the correct roles and permissions, and are consistent with any declared role permissions in the &amp;quot;ejb-jar.xml&amp;quot; file.&lt;br /&gt;
&lt;br /&gt;
==== Framework Specific Configuration ====&lt;br /&gt;
Some application server frameworks offer additional or enhanced security configurations.  Consult the documentation for the particular framework you are using.  Information on some of the more common frameworks follow.&lt;br /&gt;
&lt;br /&gt;
===== Apache Tomcat =====&lt;br /&gt;
The [http://tomcat.apache.org/tomcat-7.0-doc/security-howto.html#server.xml Tomcat server.xml] file defines many security related parameters:&lt;br /&gt;
&lt;br /&gt;
* Server - shutdown port&lt;br /&gt;
* Connectors - maxPostSize, maxParameterCount, server, SSLEnabled, secure, ciphers&lt;br /&gt;
* Host - autoDeploy, deployOnStartup, deployXML&lt;br /&gt;
* Context - crossContext, privileged, allowLinking&lt;br /&gt;
&lt;br /&gt;
The server.xml file should be reviewed to ensure security related parameters are configured as expected.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== Jetty =====&lt;br /&gt;
Jetty adds several security enhancements:&lt;br /&gt;
&lt;br /&gt;
* Limiting form content&lt;br /&gt;
* Obfuscating passwords&lt;br /&gt;
&lt;br /&gt;
The maximum form content size and number of form keys can be configured at server and web application level in the &amp;quot;jetty-web.xml&amp;quot; file:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;Configure class=&amp;quot;org.eclipse.jetty.webapp.WebAppContext&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
   ...&lt;br /&gt;
   &lt;br /&gt;
   &amp;lt;Set name=&amp;quot;maxFormContentSize&amp;quot;&amp;gt;200000&amp;lt;/Set&amp;gt;&lt;br /&gt;
   &amp;lt;Set name=&amp;quot;maxFormKeys&amp;quot;&amp;gt;200&amp;lt;/Set&amp;gt;&lt;br /&gt;
 &amp;lt;/Configure&amp;gt;    &lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;configure class=&amp;quot;org.eclipse.jetty.server.Server&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
   ...&lt;br /&gt;
  &lt;br /&gt;
   &amp;lt;Call name=&amp;quot;setAttribute&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;Arg&amp;gt;org.eclipse.jetty.server.Request.maxFormContentSize&amp;lt;/Arg&amp;gt;&lt;br /&gt;
     &amp;lt;Arg&amp;gt;100000&amp;lt;/Arg&amp;gt;&lt;br /&gt;
    &amp;lt;/Call&amp;gt;&lt;br /&gt;
   &amp;lt;Call name=&amp;quot;setAttribute&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;Arg&amp;gt;org.eclipse.jetty.server.Request.maxFormKeys&amp;lt;/Arg&amp;gt;&lt;br /&gt;
     &amp;lt;Arg&amp;gt;2000&amp;lt;/Arg&amp;gt;&lt;br /&gt;
    &amp;lt;/Call&amp;gt;&lt;br /&gt;
 &amp;lt;/configure&amp;gt;      &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Jetty also supports the use of obfuscated passwords in jetty XML files where a plain text password is usually needed. Here's an example setting the password for a JDBC Datasource with obfuscation (the obfuscated password is generated by Jetty org.eclipse.jetty.util.security.Password utility):&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;New id=&amp;quot;DSTest&amp;quot; class=&amp;quot;org.eclipse.jetty.plus.jndi.Resource&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Arg&amp;gt;&amp;lt;/Arg&amp;gt;&lt;br /&gt;
    &amp;lt;Arg&amp;gt;jdbc/DSTest&amp;lt;/Arg&amp;gt;&lt;br /&gt;
    &amp;lt;Arg&amp;gt;&lt;br /&gt;
      &amp;lt;New class=&amp;quot;com.jolbox.bonecp.BoneCPDataSource&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Set name=&amp;quot;driverClass&amp;quot;&amp;gt;com.mysql.jdbc.Driver&amp;lt;/Set&amp;gt;&lt;br /&gt;
        &amp;lt;Set name=&amp;quot;jdbcUrl&amp;quot;&amp;gt;jdbc:mysql://localhost:3306/foo&amp;lt;/Set&amp;gt;&lt;br /&gt;
        &amp;lt;Set name=&amp;quot;username&amp;quot;&amp;gt;dbuser&amp;lt;/Set&amp;gt;&lt;br /&gt;
        '''&amp;lt;Set name=&amp;quot;password&amp;quot;&amp;gt;'''&lt;br /&gt;
           '''&amp;lt;Call class=&amp;quot;org.eclipse.jetty.util.security.Password&amp;quot; name=&amp;quot;deobfuscate&amp;quot;&amp;gt;'''&lt;br /&gt;
                 '''&amp;lt;Arg&amp;gt;OBF:1ri71v1r1v2n1ri71shq1ri71shs1ri71v1r1v2n1ri7&amp;lt;/Arg&amp;gt;'''&lt;br /&gt;
           '''&amp;lt;/Call&amp;gt;'''&lt;br /&gt;
        '''&amp;lt;/Set&amp;gt;'''&lt;br /&gt;
        &amp;lt;Set name=&amp;quot;minConnectionsPerPartition&amp;quot;&amp;gt;5&amp;lt;/Set&amp;gt;&lt;br /&gt;
        &amp;lt;Set name=&amp;quot;maxConnectionsPerPartition&amp;quot;&amp;gt;50&amp;lt;/Set&amp;gt;&lt;br /&gt;
        &amp;lt;Set name=&amp;quot;acquireIncrement&amp;quot;&amp;gt;5&amp;lt;/Set&amp;gt;&lt;br /&gt;
        &amp;lt;Set name=&amp;quot;idleConnectionTestPeriod&amp;quot;&amp;gt;30&amp;lt;/Set&amp;gt;&lt;br /&gt;
     &amp;lt;/New&amp;gt;&lt;br /&gt;
   &amp;lt;/Arg&amp;gt;&lt;br /&gt;
 &amp;lt;/New&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====JBoss AS =====&lt;br /&gt;
JBoss Application Server, like Jetty, allows password obfuscation (called password masking in JBoss) in its XML configuration files.  After using JBoss password utility to create password mask, replace any occurrence of a masked password in XML configuration files with the following annotation:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;annotation&amp;gt;@org.jboss.security.integration.password.Password&lt;br /&gt;
                      (securityDomain=MASK_NAME,methodName=setPROPERTY_NAME)&lt;br /&gt;
 &amp;lt;/annotation&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See [http://docs.jboss.org/jbosssecurity/docs/6.0/security_guide/html_single/#Masking_Passwords Masking Passwords in XML Configuration] in the [http://docs.jboss.org/jbosssecurity/docs/6.0/security_guide/html_single/ JBoss AS Security Guide].&lt;br /&gt;
&lt;br /&gt;
===== Oracle WebLogic =====&lt;br /&gt;
WebLogic server supports additional deployment descriptors in the &amp;quot;weblogic.xml&amp;quot; file:&lt;br /&gt;
&lt;br /&gt;
* externally-defined - role to principal mappings are externally defined in WebLogic Admin Console&lt;br /&gt;
* run-as-principal-name - assign a principal to a role when running as that role&lt;br /&gt;
* run-as-role-assignment - contains the run-as-principal-name descriptor&lt;br /&gt;
* security-permission - contains security-permission-spec descriptor&lt;br /&gt;
* security-permission-spec - specify application permissions as per [http://docs.oracle.com/javase/1.5.0/docs/guide/security/PolicyFiles.html#FileSyntax Java policy file syntax]&lt;br /&gt;
* security-role-assignment - explicitly assign principals to a role&lt;br /&gt;
&lt;br /&gt;
More information on WebLogic additional deployment descriptors may be found at [http://docs.oracle.com/cd/E11035_01/wls100/security/thin_client.html#wp1046262 weblogic.xml Deployment Descriptors].&lt;br /&gt;
&lt;br /&gt;
===== Microsoft IIS =====&lt;br /&gt;
&lt;br /&gt;
=== Programmatic Configuration ===&lt;br /&gt;
&lt;br /&gt;
The JEE API for programmatic security consists of methods of the EJBContext interface and the HttpServletRequest interface. These methods allow components to make business-logic decisions based on the security role of the caller or remote user.&lt;/div&gt;</summary>
		<author><name>Jerry Kickenson</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=CRV2_SecDepConfig&amp;diff=165212</id>
		<title>CRV2 SecDepConfig</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=CRV2_SecDepConfig&amp;diff=165212"/>
				<updated>2013-12-31T00:39:52Z</updated>
		
		<summary type="html">&lt;p&gt;Jerry Kickenson: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Secure Deployment Configuration ==&lt;br /&gt;
Web applications do not execute in isolation.  They typically are deployed within an application server framework, running within an operating system on a physical host, within a network.  &lt;br /&gt;
&lt;br /&gt;
Secure operating system configuration (also called hardening) is not typically within the scope of code review.  For more information, see the [http://benchmarks.cisecurity.org/downloads/browse/index.cfm?category=benchmarks.os Center for Internet Security operating system benchmarks].&lt;br /&gt;
&lt;br /&gt;
Networks today consist of much more than routers and switches providing transport services.  Filtering switches, VLANs (virtual LANs), firewalls, WAFs (Web Application Firewall), and various middle boxes (e.g. reverse proxies, intrusion detection and prevention systems) all provide critical security services when configured to do so.   This is a big topic, but outside the scope of this web application code review guide.  For a good summary, see the SANS (System Administration, Networking, and Security) Institute [http://www.sans.org/critical-security-controls/control.php?id=10 Critical Control 10: Secure Configurations for Network Devices such as Firewalls, Routers, and Switches].&lt;br /&gt;
&lt;br /&gt;
Application server frameworks have many security related capabilities.  These capabilities are enabled and configured  declaratively.  Declarative configuration is usually done via static configuration files, typically in XML format, but may also be expressed as annotations within the code.&lt;br /&gt;
&lt;br /&gt;
Some security capabilities are accessible from within a Java program.  Programmatic security is done within the web application, using framework specific or standard Java EE APIs.&lt;br /&gt;
&lt;br /&gt;
=== Declarative Configuration ===&lt;br /&gt;
&lt;br /&gt;
When implemented using the Java Enterprise Edition (JEE) framework, the [http://docs.oracle.com/javaee/6/tutorial/doc/bnbwk.html JEE security model] may be used.  JEE uses a role-based security model, in which access to application resources is granted based on the security role. The security role is a logical grouping of principals (authenticated entities, usually a user), and access is declared by specifying a ''security constraint'' on the role.&lt;br /&gt;
&lt;br /&gt;
The constraints and roles are expressed as ''deployment descriptors'' expressed as XML elements.  Different types of components use different formats, or schemas, for their deployment descriptors:&lt;br /&gt;
&lt;br /&gt;
* Web components may use a web application deployment descriptor in the file ''web.xml''&lt;br /&gt;
* Enterprise JavaBeans components may use an EJB deployment descriptor named ''META-INF/ejb-jar.xml''&lt;br /&gt;
&lt;br /&gt;
In summary, the deployment descriptor can define resources (e.g. servlets accessible via a specific URL), which roles are authorized to access the resource, and how access is constrained (e.g. via GET but not POST).  The followng example web component descriptor defines a Catalog servlet, a &amp;quot;manager&amp;quot; role, a SalesInfo resource within the servlet accessible via GET and POST requests, and specifies that only users with &amp;quot;manager&amp;quot; role, using SSL and successfully using HTTP basic authentication should be granted access:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;ISO-8859-1&amp;quot;?&amp;gt;&lt;br /&gt;
 &amp;lt;web-app xmlns=&amp;quot;http://java.sun.com/xml/ns/j2ee&amp;quot;&lt;br /&gt;
   xmlns:xsi=&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot;&lt;br /&gt;
   xsi:schemaLocation=&amp;quot;http://java.sun.com/xml/ns/j2ee&lt;br /&gt;
    http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd&amp;quot; version=?2.5?&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
     &amp;lt;display-name&amp;gt;A Secure Application&amp;lt;/display-name&amp;gt;&lt;br /&gt;
     &amp;lt;servlet&amp;gt;&lt;br /&gt;
       &amp;lt;servlet-name&amp;gt;catalog&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;
       &amp;lt;servlet-class&amp;gt;com.mycorp.CatalogServlet&amp;lt;/servlet-class&amp;gt;&lt;br /&gt;
       &amp;lt;init-param&amp;gt;&lt;br /&gt;
         &amp;lt;param-name&amp;gt;catalog&amp;lt;/param-name&amp;gt;&lt;br /&gt;
         &amp;lt;param-value&amp;gt;Spring&amp;lt;/param-value&amp;gt;&lt;br /&gt;
       &amp;lt;/init-param&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
       &amp;lt;nowiki&amp;gt;&amp;lt;!-- Define Security Roles --&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
       &amp;lt;security-role-ref&amp;gt;&lt;br /&gt;
         &amp;lt;role-name&amp;gt;MGR&amp;lt;/role-name&amp;gt;&lt;br /&gt;
         &amp;lt;!-- role name used in code --&amp;gt;&lt;br /&gt;
         &amp;lt;role-link&amp;gt;manager&amp;lt;/role-link&amp;gt;&lt;br /&gt;
       &amp;lt;/security-role-ref&amp;gt;&lt;br /&gt;
     &amp;lt;/servlet&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
     &amp;lt;security-role&amp;gt;&lt;br /&gt;
       &amp;lt;role-name&amp;gt;manager&amp;lt;/role-name&amp;gt;&lt;br /&gt;
     &amp;lt;/security-role&amp;gt;&lt;br /&gt;
     &amp;lt;servlet-mapping&amp;gt;&lt;br /&gt;
       &amp;lt;servlet-name&amp;gt;catalog&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;
       &amp;lt;url-pattern&amp;gt;/catalog/*&amp;lt;/url-pattern&amp;gt;&lt;br /&gt;
     &amp;lt;/servlet-mapping&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
     &amp;lt;nowiki&amp;gt;&amp;lt;!-- Define A Security Constraint --&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
     &amp;lt;security-constraint&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
     &amp;lt;nowiki&amp;gt;&amp;lt;!-- Specify the Resources to be Protected --&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
     &amp;lt;web-resource-collection&amp;gt;&lt;br /&gt;
       &amp;lt;web-resource-name&amp;gt;SalesInfo&amp;lt;/web-resource-name&amp;gt;&lt;br /&gt;
       &amp;lt;url-pattern&amp;gt;/salesinfo/*&amp;lt;/url-pattern&amp;gt;&lt;br /&gt;
       &amp;lt;http-method&amp;gt;GET&amp;lt;/http-method&amp;gt;&lt;br /&gt;
       &amp;lt;http-method&amp;gt;POST&amp;lt;/http-method&amp;gt;&lt;br /&gt;
      &amp;lt;/web-resource-collection&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
     &amp;lt;nowiki&amp;gt;&amp;lt;!-- Specify which Users Can Access Protected Resources --&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
     &amp;lt;auth-constraint&amp;gt;&lt;br /&gt;
       &amp;lt;role-name&amp;gt;manager&amp;lt;/role-name&amp;gt;&lt;br /&gt;
     &amp;lt;/auth-constraint&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
     &amp;lt;nowiki&amp;gt;&amp;lt;!-- Specify Secure Transport using SSL (confidential guarantee) --&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
     &amp;lt;user-data-constraint&amp;gt;&lt;br /&gt;
       &amp;lt;transport-guarantee&amp;gt;CONFIDENTIAL&amp;lt;/transport-guarantee&amp;gt;&lt;br /&gt;
     &amp;lt;/user-data-constraint&amp;gt;&lt;br /&gt;
     &amp;lt;/security-constraint&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
     &amp;lt;nowiki&amp;gt;&amp;lt;!-- Specify HTTP Basic Authentication Method --&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
     &amp;lt;login-config&amp;gt;&lt;br /&gt;
       &amp;lt;auth-method&amp;gt;BASIC&amp;lt;/auth-method&amp;gt;&lt;br /&gt;
       &amp;lt;realm-name&amp;gt;file&amp;lt;/realm-name&amp;gt;&lt;br /&gt;
     &amp;lt;/login-config&amp;gt;&lt;br /&gt;
 &amp;lt;/web-app&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Apache Tomcat ====&lt;br /&gt;
&lt;br /&gt;
==== Microsoft IIS ====&lt;br /&gt;
&lt;br /&gt;
==== Oracle WebLogic ====&lt;br /&gt;
&lt;br /&gt;
==== IBM WebSphere AS ====&lt;br /&gt;
&lt;br /&gt;
==== Jetty ====&lt;br /&gt;
&lt;br /&gt;
==== JBoss AS ====&lt;br /&gt;
&lt;br /&gt;
=== Programmatic Configuration ===&lt;br /&gt;
&lt;br /&gt;
The JEE API for programmatic security consists of methods of the EJBContext interface and the HttpServletRequest interface. These methods allow components to make business-logic decisions based on the security role of the caller or remote user.&lt;/div&gt;</summary>
		<author><name>Jerry Kickenson</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=CRV2_SecDepConfig&amp;diff=165178</id>
		<title>CRV2 SecDepConfig</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=CRV2_SecDepConfig&amp;diff=165178"/>
				<updated>2013-12-30T03:59:08Z</updated>
		
		<summary type="html">&lt;p&gt;Jerry Kickenson: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Secure Deployment Configuration ==&lt;br /&gt;
Web applications do not execute in isolation.  They typically are deployed within an application server framework, running within an operating system on a physical host, within a network.  &lt;br /&gt;
&lt;br /&gt;
Secure operating system configuration (also called hardening) is not typically within the scope of code review.  For more information, see the [http://benchmarks.cisecurity.org/downloads/browse/index.cfm?category=benchmarks.os Center for Internet Security operating system benchmarks].&lt;br /&gt;
&lt;br /&gt;
Networks today consist of much more than routers and switches providing transport services.  Filtering switches, VLANs (virtual LANs), firewalls, WAFs (Web Application Firewall), and various middle boxes (e.g. reverse proxies, intrusion detection and prevention systems) all provide critical security services when configured to do so.   This is a big topic, but outside the scope of this web application code review guide.  For a good summary, see the SANS (System Administration, Networking, and Security) Institute [http://www.sans.org/critical-security-controls/control.php?id=10 Critical Control 10: Secure Configurations for Network Devices such as Firewalls, Routers, and Switches].&lt;br /&gt;
&lt;br /&gt;
Application server frameworks have many security related capabilities.  These capabilities are enabled and configured  declaratively.  Declarative configuration is done via static configuration files, typically in XML format.&lt;br /&gt;
&lt;br /&gt;
Some security capabilities are accessible from within a Java program.  Programmatic security is done within the web application, using framework specific or standard Java EE APIs.&lt;br /&gt;
&lt;br /&gt;
=== Declarative Configuration ===&lt;br /&gt;
&lt;br /&gt;
==== Apache Tomcat ====&lt;br /&gt;
&lt;br /&gt;
==== Microsoft IIS ====&lt;br /&gt;
&lt;br /&gt;
==== Oracle WebLogic ====&lt;br /&gt;
&lt;br /&gt;
==== IBM WebSphere AS ====&lt;br /&gt;
&lt;br /&gt;
==== Jetty ====&lt;br /&gt;
&lt;br /&gt;
==== JBoss AS ====&lt;br /&gt;
&lt;br /&gt;
=== Programmatic Configuration ===&lt;/div&gt;</summary>
		<author><name>Jerry Kickenson</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=CRV2_SecDepConfig&amp;diff=165177</id>
		<title>CRV2 SecDepConfig</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=CRV2_SecDepConfig&amp;diff=165177"/>
				<updated>2013-12-30T01:00:45Z</updated>
		
		<summary type="html">&lt;p&gt;Jerry Kickenson: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Secure Deployment Configuration ==&lt;br /&gt;
Web applications do not execute in isolation.  They typically are deployed within an application server framework, running within an operating system on a physical host, within a network.  &lt;br /&gt;
&lt;br /&gt;
Secure operating system configuration (also called hardening) is not typically within the scope of code review.  For more information, see the [http://benchmarks.cisecurity.org/downloads/browse/index.cfm?category=benchmarks.os Center for Internet Security operating system benchmarks].&lt;br /&gt;
&lt;br /&gt;
Networks today consist of much more than routers and switches providing transport services.  Filtering switches, VLANs (virtual LANs), firewalls, WAFs (Web Application Firewall), and various middle boxes (e.g. reverse proxies, intrusion detection and prevention systems) all provide critical security services when configured to do so.   This is a big topic, but outside the scope of this web application code review guide.  For a good summary, see the SANS (System Administration, Networking, and Security) Institute [http://www.sans.org/critical-security-controls/control.php?id=10 Critical Control 10: Secure Configurations for Network Devices such as Firewalls, Routers, and Switches].&lt;br /&gt;
&lt;br /&gt;
Application server frameworks have many security related capabilities.  These capabilities may be enabled and configured programmatically or declaratively.  Programmatic configuration is done within the web application, using framework specific APIs.  Declarative configuration is done via static configuration files, typically in XML format.&lt;br /&gt;
&lt;br /&gt;
=== Programmatic Configuration ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Declarative Configuration ===&lt;br /&gt;
&lt;br /&gt;
==== Apache Tomcat ====&lt;br /&gt;
&lt;br /&gt;
==== Microsoft IIS ====&lt;br /&gt;
&lt;br /&gt;
==== Oracle WebLogic ====&lt;br /&gt;
&lt;br /&gt;
==== IBM WebSphere AS ====&lt;br /&gt;
&lt;br /&gt;
==== Jetty ====&lt;br /&gt;
&lt;br /&gt;
==== JBoss AS ====&lt;/div&gt;</summary>
		<author><name>Jerry Kickenson</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=CRV2_SecDepConfig&amp;diff=165176</id>
		<title>CRV2 SecDepConfig</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=CRV2_SecDepConfig&amp;diff=165176"/>
				<updated>2013-12-30T00:58:11Z</updated>
		
		<summary type="html">&lt;p&gt;Jerry Kickenson: Created page with &amp;quot;== Secure Deployment Configuration == Web applications do not execute in isolation.  They typically are deployed within an application server framework, running within an oper...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Secure Deployment Configuration ==&lt;br /&gt;
Web applications do not execute in isolation.  They typically are deployed within an application server framework, running within an operating system on a physical host, within a network.  &lt;br /&gt;
&lt;br /&gt;
Secure operating system configuration (also called hardening) is not typically within the scope of code review.  For more information, see the [http://benchmarks.cisecurity.org/downloads/browse/index.cfm?category=benchmarks.os Center for Internet Security operating system benchmarks].&lt;br /&gt;
&lt;br /&gt;
Networks today consist of much more than routers and switches providing transport services.  Filtering switches, VLANs (virtual LANs), firewalls, WAFs (Web Application Firewall), and various middle boxes (e.g. reverse proxies, intrusion detection and prevention systems) all provide critical security services when configured to do so.   This is a big topic, but outside the scope of this web application code review guide.  For a good summary, see the SANS (System Administration, Networking, and Security) Institute [http://www.sans.org/critical-security-controls/control.php?id=10 Critical Control 10: Secure Configurations for Network Devices such as Firewalls, Routers, and Switches].&lt;br /&gt;
&lt;br /&gt;
Application server frameworks have many security related capabilities.  These capabilities may be enabled and configured programmatically or declaratively.  Programmatic configuration is done within the web application, using framework specific APIs.  Declarative configuration is done via static configuration files, typically in XML format.&lt;br /&gt;
&lt;br /&gt;
=== Programmatic Configuration ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Declarative Configuration ===&lt;/div&gt;</summary>
		<author><name>Jerry Kickenson</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=CRV2_360Review&amp;diff=165174</id>
		<title>CRV2 360Review</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=CRV2_360Review&amp;diff=165174"/>
				<updated>2013-12-29T01:44:43Z</updated>
		
		<summary type="html">&lt;p&gt;Jerry Kickenson: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== 360 Reviews  ==&lt;br /&gt;
The term '''360 Review''' refers to an approach in which the results of a source code review are used to plan and execute a penetration test, and the results of the penetration test are, in turn, used to inform additional source code review:&lt;br /&gt;
&lt;br /&gt;
[[File:360 Review.jpg]]&lt;br /&gt;
A penetration test that uses a code review as input to planning is referred to as [http://encyclopedia2.thefreedictionary.com/white+box+testing white box testing] (also called ''clear box'' and ''glass box'' testing).  This approach can lead to a more productive penetration test, since testing can be focussed on suspected or even known vulnerabilities.  Using knowledge of the specific frameworks, libraries and languages used in the web application, the penetration test can concentrate on weaknesses known to exist in those frameworks, libraries and languages.&lt;br /&gt;
&lt;br /&gt;
A white box penetration test can also be used to establish the actual risk posed by a vulnerability discovered through code review.  A vulnerability found during code review may turn out not to be exploitable during penetration test.  This could be due to an incomplete code review, in which a missing protective measure (input validation, for instance) was determined to be missing, but was actually present.  But it is also possible that mitigating controls (such as [http://www.nsa.gov/ia/_files/support/defenseindepth.pdf Defense in Depth] mask the vulnerability in the actual operating environment.  While the vulnerability in this latter case is real, the actual risk may be lower.&lt;br /&gt;
&lt;br /&gt;
While vulnerabilities exploited during a white box penetration test (based on source code review) are certainly real, the actual risk of these vulnerabilities should be carefully analyzed.  It is unrealistic that an attacker would be given access to the target web application's source code and advice from its developers.  Thus, the risk that an outside attacker could exploit the vulnerabilities found by the white box penetration tester is probably lower.  However, if the web application organization is concerned with the risk of attackers with inside knowledge (former employees or collusion with current employees or contractors), the real-world risk may be just as high.&lt;br /&gt;
&lt;br /&gt;
The results of the penetration test can then be used to target additional code review.  Besides addressing the particular vulnerability exploited in the test, it is a good practice to look for additional places where that same class of vulnerability is present, even if not explicitly exploited in test.  For instance, if output encoding is not used in one area of the application and the penetration test exploited that, it is quite possible that output encoding is also not used elsewhere in the application.&lt;/div&gt;</summary>
		<author><name>Jerry Kickenson</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=File:360_Review.jpg&amp;diff=165173</id>
		<title>File:360 Review.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=File:360_Review.jpg&amp;diff=165173"/>
				<updated>2013-12-29T01:42:54Z</updated>
		
		<summary type="html">&lt;p&gt;Jerry Kickenson: Jerry Kickenson uploaded a new version of &amp;amp;quot;File:360 Review.jpg&amp;amp;quot;: Corrected spelling&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Jerry Kickenson</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=File:360_Review.jpg&amp;diff=165172</id>
		<title>File:360 Review.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=File:360_Review.jpg&amp;diff=165172"/>
				<updated>2013-12-29T01:39:52Z</updated>
		
		<summary type="html">&lt;p&gt;Jerry Kickenson: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Jerry Kickenson</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=CRV2_360Review&amp;diff=165171</id>
		<title>CRV2 360Review</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=CRV2_360Review&amp;diff=165171"/>
				<updated>2013-12-29T01:30:28Z</updated>
		
		<summary type="html">&lt;p&gt;Jerry Kickenson: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== 360 Reviews  ==&lt;br /&gt;
The term '''360 Review''' refers to an approach in which the results of a source code review are used to plan and execute a penetration test, and the results of the penetration test are, in turn, used to inform additional source code review:&lt;br /&gt;
&lt;br /&gt;
[INSERT PICTURE HERE]&lt;br /&gt;
&lt;br /&gt;
A penetration test that uses a code review as input to planning is referred to as [http://encyclopedia2.thefreedictionary.com/white+box+testing white box testing] (also called ''clear box'' and ''glass box'' testing).  This approach can lead to a more productive penetration test, since testing can be focussed on suspected or even known vulnerabilities.  Using knowledge of the specific frameworks, libraries and languages used in the web application, the penetration test can concentrate on weaknesses known to exist in those frameworks, libraries and languages.&lt;br /&gt;
&lt;br /&gt;
A white box penetration test can also be used to establish the actual risk posed by a vulnerability discovered through code review.  A vulnerability found during code review may turn out not to be exploitable during penetration test.  This could be due to an incomplete code review, in which a missing protective measure (input validation, for instance) was determined to be missing, but was actually present.  But it is also possible that mitigating controls (such as [http://www.nsa.gov/ia/_files/support/defenseindepth.pdf Defense in Depth] mask the vulnerability in the actual operating environment.  While the vulnerability in this latter case is real, the actual risk may be lower.&lt;br /&gt;
&lt;br /&gt;
While vulnerabilities exploited during a white box penetration test (based on source code review) are certainly real, the actual risk of these vulnerabilities should be carefully analyzed.  It is unrealistic that an attacker would be given access to the target web application's source code and advice from its developers.  Thus, the risk that an outside attacker could exploit the vulnerabilities found by the white box penetration tester is probably lower.  However, if the web application organization is concerned with the risk of attackers with inside knowledge (former employees or collusion with current employees or contractors), the real-world risk may be just as high.&lt;br /&gt;
&lt;br /&gt;
The results of the penetration test can then be used to target additional code review.  Besides addressing the particular vulnerability exploited in the test, it is a good practice to look for additional places where that same class of vulnerability is present, even if not explicitly exploited in test.  For instance, if output encoding is not used in one area of the application and the penetration test exploited that, it is quite possible that output encoding is also not used elsewhere in the application.&lt;/div&gt;</summary>
		<author><name>Jerry Kickenson</name></author>	</entry>

	</feed>