Struts2 升级坑(Struts2本来就是一个坑)

    xiaoxiao2021-03-25  94

    前几天struts2又爆出高危漏洞,让我再一次对这个框架无语了。

    struts2 2.3 升以2.5时,费了好几天的时间项目可以跑起来了,本来还有一个高兴,一登录,呵呵Method login for action loginAction is not allowed!,我艹,百度了没有找到解决方法,无柰,只能用神器了google,终于找到了。

    这是因为 struts2.5 为了提升安全性,添加了 allomethod 这么个玩意。

    如果你的项目是用的配置文件方法

    <package name="exam" extends="json-default"> <global-allowed-methods>regex:.*</global-allowed-methods> <action name="user" class="userAction"> ... </action> </package>

    如果你的项目是用注解,到Action类上添加注解 @AllowedMethods

    希望对你们有用。

    转载请注明原文地址: https://ju.6miu.com/read-23017.html

    最新回复(0)