You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.
If the device is tampered—that is, if basicIntegrity is set to false in the response—the verdict might not contain data about the calling app, such as the apkPackageName and apkCertificateDigestSha256. This occurs when our systems cannot reliably determine the calling app.
Sure enough, I've got a test device w/ Magisk right now, that is failing SafetyNet. I get an attestation response like so:
However, the getApkDigestSha256() property in the AttestationStatement.java example file for offline server validation does not take this null into account.
public byte[] getApkDigestSha256() {
return Base64.decodeBase64(apkDigestSha256);
}
So, if you call this property on a failing device, it explodes.
The fix is simple, we just need a null check:
public byte[] getApkDigestSha256() {
return apkDigestSha256 != null ? Base64.decodeBase64(apkDigestSha256) : new byte[0];
}
I've fixed this locally, filing this so I can contribute the fix.
The text was updated successfully, but these errors were encountered:
dphillipsprosper
changed the title
AttestationStatement.java getApkDigestSha256() does not properly handle null
AttestationStatement.java getApkDigestSha256() does not properly handle null
Mar 21, 2019
dphillipsprosper
added a commit
to dphillipsprosper/android-play-safetynet
that referenced
this issue
Mar 21, 2019
According to the docs at https://developer.android.com/training/safetynet/attestation:
Sure enough, I've got a test device w/ Magisk right now, that is failing SafetyNet. I get an attestation response like so:
However, the
getApkDigestSha256()
property in theAttestationStatement.java
example file for offline server validation does not take thisnull
into account.So, if you call this property on a failing device, it explodes.
The fix is simple, we just need a
null
check:I've fixed this locally, filing this so I can contribute the fix.
The text was updated successfully, but these errors were encountered: