3
3
title : Secure Environment Introduction
4
4
layout : col-document
5
5
tags : OWASP Developer Guide
6
- contributors :
6
+ contributors:Shruti Kulkarni
7
7
document : OWASP Developer Guide
8
8
order : 901
9
9
@@ -23,4 +23,53 @@ and submit your content for review.
23
23
24
24
[ contribute ] : https://github.com/OWASP/www-project-developer-guide/blob/main/contributing.md
25
25
26
+ * The WEB-INF directory tree contains web application classes, pre-compiled JSP files, server side libraries,
27
+ session information, and files such as ` web.xml ` and ` webapp.properties ` .
28
+ So be sure the code base is identical to production.
29
+ Ensuring that we have a “secure code environment” is also an important part of
30
+ an application secure code inspection.
31
+
32
+ * Use a “deny all” rule to deny access and then grant access on need basis.
33
+
34
+ * In Apache HTTP server, ensure directories like WEB-INF and META-INF are protected.
35
+ If permissions for a directory and subdirectories are specified in ` .htaccess ` file,
36
+ ensure that it is protected using the “deny all” rule.
37
+
38
+ * While using Struts framework, ensure that JSP files are not accessible directly
39
+ by denying access to ` *.jsp ` files in ` web.xml ` .
40
+
41
+ * Maintain a clean environment. remove files that contain source code but are not used by the application.
42
+
43
+ * Ensure production environment does not contain any source code / development tools
44
+ and that the production environment contains only compiled code / executables.
45
+
46
+ * Remove test code / debug code (that might contain backdoors).
47
+ Commented code can also be removed as at times, it might contain sensitive data. Remove file metadata e.g., .git
48
+
49
+ * Set “Deny All” in security constraints (for the roles being set up)
50
+ while setting up the application on the web server.
51
+
52
+ * The listing of HTTP methods in security constraints works in a similar way to deny-listing.
53
+ Any verb not explicitly listed is allowed for execution. Hence use “Deny All”
54
+ and then allow the methods for the required roles.
55
+ This setting carries weightage while using “Anonymous User” role.
56
+ For example, in Java, remove all <http-method > elements from ` web.xml ` files.
57
+
58
+ * Configure web and application server to disallow HEAD requests entirely.
59
+
60
+ * Comments on code and Meta tags pertaining to the IDE used or technology used to develop the application
61
+ should be removed. Some comments can divulge important information regarding bugs in code
62
+ or pointers to functionality. This is particularly important with server side code such as JSP and ASP files.
63
+
64
+ * Search for any calls to the underlying operating system or file open calls and examine the error possibilities.
65
+
66
+ * Remove unused dependencies, unnecessary features, components, files, and documentation.
67
+
68
+ * Only obtain components from official sources over secure links.
69
+ Prefer signed packages to reduce the chance of including a modified, malicious component
70
+
71
+ * Monitor for libraries and components that are unmaintained or do not create security patches for older versions.
72
+ If patching is not possible, consider deploying a virtual patch to monitor, detect,
73
+ or protect against the discovered issue.
74
+
26
75
\newpage
0 commit comments