Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Unsafe implementation of the HostnameVerifier interface

Abierto
#20 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
38/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
java

Línea de trabajo

Busca en el código fuente de Java los usos de HostnameVerifier y setHostnameVerifier y, después, inspecciona el verificador personalizado y la ruta de conexión del accordion que se muestra en el issue. Se considera terminado cuando la implementación ya no confía incondicionalmente en cualquier hostname, sino que aplica las comprobaciones del hostname esperado sin suprimir los fallos de verificación.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Google now is blocking updates to apps that include libraries that have "unsafe" HostnameVerifier implementations. They seem to pattern match the code so always returning true even from a HostnameVerifier that is only used in a safe context the fact that it always returns true seems to trip the filter.

https://support.google.com/faqs/answer/7188426

To properly handle hostname verification, change the implementation of your custom HostnameVerifier interface to perform the following actions:

  • If you are using the HostnameVerifier interface, change the implementation of the verify method to return false whenever the hostname of the server does not meet your expectations.
  • If you are using the X509HostnameVerifier interface, change the implementation of the verify methods (variants 1, 2, 3) to raise an SSLException whenever the hostname of the server does not meet your expectations. Ensure that the Exceptions raised within your verify implementation are not caught and suppressed within the method. Suppressing Exceptions in this manner would cause verify to exit normally, leading the app to trust all hostnames.
package com.deezer.sdk.network.b;

...

public class Blues {
  
  ...
  
  private static final HostnameVerifier bagpipes = new HostnameVerifier() {
      public final boolean verify(String hostname, SSLSession session) {
          return true;
      }
  };

  ...

  private static HttpURLConnection accordion(String var0, String var1, boolean var2) throws IOException {
      Object var3;
      if (var2) {
          ((HttpsURLConnection)(var3 = (HttpsURLConnection)(new URL(var0)).openConnection())).setHostnameVerifier(bagpipes);
      } else {
          var3 = (HttpURLConnection)(new URL(var0)).openConnection();
      }

      ((HttpURLConnection)var3).setRequestProperty("User-Agent", var1);
      return (HttpURLConnection)var3;
  }

  ...

}
Lenguaje dominante
Java
Estrellas
42
Forks
25
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Aún no hemos revisado los archivos de configuración de este proyecto. Empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de deezer/android-sample

Todos los issues de deezer/android-sample

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.