我有一个WAS9服务器,有两个不同的web应用程序,每个都有ESAPI2.1库及其ESAPI.properties和validation.properties文件:
A\webcontent\web-inf\esapi\ESAPI.properties
A\webcontent\web-inf\esapi\validation.properties
B\webcontent\web-inf\esapi\ESAPI.properties
B\webcontent\web-inf\esapi\validation.properties在应用程序B中,validation.properties文件具有不在应用程序A中的验证,当应用程序B单独正常工作时,但当两个应用程序在一起时,B应用程序获取A的属性文件,并且不加载其验证,因此它会给出错误。
我测试更改B将属性文件移动到"src\esapi“和"src\org\owasp\esapi\resources”中,但总是出现相同的错误
选定的类型不是通过ESAPI验证配置设置的
java.lang.IllegalArgumentException: The selected type was not set via the ESAPI validation configuration
at org.owasp.esapi.reference.DefaultValidator.getValidInput(DefaultValidator.java:208)
at org.owasp.esapi.reference.DefaultValidator.getValidInput(DefaultValidator.java:185)我的web.xml:
<context-param>
<param-name>esapiProperties</param-name>
<param-value>/esapi/ESAPI.properties</param-value>
</context-param>
<context-param>
<param-name>validationEsapiProperties</param-name>
<param-value>/esapi/validation.properties</param-value>
</context-param>或者:
<context-param>
<param-name>esapiProperties</param-name>
<param-value>/org/owasp/esapi/resources/ESAPI.properties</param-value>
</context-param>
<context-param>
<param-name>validationEsapiProperties</param-name>
<param-value>/org/owasp/esapi/resources/validation.properties</param-value>
</context-param>发布于 2021-11-17 16:06:41
您正在尝试的用例与最初的项目维护者所做的设计选择是相反的。因为它们将所有ESAPI类实现为单例,所以您不能在同一运行时实例中实例化两个不同的ESAPI实例,在本例中是您的websphere实例。这是一个典型的竞争条件,第一个加载资源的应用程序就是获胜的应用程序。我认为这个决定在一定程度上是对这样一个事实的回应,即该库的编写是为了修复损坏的网站,在这种情况下,单例有助于确保加载的是您的。
目前唯一的解决方案--是不理想的。一种是将所有验证合并到一个实例中,另一种是将不同的应用程序部署到Websphere的不同实例中。
ESAPI 3.X是我期望看到一个更有意义的默认值的时候。
发布于 2021-11-30 17:54:33
假设ESAPI 2.1.0和一个典型的Eclipse动态web应用程序带有src文件夹:
如果需要更多信息,请查看javadoc注解in override method。
https://stackoverflow.com/questions/69992603
复制相似问题