Monday, October 11, 2010

Tomcat中URL大小写问题

Tomcat中URL大小写问题
今天遇到个客户,强力要求我们软件开发人员把Tomcat设置成为URL地址大小写不敏感。

经过在网上查资料,有一个办法可以做到。就是在context.xml文件中对元素
Context定义设置caseSensitive="false"属性。

但是为了保险起见,我又到Tomcat官方网站去查元素Context定义的官方资料。官方资料的原文参考http://tomcat.apache.org/tomcat-6.0-doc/config/context.html。

caseSensitive

Deprecated. This option will be removed in Tomcat 7 onwards where the default of true will always be used.

If the value of this flag is false, all case sensitivity checks will be disabled. If not specified, the default value of the flag is true.

NOTE: This flag MUST NOT be set to false on the Windows platform (or any other OS which does not have a case sensitive filesystem), as it will disable case sensitivity checks, allowing JSP source code disclosure, among other security problems.

翻译过来就是:
caseSensitive已经过时。该选项将在Tomcat7中被删除,默认值只能一直为true。

如果这个标志值被设置为false,所有大小写检查将被禁用。如果没有特别指定,默认值的标志是true。

注意:这个标志禁止在Windows平台上(或者其他任何不区分文件大小写的操作系统)设为false,因为它会禁用大小写检查,允许JSP源代码泄漏,以及其他安全问题。

搞了半天,如果你是商用系统而且运行在Windows平台上,一定要说服用户URL地址必须大小写敏感,否则会造成一系列安全问题,造成不必要的经济损失。

No comments:

Post a Comment