2015-03-26 5 views
7

जेएसपी में अनुरोध पैरामीटर से बचने के लिए ESAPI.encoder()। EncodeForHTML (request.get पैरामीटर()) के रूप में मेरे वेब ऐप में OWASP ESAPI लाइब्रेरी का उपयोग करने का प्रयास कर रहा हूं।मैं ESAPI.properties कहां पा सकता हूं?

मैं esapi-2.1.0.jar के तहत वेब-INF/lib को शामिल किया है, लेकिन मैं नीचे अपवाद

org.owasp.esapi.errors.ConfigurationException मिलती है: ESAPI.properties किसी भी तरह से लोड नहीं हो सका । असमर्थ रहे हैं। org.owasp.esapi.reference.DefaultSecurityConfiguration.loadConfiguration (DefaultSecurityConfiguration.java:439)

लेकिन मैं JAR फ़ाइल में ESAPI.properties को खोजने सके। कोई विचार जहां मैं इसे प्राप्त कर सकता हूं? मुझे यह गुण फ़ाइल कहां रखनी चाहिए? कृपया मदद करे।

+0

एक साधारण [वेब खोज] (https://www.owasp.org/index.php/ESAPI_Overview) उत्तर प्रदान करता है। यहां पोस्ट करने से पहले कृपया अपना शोध करें। –

+1

धन्यवाद। लेकिन यह अभी भी मेरे प्रश्न का उत्तर नहीं देता है। क्या मुझे ESAPI.properties खुद को बनाने की ज़रूरत है? मैंने सोचा कि एपीआई इसे प्रदान करता है लेकिन यह नहीं पता कि मैं फ़ाइल कहां डाउनलोड कर सकता हूं। – Pro

उत्तर

8

यहां संदर्भ है: ESAPI installation guide

आप here से ESAPI.properties डाउनलोड कर सकते हैं।

आप ESAPI.properties स्वयं को फ़ाइल बना सकते हैं और वही सामग्री वहां रख सकते हैं। इसे आपके 'src/main/resource' फ़ोल्डर में रखा जाना चाहिए।

इसके अलावा आपको XSS को संभालने के लिए validation.properties फ़ाइल की आवश्यकता होगी, जिसे 'src/test/resource' फ़ोल्डर में रखा जाना चाहिए।

कृपया इन गुणों

Validator.Redirect=^\\/test.*$ 

test में के रूप में अपने आवेदन करने के लिए दायर अपने आवेदन नाम के साथ प्रतिस्थापित किया जाना चाहिए आवेदन नाम बदलने के लिए सुनिश्चित करें।

+4

जावा के लिए स्थापना मार्गदर्शिका: https: //www.owasp।संगठन/छवियों/4/4 सी/जावाईई- ESAPI_2.0a_install.doc – anton1980

+4

क्या हम ESAPI.properties फ़ाइल के लिए एक अद्यतन लिंक प्राप्त कर सकते हैं, क्योंकि वर्तमान वाला मर चुका है। –

+0

ESAPI.properties के लिए नया लिंक सोचें: https://code.google.com/p/owasp-esapi-java/source/browse/trunk/configuration/esapi/ESAPI.properties –

2

मैं जबकि मेरी webapp मैं हो रही थी की तैनाती के रूप में एक ही फाइल के लिए देख रहा था -

Mar 08, 2017 1:23:12 PM org.apache.catalina.core.StandardWrapperValve invoke 
SEVERE: Servlet.service() for servlet [mvc-dispatcher] in context with path [/WebDynamo] threw exception [org.owasp.esapi.errors.ConfigurationException: java.lang.reflect.InvocationTargetException SecurityConfiguration class (org.owasp.esapi.reference.DefaultSecurityConfiguration) CTOR threw exception.] with root cause 
java.lang.IllegalArgumentException: Failed to load ESAPI.properties as a classloader resource. 
    at org.owasp.esapi.reference.DefaultSecurityConfiguration.loadConfigurationFromClasspath(DefaultSecurityConfiguration.java:667) 

मेरी webapp के लिए वैसे भी मैं तो बस स्रोत रूट फ़ोल्डर (src फ़ोल्डर) में जोड़ा ESAPI.properties (नहीं है इसे किसी भी पैकेज में जोड़ें)। और फाइल बस खाली है। और वेब ऐप बस ठीक काम करता है। मैं webapp में निम्नलिखित लॉग देख, इसलिए यदि आप कभी सोच रहे हैं, जहां इस फाइल तो यह उल्लेख की खोज की जा रही है -

Attempting to load ESAPI.properties via file I/O. 
Attempting to load ESAPI.properties as resource file via file I/O. 
Not found in 'org.owasp.esapi.resources' directory or file not readable: /Applications/Eclipse.app/Contents/MacOS/ESAPI.properties 
Not found in SystemResource Directory/resourceDirectory: .esapi/ESAPI.properties 
Not found in 'user.home' (/Users/athakur) directory: /Users/athakur/esapi/ESAPI.properties 
Loading ESAPI.properties via file I/O failed. Exception was: java.io.FileNotFoundException 
Attempting to load ESAPI.properties via the classpath. 
SUCCESSFULLY LOADED ESAPI.properties via the CLASSPATH from '/ (root)' using current thread context class loader! 
SecurityConfiguration for Validator.ConfigurationFile not found in ESAPI.properties. Using default: validation.properties 
Attempting to load validation.properties via file I/O. 
Attempting to load validation.properties as resource file via file I/O. 
Not found in 'org.owasp.esapi.resources' directory or file not readable: /Applications/Eclipse.app/Contents/MacOS/validation.properties 
Not found in SystemResource Directory/resourceDirectory: .esapi/validation.properties 
Not found in 'user.home' (/Users/athakur) directory: /Users/athakur/esapi/validation.properties 
Loading validation.properties via file I/O failed. 
Attempting to load validation.properties via the classpath. 
validation.properties could not be loaded by any means. fail. Exception was: java.lang.IllegalArgumentException: Failed to load ESAPI.properties as a classloader resource. 
SecurityConfiguration for ESAPI.printProperties not found in ESAPI.properties. Using default: false 
SecurityConfiguration for Encryptor.CipherTransformation not found in ESAPI.properties. Using default: AES/CBC/PKCS5Padding 
SecurityConfiguration for ESAPI.Encoder not found in ESAPI.properties. Using default: org.owasp.esapi.reference.DefaultEncoder 
SecurityConfiguration for ESAPI.Logger not found in ESAPI.properties. Using default: org.owasp.esapi.reference.JavaLogFactory 
SecurityConfiguration for Logger.LogApplicationName not found in ESAPI.properties. Using default: true 
SecurityConfiguration for Logger.LogServerIP not found in ESAPI.properties. Using default: true 
SecurityConfiguration for Logger.ApplicationName not found in ESAPI.properties. Using default: DefaultName 

मुझे यकीन है कि इन विन्यास और अन्य फ़ाइलों को भी आप इसे फ़ोल्डर src जोड़ सकते हैं कर रहा हूँ। इसके अलावा, मैं इस फ़ाइल को मिला -

https://github.com/OWASP/EJSF/blob/master/esapi_master_FULL/WebContent/ESAPI.properties

फ़ाइल सुंदर इसे यहाँ सामग्री है चिपकाने के लिए बड़ा है, लेकिन मूलभूत मूल्यों यह निम्नलिखित बातें आवश्यक हैं ऊपर लॉग के अनुसार सेट कर रहा है के आधार पर -

ESAPI.printProperties=true 
Encryptor.CipherTransformation=AES/CBC/PKCS5Padding 
ESAPI.Encoder=org.owasp.esapi.reference.DefaultEncoder 
# Log4JFactory Requires log4j.xml or log4j.properties in classpath - http://www.laliluna.de/log4j-tutorial.html 
ESAPI.Logger=org.owasp.esapi.reference.Log4JLogFactory 
# Determines whether ESAPI should log the application name. This might be clutter in some single-server/single-app environments. 
Logger.LogApplicationName=true 
# Determines whether ESAPI should log the server IP and port. This might be clutter in some single-server environments. 
Logger.LogServerIP=true 
# Set the application name if these logs are combined with other applications 
Logger.ApplicationName=ExampleApplication 
संबंधित मुद्दे