Commit e536e1e
Fixes
[AB#3611725](https://identitydivision.visualstudio.com/fac9d424-53d2-45c0-91b5-ef6ba7a6bf26/_workitems/edit/3611725)
tracks the common-side fix for the MSAL customer issue
[#2414](AzureAD/microsoft-authentication-library-for-android#2414).
## Customer-reported issue
Resolves the root cause of
[microsoft-authentication-library-for-android#2414](AzureAD/microsoft-authentication-library-for-android#2414):
when Microsoft Edge is the user''s default browser, MSAL rejects it with
`Browser: com.microsoft.emmx signature hash not match` and falls back to
WebView. Customers using Edge as the default cannot complete sign-in via
custom tabs.
## Root cause
Microsoft Edge ships its production APK with **two** signing
certificates (APK Signature Scheme v3 lineage). Historically, host apps
targeting < API 28 only saw the first signer, so a one-hash safelist
entry was sufficient. Once host apps started targeting API 28+,
`PackageManager` started returning **all** signers, and
`AndroidBrowserSelector.matches()` rejected Edge because it required
strict `Set.equals` between the safelist and the browser''s actual
signatures. This is a semantic bug in the matcher, not a stale hash --
but the safelist is also one hash short.
## Changes
### 1. `AndroidBrowserSelector.matches()` -- relax signature comparison
Replace strict `Set.equals` with `Collections.disjoint()`. A browser is
trusted when **any** of its signers appears in the descriptor''s trusted
set. This is:
- the standard semantic for signature trust (matches AppAuth''s
`BrowserSelector` behavior),
- safe -- `PackageInfo.signatures` is what Android verified at install
time and cannot be forged,
- forward-compatible with future Edge / Chrome / other multi-signer or
post-rotation browsers.
### 2. `BrowserDescriptor.getBrowserDescriptorForEdge()` -- add rotated
hash
Add the second Edge signing certificate hash to the switch-browser
safelist so the hard-coded Edge descriptor matches both legacy and
post-rotation Edge installs even before the matcher change propagates
downstream.
### 3. Regression tests
- `testSelect_Browser_multiSignerBrowserMatchesWithSubsetSafelist` --
multi-signer browser + single-hash safelist must match (the bug).
- `testSelect_Browser_signatureMismatchIsRejected` -- no overlap between
presented signatures and safelist must still reject (guards the security
boundary).
- New `BrowserDescriptorTest` in common4j pins both Edge hashes and the
Chrome entry as regression guards.
## Companion PR
A companion PR updates `msal_default_config.json` and
`auth_config.template.json` in the MSAL repo:
AzureAD/microsoft-authentication-library-for-android#2515 (work item
3611726).
## Test plan
- New unit tests pass (couldn''t run locally -- Maven feed requires VSTS
auth not available in this session; CI will validate).
- Existing `AndroidBrowserSelectorTest` cases unchanged in behavior
under the new matcher (verified by inspection -- all existing fixtures
use identical signature sets between descriptor and browser, so
`disjoint == false` corresponds exactly to `equals == true`).
## Risk
**Low.** The matcher change is a one-line semantic relaxation that only
changes behavior when a browser''s signature set is a proper
superset/overlap (not strict equality) with a safelisted descriptor --
exactly the scenario the customer hit. Strict mismatches are still
rejected.
---------
Co-authored-by: shjameel <shjameel@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent c217af2 commit e536e1e
5 files changed
Lines changed: 167 additions & 1 deletion
File tree
- common4j/src
- main/com/microsoft/identity/common/java/ui
- test/com/microsoft/identity/common/java/ui
- common/src
- main/java/com/microsoft/identity/common/internal/ui/browser
- test/java/com/microsoft/identity/common/internal/ui/browser
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
common/src/main/java/com/microsoft/identity/common/internal/ui/browser/AndroidBrowserSelector.java
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
| |||
100 | 101 | | |
101 | 102 | | |
102 | 103 | | |
103 | | - | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
104 | 110 | | |
105 | 111 | | |
106 | 112 | | |
| |||
Lines changed: 64 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| 57 | + | |
57 | 58 | | |
58 | 59 | | |
59 | 60 | | |
| |||
97 | 98 | | |
98 | 99 | | |
99 | 100 | | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
100 | 115 | | |
101 | 116 | | |
102 | 117 | | |
| |||
248 | 263 | | |
249 | 264 | | |
250 | 265 | | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
251 | 315 | | |
252 | 316 | | |
253 | 317 | | |
| |||
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
81 | 87 | | |
82 | 88 | | |
83 | 89 | | |
| |||
Lines changed: 89 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
0 commit comments