Commit f279e85
authored
Updating handling of ssl error received in Android WebView's onReceivedSslError callback, Fixes AB#3268908 (#2691)
Update:
After talking to @iulico-1 from OneAuth.
1. First rolling out with Broker and keeping disabled for OneAuth (and
MSAL Android). Added SSL error telemetry
2. Enable for oneauth after we see no issues in Broker. So, the toggle
code to let OneAuth enable/disable is removed from the PR.
3. Investigate how we can pass the error to OneAuth to track SSL failure
and User canceled the flow because of SSL error.
=====================
Fixes
[AB#3268908](https://identitydivision.visualstudio.com/fac9d424-53d2-45c0-91b5-ef6ba7a6bf26/_workitems/edit/3268908)
**Summary:**
This PR updates the handling of SSL errors in the Android WebView used
for authentication. The change is in response to an incident where the
MSA sign-up flow failed due to an expired certificate on an MSA UX web
page. The expired certificate was associated with a resource loaded by
the page; however, the existing SSL error handling in Common’s WebView
would cancel the loading of that resource and subsequently terminate the
entire authentication flow. (See PBI for details.)
**Solution**
**Option 1**
We simply log and stop loading the resource that caused the error by
calling `SssHandler.cancel()` but not stop the flow by erroring out.
This is a simple change. The only thing is the main URL (the url loading
in the WebView) itself has SSL error then the flow would end up in
*blank page*. This is as bad as finishing the flow but does not inform
calling app of the error via exception.
But if sub-resource has the error, then the flow continues.
**Flighting**
**New SSL Error Handler**:
- ~~Adds a new intent key (`WEB_VIEW_NEW_SSL_ERROR_HANDLER_ENABLED`) in
`AuthenticationConstants.java` to control whether the new SSL error
handler logic is enabled. This can be used by OneAuth to opt-in or
opt-out. If the key is not passed, then Common's default logic based on
flighting will be used. If the key passed, that will be used (primarily
meant for OneAuth/MSALCPP).~~. The toggle would be added later if
required. This simplifies current logic to only rely on Common/broker's
flighting.
- Adds a new flight value is well defaulting to `false`. So, OneAuth and
MSAL would also use default flight value and continue using current
behavior. For Broker, we would enable new flow with default `true`
(AzureAD/ad-accounts-for-android#3141), which
can be controlled remotely to turn off if required.
**Option 2** (Not this PR, added for reference)
The objective of this update is to improve SSL error handling so that
the flow is only cancelled if an SSL error occurs on the main frame
resource (the primary page being loaded). If an SSL error affects a
sub-resource, only the loading of that specific resource is cancelled,
and the overall authentication flow continues. This approach helps
prevent unnecessary failures caused by SSL errors on secondary or
non-critical resources.
(#2688)
The con of the approach is client needs to track the active url that's
about and being loaded in WebView. The tracking adds cost of developing
and maintaining to solution without significant benefit over option 1.1 parent af4dbe5 commit f279e85
File tree
6 files changed
+143
-49
lines changed- common4j/src/main/com/microsoft/identity/common/java
- flighting
- opentelemetry
- common/src
- main/java/com/microsoft/identity/common/internal
- providers/oauth2
- ui/webview
- test/java/com/microsoft/identity/common/internal/ui/webview
6 files changed
+143
-49
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
Lines changed: 19 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
25 | 35 | | |
26 | 36 | | |
27 | 37 | | |
| |||
46 | 56 | | |
47 | 57 | | |
48 | 58 | | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | 59 | | |
56 | 60 | | |
| 61 | + | |
| 62 | + | |
57 | 63 | | |
| 64 | + | |
58 | 65 | | |
| 66 | + | |
59 | 67 | | |
| 68 | + | |
| 69 | + | |
60 | 70 | | |
61 | 71 | | |
62 | 72 | | |
63 | 73 | | |
64 | | - | |
65 | 74 | | |
| 75 | + | |
66 | 76 | | |
67 | 77 | | |
68 | 78 | | |
69 | | - | |
70 | | - | |
71 | 79 | | |
72 | 80 | | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
| 81 | + | |
| 82 | + | |
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| |||
Lines changed: 33 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
| |||
41 | 43 | | |
42 | 44 | | |
43 | 45 | | |
44 | | - | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
50 | 56 | | |
| 57 | + | |
51 | 58 | | |
52 | 59 | | |
53 | | - | |
54 | | - | |
55 | 60 | | |
| 61 | + | |
| 62 | + | |
56 | 63 | | |
57 | 64 | | |
58 | 65 | | |
59 | 66 | | |
60 | 67 | | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
61 | 73 | | |
62 | 74 | | |
63 | 75 | | |
| |||
89 | 101 | | |
90 | 102 | | |
91 | 103 | | |
92 | | - | |
93 | | - | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
94 | 107 | | |
95 | 108 | | |
96 | 109 | | |
97 | | - | |
| 110 | + | |
98 | 111 | | |
99 | 112 | | |
100 | 113 | | |
| |||
171 | 184 | | |
172 | 185 | | |
173 | 186 | | |
| 187 | + | |
174 | 188 | | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
185 | 202 | | |
186 | 203 | | |
187 | 204 | | |
| |||
Lines changed: 76 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
25 | 35 | | |
26 | 36 | | |
| 37 | + | |
| 38 | + | |
27 | 39 | | |
28 | 40 | | |
29 | 41 | | |
| |||
33 | 45 | | |
34 | 46 | | |
35 | 47 | | |
| 48 | + | |
36 | 49 | | |
37 | 50 | | |
38 | 51 | | |
| 52 | + | |
39 | 53 | | |
| 54 | + | |
40 | 55 | | |
41 | | - | |
42 | 56 | | |
43 | | - | |
44 | 57 | | |
45 | 58 | | |
46 | 59 | | |
| |||
52 | 65 | | |
53 | 66 | | |
54 | 67 | | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | 68 | | |
63 | 69 | | |
64 | 70 | | |
65 | 71 | | |
66 | | - | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
67 | 75 | | |
68 | 76 | | |
69 | 77 | | |
| |||
129 | 137 | | |
130 | 138 | | |
131 | 139 | | |
132 | | - | |
| 140 | + | |
| 141 | + | |
133 | 142 | | |
134 | 143 | | |
135 | 144 | | |
| |||
374 | 383 | | |
375 | 384 | | |
376 | 385 | | |
377 | | - | |
| 386 | + | |
| 387 | + | |
378 | 388 | | |
379 | 389 | | |
380 | 390 | | |
381 | 391 | | |
382 | 392 | | |
383 | 393 | | |
384 | 394 | | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
385 | 449 | | |
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
142 | | - | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
143 | 149 | | |
144 | 150 | | |
145 | 151 | | |
| |||
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
378 | 378 | | |
379 | 379 | | |
380 | 380 | | |
381 | | - | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
382 | 388 | | |
0 commit comments