datatheorem / TrustKit-Android

Easy SSL pinning validation and reporting for Android.
MIT License
584 stars 87 forks source link

Check NetSecConfig was able to load the policy do not happen after Android N #35

Closed danielesegato closed 6 years ago

danielesegato commented 6 years ago

I was looking at the library code and I noticed this check only run when the version is EXACTLY Android N. Shouldn't this be executed for later versions too? (>=)

// On Android N, ensure that the system was also able to load the policy
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.N) {
    // This will need to be updated/double-checked for subsequent versions of Android
    int systemConfigResId = getNetSecConfigResourceId(context);
    if (systemConfigResId == -1) {
        // Android did not find a policy because the supplied resource ID is wrong or the
        // policy file is not properly setup in the manifest, or contains bad data
        throw new ConfigurationException("TrustKit was initialized with a network policy " +
                "that was not properly configured for Android N - make sure it is in the " +
                "App's Manifest.");
    }
    else if (systemConfigResId != configurationResourceId) {
        throw new ConfigurationException("TrustKit was initialized with a different " +
                "network policy than the one configured in the App's manifest.");
    }
}

Am I missing something?

nabla-c0d3 commented 6 years ago

Hello, Thanks for the report - that's a good catch and we'll update this check. Thanks!

danielesegato commented 6 years ago

Wanted to do a pull request but the project is too old and it needs many upgrades, libraries version etc.

And I see 3 test failing :) I think I'll leave this to you guys.

jobot0 commented 6 years ago

@danielesegato It's in progress and should be released today or tomorrow :)

jobot0 commented 6 years ago

Should be resolved with #36 (1.1.0)