Index: lams_central/conf/security/Owasp.CsrfGuard.properties =================================================================== diff -u -r8da0b0783bbfac4bb1fed3a5a5811c2f418fcae7 -r2eb3170d6501ff5206577dcaa8881209033c1f49 --- lams_central/conf/security/Owasp.CsrfGuard.properties (.../Owasp.CsrfGuard.properties) (revision 8da0b0783bbfac4bb1fed3a5a5811c2f418fcae7) +++ lams_central/conf/security/Owasp.CsrfGuard.properties (.../Owasp.CsrfGuard.properties) (revision 2eb3170d6501ff5206577dcaa8881209033c1f49) @@ -7,6 +7,7 @@ # Each key goes into a separate line prefixed with org.owasp.csrfguard.protected. # A key suffix must not contain a dot "." character org.owasp.csrfguard.protected.centralSaveUserProfile=/lams/saveprofile.do +org.owasp.csrfguard.protected.forumAuthoringSave=/lams/tool/lafrum11/authoring/update.do # Actions to take when a CSRF attack is attempted org.owasp.csrfguard.action.Log=org.owasp.csrfguard.action.Log Index: lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/controller/AuthoringController.java =================================================================== diff -u -rb71c9cb2f96eb891545d32aaca8904051d1e00d5 -r2eb3170d6501ff5206577dcaa8881209033c1f49 --- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/controller/AuthoringController.java (.../AuthoringController.java) (revision b71c9cb2f96eb891545d32aaca8904051d1e00d5) +++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/controller/AuthoringController.java (.../AuthoringController.java) (revision 2eb3170d6501ff5206577dcaa8881209033c1f49) @@ -76,6 +76,7 @@ import org.springframework.util.MultiValueMap; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.multipart.MultipartFile; /** @@ -112,7 +113,7 @@ // update define later flag to true request.setAttribute(AttributeNames.ATTR_MODE, ToolAccessMode.TEACHER); - + Long contentId = new Long(WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_CONTENT_ID)); Forum forum = forumService.getForumByContentId(contentId); @@ -126,7 +127,7 @@ return readDatabaseData(forumForm, request); } - + /** * Common method for "start" and "defineLater" */ @@ -227,10 +228,9 @@ *
  • Author user information
  • * */ - @RequestMapping("/update") + @RequestMapping(path = "/update", method = RequestMethod.POST) public String updateContent(@ModelAttribute ForumForm forumForm, HttpServletRequest request) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { - ToolAccessMode mode = WebUtil.readToolAccessModeAuthorDefaulted(request); request.setAttribute(AttributeNames.ATTR_MODE, mode.toString()); @@ -420,7 +420,7 @@ Set attSet = null; if (messageForm.getAttachmentFile() != null && !StringUtils.isEmpty(messageForm.getAttachmentFile().getOriginalFilename())) { - attSet = setupAttachmentSet(messageForm.getAttachmentFile(), message); + attSet = setupAttachmentSet(messageForm.getAttachmentFile(), message); } message.setAttachments(attSet); @@ -577,7 +577,7 @@ /* only allow one attachment, so replace whatever */ private Set setupAttachmentSet(MultipartFile attachmentFile, Message msg) { Attachment att = forumService.uploadAttachment(attachmentFile); - Set attSet = new HashSet(); + Set attSet = new HashSet<>(); attSet.add(att); att.setMessage(msg); return attSet; Index: lams_tool_forum/web/WEB-INF/tlds/security/csrfguard.tld =================================================================== diff -u --- lams_tool_forum/web/WEB-INF/tlds/security/csrfguard.tld (revision 0) +++ lams_tool_forum/web/WEB-INF/tlds/security/csrfguard.tld (revision 2eb3170d6501ff5206577dcaa8881209033c1f49) @@ -0,0 +1,70 @@ + + + + 1.2 + 2.0 + Owasp CsrfGuard Tag Library + http://www.owasp.org/index.php/Category:OWASP_CSRFGuard_Project/Owasp.CsrfGuard.tld + + token + org.owasp.csrfguard.tag.TokenTag + empty + + uri + false + true + + + + tokenname + org.owasp.csrfguard.tag.TokenNameTag + empty + + + tokenvalue + org.owasp.csrfguard.tag.TokenValueTag + empty + + uri + false + true + + + + a + org.owasp.csrfguard.tag.ATag + true + + + form + org.owasp.csrfguard.tag.FormTag + true + + Index: lams_tool_forum/web/WEB-INF/web.xml =================================================================== diff -u -rb935721d25817b83c29d3166a7fa9b4b9b7d3785 -r2eb3170d6501ff5206577dcaa8881209033c1f49 --- lams_tool_forum/web/WEB-INF/web.xml (.../web.xml) (revision b935721d25817b83c29d3166a7fa9b4b9b7d3785) +++ lams_tool_forum/web/WEB-INF/web.xml (.../web.xml) (revision 2eb3170d6501ff5206577dcaa8881209033c1f49) @@ -23,7 +23,7 @@ parentContextKey context.central - + hibernateFilter @@ -51,7 +51,11 @@ UTF-8 - + + CSRFGuard + org.owasp.csrfguard.CsrfGuardFilter + + hibernateFilter /* @@ -64,7 +68,11 @@ LocaleFilter /* - + + CSRFGuard + *.do + + spring @@ -78,7 +86,7 @@ org.springframework.web.context.ContextLoaderListener - + Connector net.fckeditor.connector.ConnectorServlet @@ -173,7 +181,14 @@ tags-lams /WEB-INF/tlds/lams/lams.tld - + + + + + csrfguard + /WEB-INF/tlds/security/csrfguard.tld + + Index: lams_tool_forum/web/common/taglibs.jsp =================================================================== diff -u -re062c5aeec4bd7e7f970ae5e907e8a7e59edaeaf -r2eb3170d6501ff5206577dcaa8881209033c1f49 --- lams_tool_forum/web/common/taglibs.jsp (.../taglibs.jsp) (revision e062c5aeec4bd7e7f970ae5e907e8a7e59edaeaf) +++ lams_tool_forum/web/common/taglibs.jsp (.../taglibs.jsp) (revision 2eb3170d6501ff5206577dcaa8881209033c1f49) @@ -5,4 +5,5 @@ <%@ taglib uri="tags-xml" prefix="x" %> <%@ taglib uri="tags-lams" prefix="lams" %> - <%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %> +<%@ taglib uri="csrfguard" prefix="csrf" %> +<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %> Index: lams_tool_forum/web/jsps/authoring/authoring.jsp =================================================================== diff -u -rb71c9cb2f96eb891545d32aaca8904051d1e00d5 -r2eb3170d6501ff5206577dcaa8881209033c1f49 --- lams_tool_forum/web/jsps/authoring/authoring.jsp (.../authoring.jsp) (revision b71c9cb2f96eb891545d32aaca8904051d1e00d5) +++ lams_tool_forum/web/jsps/authoring/authoring.jsp (.../authoring.jsp) (revision 2eb3170d6501ff5206577dcaa8881209033c1f49) @@ -36,8 +36,8 @@ - - + +