sonatype-lift[bot] commented on code in PR #1263: URL: https://github.com/apache/solr/pull/1263#discussion_r1060206538
########## solr/core/src/java/org/apache/solr/handler/admin/ZookeeperStatusHandler.java: ########## @@ -292,42 +333,62 @@ protected List<String> getZkRawResponse(String zkHostPort, String fourLetterWord port = Integer.parseInt(hostPort[1]); } - try ( - Socket socket = new Socket(host, port); + try (Socket socket = new Socket(host, port); Review Comment: *[UNENCRYPTED_SOCKET](https://find-sec-bugs.github.io/bugs.htm#UNENCRYPTED_SOCKET):* Unencrypted socket to org.apache.solr.handler.admin.ZookeeperStatusHandler (instead of SSLSocket) --- <details><summary><b>âšī¸ Learn about @sonatype-lift commands</b></summary> You can reply with the following commands. For example, reply with ***@sonatype-lift ignoreall*** to leave out all findings. | **Command** | **Usage** | | ------------- | ------------- | | `@sonatype-lift ignore` | Leave out the above finding from this PR | | `@sonatype-lift ignoreall` | Leave out all the existing findings from this PR | | `@sonatype-lift exclude <file\|issue\|path\|tool>` | Exclude specified `file\|issue\|path\|tool` from Lift findings by updating your config.toml file | **Note:** When talking to LiftBot, you need to **refresh** the page to see its response. <sub>[Click here](https://github.com/apps/sonatype-lift/installations/new) to add LiftBot to another repo.</sub></details> --- Was this a good recommendation? [ [đ Not relevant](https://www.sonatype.com/lift-comment-rating?comment=365234367&lift_comment_rating=1) ] - [ [đ Won't fix](https://www.sonatype.com/lift-comment-rating?comment=365234367&lift_comment_rating=2) ] - [ [đ Not critical, will fix](https://www.sonatype.com/lift-comment-rating?comment=365234367&lift_comment_rating=3) ] - [ [đ Critical, will fix](https://www.sonatype.com/lift-comment-rating?comment=365234367&lift_comment_rating=4) ] - [ [đ Critical, fixing now](https://www.sonatype.com/lift-comment-rating?comment=365234367&lift_comment_rating=5) ] ########## solr/core/src/java/org/apache/solr/update/processor/MD5Signature.java: ########## @@ -15,21 +15,23 @@ * limitations under the License. */ package org.apache.solr.update.processor; + import java.nio.charset.StandardCharsets; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class MD5Signature extends Signature { - private static ThreadLocal<MessageDigest> DIGESTER_FACTORY = new ThreadLocal<MessageDigest>() { - @Override - protected MessageDigest initialValue() { - try { - return MessageDigest.getInstance("MD5"); - } catch (NoSuchAlgorithmException e) { - throw new RuntimeException(e); - } - } - }; + private static ThreadLocal<MessageDigest> DIGESTER_FACTORY = + new ThreadLocal<MessageDigest>() { + @Override + protected MessageDigest initialValue() { + try { + return MessageDigest.getInstance("MD5"); Review Comment: *[WEAK_MESSAGE_DIGEST_MD5](https://find-sec-bugs.github.io/bugs.htm#WEAK_MESSAGE_DIGEST_MD5):* This API MD5 (MDX) is not a recommended cryptographic hash function --- <details><summary><b>âšī¸ Learn about @sonatype-lift commands</b></summary> You can reply with the following commands. For example, reply with ***@sonatype-lift ignoreall*** to leave out all findings. | **Command** | **Usage** | | ------------- | ------------- | | `@sonatype-lift ignore` | Leave out the above finding from this PR | | `@sonatype-lift ignoreall` | Leave out all the existing findings from this PR | | `@sonatype-lift exclude <file\|issue\|path\|tool>` | Exclude specified `file\|issue\|path\|tool` from Lift findings by updating your config.toml file | **Note:** When talking to LiftBot, you need to **refresh** the page to see its response. <sub>[Click here](https://github.com/apps/sonatype-lift/installations/new) to add LiftBot to another repo.</sub></details> --- Was this a good recommendation? [ [đ Not relevant](https://www.sonatype.com/lift-comment-rating?comment=365234348&lift_comment_rating=1) ] - [ [đ Won't fix](https://www.sonatype.com/lift-comment-rating?comment=365234348&lift_comment_rating=2) ] - [ [đ Not critical, will fix](https://www.sonatype.com/lift-comment-rating?comment=365234348&lift_comment_rating=3) ] - [ [đ Critical, will fix](https://www.sonatype.com/lift-comment-rating?comment=365234348&lift_comment_rating=4) ] - [ [đ Critical, fixing now](https://www.sonatype.com/lift-comment-rating?comment=365234348&lift_comment_rating=5) ] ########## solr/core/src/java/org/apache/solr/util/CryptoKeys.java: ########## @@ -129,21 +115,21 @@ public static PublicKey getX509PublicKey(byte[] buf) * Verify the signature of a file * * @param publicKey the public key used to sign this - * @param sig the signature - * @param data The data tha is signed + * @param sig the signature + * @param data The data tha is signed */ - public static boolean verify(PublicKey publicKey, byte[] sig, ByteBuffer data) throws InvalidKeyException, SignatureException { + public static boolean verify(PublicKey publicKey, byte[] sig, ByteBuffer data) + throws InvalidKeyException, SignatureException { data = ByteBuffer.wrap(data.array(), data.arrayOffset(), data.limit()); try { Signature signature = Signature.getInstance("SHA1withRSA"); Review Comment: *[WEAK_MESSAGE_DIGEST_SHA1](https://find-sec-bugs.github.io/bugs.htm#WEAK_MESSAGE_DIGEST_SHA1):* This API SHA1 (SHA-1) is not a recommended cryptographic hash function --- <details><summary><b>âšī¸ Learn about @sonatype-lift commands</b></summary> You can reply with the following commands. For example, reply with ***@sonatype-lift ignoreall*** to leave out all findings. | **Command** | **Usage** | | ------------- | ------------- | | `@sonatype-lift ignore` | Leave out the above finding from this PR | | `@sonatype-lift ignoreall` | Leave out all the existing findings from this PR | | `@sonatype-lift exclude <file\|issue\|path\|tool>` | Exclude specified `file\|issue\|path\|tool` from Lift findings by updating your config.toml file | **Note:** When talking to LiftBot, you need to **refresh** the page to see its response. <sub>[Click here](https://github.com/apps/sonatype-lift/installations/new) to add LiftBot to another repo.</sub></details> --- Was this a good recommendation? [ [đ Not relevant](https://www.sonatype.com/lift-comment-rating?comment=365234368&lift_comment_rating=1) ] - [ [đ Won't fix](https://www.sonatype.com/lift-comment-rating?comment=365234368&lift_comment_rating=2) ] - [ [đ Not critical, will fix](https://www.sonatype.com/lift-comment-rating?comment=365234368&lift_comment_rating=3) ] - [ [đ Critical, will fix](https://www.sonatype.com/lift-comment-rating?comment=365234368&lift_comment_rating=4) ] - [ [đ Critical, fixing now](https://www.sonatype.com/lift-comment-rating?comment=365234368&lift_comment_rating=5) ] ########## solr/core/src/java/org/apache/solr/servlet/RedirectServlet.java: ########## @@ -17,47 +17,43 @@ package org.apache.solr.servlet; import java.io.IOException; - import javax.servlet.ServletConfig; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -/** - * A Simple redirection servlet to help us deprecate old UI elements - */ +/** A Simple redirection servlet to help us deprecate old UI elements */ public class RedirectServlet extends BaseSolrServlet { - + static final String CONTEXT_KEY = "${context}"; - + String destination; int code = HttpServletResponse.SC_MOVED_PERMANENTLY; - + @Override public void init(ServletConfig config) throws ServletException { super.init(config); - + destination = config.getInitParameter("destination"); - if(destination==null) { + if (destination == null) { throw new ServletException("RedirectServlet missing destination configuration"); } - if( "false".equals(config.getInitParameter("permanent") )) { + if ("false".equals(config.getInitParameter("permanent"))) { code = HttpServletResponse.SC_MOVED_TEMPORARILY; } - + // Replace the context key - if(destination.startsWith(CONTEXT_KEY)) { - destination = config.getServletContext().getContextPath() - +destination.substring(CONTEXT_KEY.length()); + if (destination.startsWith(CONTEXT_KEY)) { + destination = + config.getServletContext().getContextPath() + destination.substring(CONTEXT_KEY.length()); } } - + @Override public void doGet(HttpServletRequest req, HttpServletResponse res) - throws ServletException,IOException { - + throws ServletException, IOException { + res.setStatus(code); res.setHeader("Location", destination); Review Comment: *[UNVALIDATED_REDIRECT](https://find-sec-bugs.github.io/bugs.htm#UNVALIDATED_REDIRECT):* The following redirection could be used by an attacker to redirect users to a phishing website. --- <details><summary><b>âšī¸ Learn about @sonatype-lift commands</b></summary> You can reply with the following commands. For example, reply with ***@sonatype-lift ignoreall*** to leave out all findings. | **Command** | **Usage** | | ------------- | ------------- | | `@sonatype-lift ignore` | Leave out the above finding from this PR | | `@sonatype-lift ignoreall` | Leave out all the existing findings from this PR | | `@sonatype-lift exclude <file\|issue\|path\|tool>` | Exclude specified `file\|issue\|path\|tool` from Lift findings by updating your config.toml file | **Note:** When talking to LiftBot, you need to **refresh** the page to see its response. <sub>[Click here](https://github.com/apps/sonatype-lift/installations/new) to add LiftBot to another repo.</sub></details> --- Was this a good recommendation? [ [đ Not relevant](https://www.sonatype.com/lift-comment-rating?comment=365234405&lift_comment_rating=1) ] - [ [đ Won't fix](https://www.sonatype.com/lift-comment-rating?comment=365234405&lift_comment_rating=2) ] - [ [đ Not critical, will fix](https://www.sonatype.com/lift-comment-rating?comment=365234405&lift_comment_rating=3) ] - [ [đ Critical, will fix](https://www.sonatype.com/lift-comment-rating?comment=365234405&lift_comment_rating=4) ] - [ [đ Critical, fixing now](https://www.sonatype.com/lift-comment-rating?comment=365234405&lift_comment_rating=5) ] -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org For additional commands, e-mail: issues-h...@solr.apache.org