Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Android Attestation Validation #264

Merged
merged 8 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/breezy-lions-battle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"io-wallet-user-func": patch
---

Fix Android Attestation revocation validation
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,25 @@ export const validateRevocation = async (
});
}
const crl = (await res.json()) as CRL; // Add type assertion for crl
const isRevoked = x509Chain.some((cert) => cert.serialNumber in crl.entries);

const revokedSerials = Object.keys(crl.entries).map((key) =>
grausof marked this conversation as resolved.
Show resolved Hide resolved
key.toLowerCase(),
);

const isRevoked = x509Chain.some((cert) => {
const currentSn = cert.serialNumber.toLowerCase();
return revokedSerials.some((revokedSerial) =>
currentSn.includes(revokedSerial),
);
});

if (isRevoked) {
throw new AndroidAttestationError("Certificate is revoked", {
x509Chain,
});
throw new AndroidAttestationError(
"A certificate within the chain has been revoked by Google",
{
x509Chain,
},
);
}
return x509Chain;
};
Expand Down
Loading