Skip to content
Open
Show file tree
Hide file tree
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
7 changes: 4 additions & 3 deletions src/com/ibm/security/appscan/altoromutual/api/AdminAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.security.MessageDigest;

import org.apache.wink.json4j.*;

Expand Down Expand Up @@ -46,8 +47,8 @@ public Response changePassword(String bodyJSON, @Context HttpServletRequest requ
|| password2 == null || password2.trim().length() == 0)
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity("{\"error\":\"An error has occurred. Please try again later.\"}").build();

if (!password1.equals(password2)){
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity("{\"error\":\"Entered passwords did not match.\"}").build();
if (!MessageDigest.isEqual(password1.getBytes(), password2.getBytes())){
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity("{\"error\":\"Entered passwords did not match.\"}").build();;
}

String error = null;
Expand Down Expand Up @@ -93,7 +94,7 @@ public Response addUser(String bodyJSON, @Context HttpServletRequest request) th
|| password2 == null || password2.trim().length() == 0)
return Response.status(Response.Status.BAD_REQUEST).entity("{\"error\":\"An error has occurred. Please try again later.\"}").build();

if (!password1.equals(password2)){
if (!MessageDigest.isEqual(password1.getBytes(), password2.getBytes())){
return Response.status(Response.Status.BAD_REQUEST).entity("{\"error\":\"Entered passwords did not match.\"}").build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,13 @@ public static String[] searchArticles(String query, String path) {
try {
document = DocumentBuilderFactory.newInstance()
.newDocumentBuilder().parse(file);
dbf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
dbf.setFeature("http://xml.org/sax/features/external-general-entities", false);
dbf.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
dbf.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
dbf.setXIncludeAware(false);
dbf.setExpandEntityReferences(false);

// root node
NodeList nodes = document.getElementsByTagName("news");

Expand Down