Fix Android Connection Swap Issue (Server Side)

Summary:
- Take device id retrieved by matching CSR to the given CSR destination
  - Otherwise, use the previous way

Note:
- Backward compatibility will be fixed next diff

Reviewed By: jknoxville

Differential Revision: D17346422

fbshipit-source-id: 59b2fb9849373db1ba930dde702194c5fb201678
This commit is contained in:
Chaiwat Ekkaewnumchai
2019-09-16 05:31:10 -07:00
committed by Facebook Github Bot
parent 88197a7076
commit 2239ca65a5
3 changed files with 84 additions and 49 deletions

View File

@@ -346,7 +346,12 @@ export default class CertificateProvider {
return androidUtil
.pull(deviceId, processName, directory + csrFileName)
.then(deviceCsr => {
return this.santitizeString(deviceCsr.toString()) === csr;
// Santitize both of the string before comparation
// The csr string extraction on client side return string in both way
return (
this.santitizeString(deviceCsr.toString()) ===
this.santitizeString(csr)
);
});
}