åç
OGNLã®ãªãã§ãã§ãã便å©ãã¯å®è£ ã®çãã«ããè å¨ã«å¯¾ãã¦ç¡é²åã¨ãªãå¯è½æ§ãããã¾ãããã
https://www.sec-consult.com/files/20120104-0_Apache_Struts2_Multiple_Critical_Vulnerabilities.txt
2.3.1 ãªã©ç¸å½æ¯ããã¨æããããã¼ã¸ã§ã³ã§ãå¤é¨ãããªãã§ãã§ãã¦ãã¾ãã»ãã¥ãªãã£ãã¼ã«ãå¤æ°ï¼ç¬)çºè¦ããããªã©æããããã¦ã¨ã¦ãæ¥åã§ä½¿ãããã®ã§ã¯ãªãããããã¾ããã
default-interceptor-refã®ãã°
Struts2ã®è¨å®ã§ default-interceptor-ref ãæå®ããã¨ãã¡ãã¡åå¥ã® Action ã« interceptor-ref ãæ¸ããªãã§æ¸ãã®ã§ package 㧠default-interceptor-ref ãæå®ã㦠package å ã® Action ã§ã¯ãã¹ã¦å ±éã®interceptorã¹ã¿ãã¯ãé©ç¨ãããããªæå®æ¹æ³ãã¨ã£ã¦ããã
ãããã°ããããã®æ¹æ³ã¯æ³¨æãå¿ è¦ã ã£ãã
ç¶ããèªãs:includeã«ããJSPã®é¨åååã³
以åJSPã®é¨ååãæ¤è¨ããã¨ãã« s:includeã«ããé¨ååã¯ä»®å¼æ°ã使ããªããªã©ãã¾ãã¡ä½¿ãåæãè¯ããªãã¨çµè«ä»ãããæè¿ã¨ã¦ãè¯ãæ¹æ³ãæãã¤ããã
ããã¯
ç¶ããèªãæ¥æ¬èªStruts2æ¬ãçºå£²ã«ãªãã¾ã
æ¯æ¥ã³ãã¥ãã±ã¼ã·ã§ã³ãºç¤¾ããæ¬ãµã¤ãé¢é£ã®Struts2ã¨åã³ã³ãã¼ãã³ãã®æ¥æ¬èªã®æ¬ãåºçããããã¨ã«ãªãã¾ããã
- ä½è : ä¸å½é¸æ
- åºç社/ã¡ã¼ã«ã¼: æ¯æ¥ã³ãã¥ãã±ã¼ã·ã§ã³ãº
- çºå£²æ¥: 2008/11/28
- ã¡ãã£ã¢: åè¡æ¬ï¼ã½ããã«ãã¼ï¼
- è³¼å ¥: 4人 ã¯ãªãã¯: 185å
- ãã®ååãå«ãããã° (12件) ãè¦ã
ãµã³ãã«ã¢ããªã±ã¼ã·ã§ã³ã®ä½æãéãã¦Struts2+Spring2+Tiles+iBATIS+GWTã®ãã«ã¹ã¿ãã¯æ§æã§ã®Webãµã¤ãä½æãã¨ã¦ãç°¡åã«è¡ãããã«ãªãã¾ãã
struts 2.0.12
Struts2ã2.0.12ã«ãã¼ã¸ã§ã³ã¢ãããã¦ããã
ã¢ããã°ã¬ã¼ãã¯jarãå·®ãæ¿ããã ããªã®ã§åé¡ã¯ç¡ããã©ã¡ãã£ã¨ã¯ã¾ã£ãã®ã§ããã
WTPç°å¢ã§ãWEB-INF/lib ä¸ã®å¤ããã¼ã¸ã§ã³ã®jarãåé¤ãã¦ãæ°ããjarã«å
¥ãæ¿ããµã¼ãã¼ãèµ·åãããã¨ããã¨ãã
Unable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory - bean - jar:file:/C:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/struts2test/WEB-INF/lib/struts2-core-2.0.12.jar!/struts-default.xml:30:72 at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:208) at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:101) at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reload(DefaultConfiguration.java:131) at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:52) at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:395) at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:452) at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:201) at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275) at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397) at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108) at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3696) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4343) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at org.apache.catalina.core.StandardHost.start(StandardHost.java:719) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.core.StandardService.start(StandardService.java:516) at org.apache.catalina.core.StandardServer.start(StandardServer.java:710) at org.apache.catalina.startup.Catalina.start(Catalina.java:566) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413) Caused by: Bean type class com.opensymphony.xwork2.ObjectFactory with the name xwork has already been loaded by bean - jar:file:/C:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/struts2test/WEB-INF/lib/struts2-core-2.0.11.jar!/struts-default.xml:30:72 - bean - jar:file:/C:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/struts2test/WEB-INF/lib/struts2-core-2.0.12.jar!/struts-default.xml:30:72 at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:193) ... 24 more
ã¨ããã¨ã©ã¼ã§èµ·åã§ããã
http://issues.apache.org/struts/browse/WW-2478
ãããªæãã§ãã
ã§ãçµå± WTPã®ãããã¤ãããå´ã«å¤ãjarãæ¶ãããæ®ã£ã¦ããã®ãåå ã ã£ãã
å¤ãjarãåé¤ããã¨ããåé¡ãªããªãèµ·åããããã«ãªã£ãã
ã©ããWTPã 㨠WEB-INF/lib ä¸ã«é¢ãã¦ã¯è¿½å ã¯åæãã¦ãããããåé¤ã¯ãããªãããã ã
ãã®ã¨ã©ã¼ãåºããWTPã®ãããã¤å ã®
<ã¯ã¼ã¯ã¹ãã¼ã¹>\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps
ã®ä¸ãããã«é ç½®ãã¦ããã¢ããªã確èªããå¿ è¦ãããã
Interceptorãã©ã¡ã¼ã¿è¨å®
Struts2ã§Interceptorã®ãã©ã¡ã¼ã¿ãè¨å®ããå ´åã
<interceptor-ref name="hoge"> <param name="fileUpload.maxallowsize">10000</param> </intrerceptor-ref>
ãªã©ã¨è¨è¿°ãããã¨ãã§ãã¦ä¾¿å©ã§ããããhogeã¤ã³ã¿ã¼ã»ãã¿ã¼ã»ã¹ã¿ãã¯ã« fileUpload ã¤ã³ã¿ã¼ã»ãã¿ã¼ãç¡ãã¦ãã¨ã©ã¼ã«ãªããªãã®ã§æ³¨æãå¿ è¦ã ã
åå¨ããªãã¤ã³ã¿ã¼ã»ãã¿ã¼åã§ããã°è¦åãåºãããåå¨ããªãããããã£ã§ãè¦åãåºãããããåå¨ããã¤ã³ã¿ã¼ã»ãã¿ã¼åã ã¨ã¤ã³ã¿ã¼ã»ãã¿ã¼ã»ã¹ã¿ãã¯ã«åæããã¦ããªãã¦ãè¦åãã¦ãããªãã®ã ã
å®éã«ã¯è¨å®ã¯ç¡è¦ããã¦æ©è½ããªãã®ã§è¦åããããã¦ããã¦ãããããã ã
ã¡ãã£ã¨TIPSï¼devModeãtureã«ãã¦ãè¦åãã¦ãããªãã
OGNLã§NestããMapã¸ã®ã¢ã¯ã»ã¹
Struts2ã®OGNLã§ã®NestããMapã¸ã®ã¢ã¯ã»ã¹ã§å°ãèºããã
<s:set name="nestmap" value="#{ 'a' : #{ 'A' : 'aa', 'B' : 'bb' }, 'b' : #{ 'A' : 'cc', 'B' : 'dd' } }"/>
ãã®ãããªNestããMapããã£ãã¨ãã¦ãããã«ã¢ã¯ã»ã¹ããå ´å次ã®ã©ãã§ãã¢ã¯ã»ã¹ã§ãã
<s:property value="#nestmap.a.A"/> <s:property value="#nestmap['a'].A"/> <s:property value="#nestmap['a']['A']"/>
ããã¯åé¡ãªãããããã次ã®ããã«ä¸é層ãä»£å ¥ãã¦ã¢ã¯ã»ã¹ãããã¨ããã¨æå³éãã«åä½ããªã
<s:set name="secondmap" value="#nestmap.a"/> <s:property value="#secondmap.A"/>
ãªãã ããã