2015-03-26 43 views
7

Sto tentando di utilizzare la libreria ESAPI OWASP nella mia app Web per sfuggire ai parametri di richiesta in JSP come sotto ESAPI.encoder(). EncodeForHTML (request.getParameter()).Dove posso trovare ESAPI.properties?

ho aggiunto ESAPI-2.1.0.jar sotto WEB-INF/lib ma ottengo l'eccezione di seguito

org.owasp.esapi.errors.ConfigurationException: ESAPI.properties non potevano essere caricati con qualsiasi mezzo . Fallire. org.owasp.esapi.reference.DefaultSecurityConfiguration.loadConfiguration (DefaultSecurityConfiguration.java:439)

Ma non riesco a trovare ESAPI.properties nel file JAR. Qualche idea su dove posso ottenere questo? Anche dove dovrei posizionare questo file delle proprietà? Per favore aiuto.

+0

Una semplice [ricerca web] (https://www.owasp.org/index.php/ESAPI_Overview) fornisce la risposta. Per favore fai le tue ricerche prima di postare qui. –

+1

Grazie. Ma ancora non risponde alla mia domanda. Devo creare personalmente ESAPI.properties? Pensavo che l'API lo fornisse ma non riesco a trovare dove posso scaricare il file. – Pro

risposta

8

Ecco il riferimento: ESAPI installation guide.

È possibile scaricare ESAPI.properties da here.

È possibile creare autonomamente il file ESAPI.properties e posizionare lì lo stesso contenuto. Dovrebbe essere inserito nella cartella 'src/main/resources'.

Inoltre è necessario il file validation.properties per gestire XSS, che deve essere inserito nella cartella 'src/test/resources'.

Assicurati di cambiare il nome dell'applicazione in queste proprietà di file per l'applicazione come in

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

test dovrebbe essere sostituito con il nome dell'applicazione.

+4

Guida all'installazione per Java: https: //www.owasp.org/images/4/4c/JavaEE-ESAPI_2.0a_install.doc – anton1980

+4

È possibile ottenere un collegamento aggiornato per il file ESAPI.properties, poiché quello corrente è morto. –

+0

Il nuovo collegamento per ESAPI.properties è: https://code.google.com/p/owasp-esapi-java/source/browse/trunk/configuration/esapi/ESAPI.properties –

2

Cercavo stesso file durante la distribuzione mia webapp mi è stato sempre -

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) 

In ogni caso per la mia webapp Ho appena ESAPI.properties aggiunti nella cartella principale fonte (cartella src) (non fare aggiungilo in qualsiasi pacchetto). E il file è solo vuoto. E l'app Web funziona perfettamente. Vedo seguenti log nella webapp quindi se si sta sempre chiedendo dove questo file sia cercato quindi fare riferimento questo -

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 

sono certo questi sono configurabili e altri file anche voi potete aggiungerlo cartella src. Inoltre ho trovato il file in -

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

Il file è abbastanza grande per incollare il suo contenuto qui, ma in base ai valori di default viene impostazione come per i registri di cui sopra in seguito le cose sono tenuti -

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