Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RA-1875: EMPT110 Fixed XSS Vulnerability in AppId field on User App Page #89

Merged
merged 2 commits into from
Apr 22, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import javax.servlet.http.HttpSession;

import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.codehaus.jackson.map.ObjectMapper;
Expand Down Expand Up @@ -52,7 +53,7 @@ public void get(PageModel model, @RequestParam(value = "appId", required = false
public String post(PageModel model, @ModelAttribute(value = "appId") @BindParams UserApp userApp,
@RequestParam("action") String action,
@SpringBean("appFrameworkService") AppFrameworkService service, HttpSession session, UiUtils ui) {

try {
AppDescriptor descriptor = mapper.readValue(userApp.getJson(), AppDescriptor.class);
if (!userApp.getAppId().equals(descriptor.getId())) {
Expand All @@ -65,14 +66,14 @@ public String post(PageModel model, @ModelAttribute(value = "appId") @BindParams
service.saveUserApp(userApp);

InfoErrorMessageUtil.flashInfoMessage(session,
ui.message("referenceapplication.app.userApp.save.success", userApp.getAppId()));
ui.message("referenceapplication.app.userApp.save.success", StringEscapeUtils.escapeHtml(userApp.getAppId())));

return "redirect:/referenceapplication/manageApps.page";
}
}
catch (Exception e) {
session.setAttribute(UiCommonsConstants.SESSION_ATTRIBUTE_ERROR_MESSAGE,
ui.message("referenceapplication.app.userApp.save.fail", userApp.getAppId()));
ui.message("referenceapplication.app.userApp.save.fail", StringEscapeUtils.escapeHtml(userApp.getAppId())));
}

model.addAttribute("userApp", userApp);
Expand Down