Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Unsafe implementation of the HostnameVerifier interface

オープン
#20 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
38/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
java

調査の方向性

Javaソースで HostnameVerifier と setHostnameVerifier の使用箇所を検索し、続いてカスタム verifier と issue に示されている accordion の接続パスを調査します。実装がすべての hostname を無条件に信頼するのではなく、期待される hostname のチェックを適用し、検証失敗を抑制しなくなれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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;
  }

  ...

}
主要言語
Java
スター
42
フォーク
25
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトの環境構築ファイルはまだ確認していません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

deezer/android-sample のほかの issue

deezer/android-sample の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。