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

Redirect URI Verification enforces using the oldest app signature in it's signature history instead of the newest #1920

Open
felix-klose opened this issue Oct 12, 2023 · 3 comments
Labels
Inevstigation Engineering team as looked into the issue and needs deeper investigation to provide a conclusion
Projects

Comments

@felix-klose
Copy link

We recently updated our signing key in the google play store and updated our app's redirect URL to use the updated signature. This resulted in an exception thrown by PublicClientApplicationConfiguration::verifyRedirectUriWithAppSignature() when trying to authenticate users since it iterates the signature history from oldest to newest but throws an exception as soon as the first signature hash doesn't match the redirect URI.

Is this intended behavior or a bug? We expected to be able to use our updated signatures with AAD but it doesn't seem to be possible.

@negoe negoe added the Inevstigation Engineering team as looked into the issue and needs deeper investigation to provide a conclusion label Oct 16, 2023
@negoe
Copy link
Contributor

negoe commented Oct 16, 2023

Hi @felix-klose, Can you please share the following:

  • Device: [e.g. Pixel, OnePlus 6, etc]
  • Android Version: [e.g. API Level, Build Number]
  • Browser [e.g. Chrome, Edge]
  • MSAL Version

This needs further investigation from our side in order to confirm you.

@negoe negoe added this to Needs triage in Bug Triage via automation Oct 16, 2023
@felix-klose
Copy link
Author

Hi @negoe,

we tested our implementation with the following devices:

  • Samsung Galaxy A50, Android 11 (SDK 30), Build Number RP1A.200720.012A505FNXXU9CWB4
  • Google Pixel 7a, Android 13 (SDK 33), Build Number TD4A.221205.042.A1
  • Nokia X20, Android 13 (SDK 33), Build Number 00WW_3_500_SP02

with Chrome with MSAL version 4.1.3

We further analyzed our certificate history to fully understand what's going on, so in case this helps you, here's what we found:

As I said the issue happened after updating the signing key in the Play Store. It has to be noted though, that we switched from a Google managed key to our own key, which means that the certificate DN changed. A change in certificate DN can however not be rolled out to devices running on Android 12 or below, which means apks for older devices are still signed with the original Google key. For Android 13 and above, the new key is used, but the old key ist still valid in the certificate history.

When generating the redirect URL, we used the newest signature from the history, which is the new signature for Android 13 and above, and the old signature for Android 12 and below. For older devices, this worked, for newer devices we got an exception from the code cited above, showing that MSAL expected the old signature.

We haven't tried to verify this with signing key updates where the new key has the same DN as the old key or where the old key is no longer valid, so it's possible that this issue only happens if multiple keys are valid for signing at the same time.

@negoe
Copy link
Contributor

negoe commented Oct 23, 2023

Thanks for the details. We will get back to you post validation from our side. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Inevstigation Engineering team as looked into the issue and needs deeper investigation to provide a conclusion
Projects
Bug Triage
  
In Progress
Development

No branches or pull requests

2 participants