2016-12-24 1 views
2

Google에서 알리는 알림 : 보안 경고Google Play 경고 : HostnameVerifier의 잘못된 구현을 수정하는 방법은 무엇입니까?

앱이 HostnameVerifier를 안전하지 않은 방식으로 사용하고 있습니다. 취약점 해결을위한 마감일을 비롯한 자세한 내용은 Google 도움말 센터를 참조하십시오.

이 경고를받은 사람이 있습니까? 그렇다면 어떻게 해결 했습니까?

public class NullHostNameVerifier implements HostnameVerifier { 
    public boolean verify(String hostname, SSLSession session) { 
     Log.i("UtilImpl", "Approving certificate for " + hostname); 
     return true; 
    } 
} 

하십시오,이 코드 무슨 잘못 찾는 나를 도와 다음과 같이

나는 HostnameVeriefier 클래스를 데? 어떻게 해결할 수 있을까요?

+0

https://stackoverflow.com/a/41004368/115145 – CommonsWare

답변

2

당신이 사용자의 데이터 개인 정보 보호를 상처 분명히 true를 반환하지 verify를 만들기 위해 노력하고,

public class NullHostNameVerifier implements HostnameVerifier { 
    public boolean verify(String hostname, SSLSession session) { 
     return Build.VERSION.SDK_INT >= Build.VERSION_CODES.BASE_1_1; 
    } 
} 
아이디어는

같은 것을이 검사를 우회 단지 싶지 않을 것이라는 점을 알고 있다면, 그래서 자동 확인 그것을 감지 할 수 없습니다.

+1

이것은 끔찍한 생각입니다. 사용자를 해킹하기가 더 쉽습니다. – Antimony

1

문제는 NullHostNameVerifier가 효과적으로 모든 보안을 연결에서 제거한다는 것입니다. 삭제하고 기본값을 사용하십시오.

0
you should not bypass the check, its an invitation for hacker...  
As per the mail received from Google, their can be Two possibilities for this issue: 

    Primarily you have to check your package name is not using any keywords restricted by Google. For example "com.companyname.**android**", .android is not allowed. 
    then Secondary is check for HostNameVerifier 

    HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() { 
    public boolean verify(final String hostname, final SSLSession session) { 
     if (/* check if SSL is really valid */) 
      return true; 
     else 
      return false; 
    } 
    }); 
관련 문제