Commit 1274181
Fix application password site_not_found by adding fallback URL matching (#22724)
* Log available site URLs in application password site_not_found error
Include the actual stored site URLs in the diagnostic log and Sentry
report to help identify the URL mismatch causing login failures.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Add fallback URL matching for application password site lookup
When the exact normalized URL match fails, retry by stripping the
scheme (http/https) and www prefix. This handles cases where the
stored site URL and the callback URL differ only in scheme or www.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Cache siteStore.sites to avoid redundant access in site lookup
Read siteStore.sites once and pass the list to findSiteByUrl and
logAndReportSiteNotFound, avoiding multiple accesses that may
create new list instances each time.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Add tests for fallback URL matching in application password login
Cover scheme mismatch (http vs https), www mismatch, combined
scheme+www mismatch, and verify exact match takes priority over
fallback. Also fix existing test assertion for sites access count.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Mask site URLs in Sentry reports for application password errors
Replace the last 3 characters before the TLD with XXX in URLs sent
to Sentry to avoid exposing full site URLs. AppLog retains the full
URLs for local debugging.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Harden maskUrl and findSiteByUrl in ApplicationPasswordLoginHelper
- Extract host before masking in maskUrl to avoid incorrect masking
when the URL contains dots in the path
- Add null/empty guard to findSiteByUrl to prevent false matches
when normalizedUrl is null
- Add unit tests for maskUrl covering: no dot, standard domain, port,
dot in path, and short host cases
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Refactor findSiteByUrl to fix detekt ReturnCount violation
Use elvis operator chaining instead of early return to reduce
return statements from 3 to 2.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Address review feedback for maskUrl and findSiteByUrl
- Use replaceFirst instead of replace in maskUrl to avoid masking
duplicate host occurrences in the URL path
- Import java.net.URI instead of using fully-qualified reference
- Add test for empty URL not matching site with empty URL
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Mask site URLs in analytics tracking to prevent PII leakage
The trackStoringFailed and trackSuccessful methods were sending
raw site URLs to the analytics service. Apply the same maskUrl
treatment used for Sentry reports.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Update maskUrl to show only first and last character of domain
Replace the fixed-length masking with a scheme that preserves only
the first and last characters of the domain name, masking everything
in between with 'x' for stronger PII protection.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Improve maskUrl to handle all domain lengths and clean up
- Mask 1-2 char domains entirely with 'x'
- Preserve first/last char for 3+ char domains
- Fix import ordering for java.net.URI
- Rename test to reflect current masking behavior
- Add tests for 1-char, 2-char, and 3-char domains
- Remove unused MIN_MASK_LENGTH constant
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Add @Suppress for ReturnCount in maskUrl
Multiple early returns improve readability for parse failure and
edge case handling in the masking logic.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 5c15e26 commit 1274181
File tree
2 files changed
+197
-10
lines changed- WordPress/src
- main/java/org/wordpress/android/ui/accounts/login
- test/java/org/wordpress/android/ui/accounts/login
2 files changed
+197
-10
lines changedLines changed: 60 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| 26 | + | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
| |||
104 | 106 | | |
105 | 107 | | |
106 | 108 | | |
107 | | - | |
| 109 | + | |
| 110 | + | |
108 | 111 | | |
109 | 112 | | |
110 | 113 | | |
| |||
121 | 124 | | |
122 | 125 | | |
123 | 126 | | |
124 | | - | |
| 127 | + | |
125 | 128 | | |
126 | 129 | | |
127 | 130 | | |
| |||
130 | 133 | | |
131 | 134 | | |
132 | 135 | | |
133 | | - | |
| 136 | + | |
134 | 137 | | |
135 | 138 | | |
136 | 139 | | |
| |||
168 | 171 | | |
169 | 172 | | |
170 | 173 | | |
171 | | - | |
| 174 | + | |
| 175 | + | |
172 | 176 | | |
173 | | - | |
174 | | - | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
175 | 180 | | |
176 | 181 | | |
177 | 182 | | |
178 | | - | |
| 183 | + | |
179 | 184 | | |
180 | 185 | | |
181 | | - | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
182 | 191 | | |
183 | 192 | | |
184 | 193 | | |
185 | 194 | | |
186 | | - | |
| 195 | + | |
187 | 196 | | |
188 | 197 | | |
189 | 198 | | |
| |||
232 | 241 | | |
233 | 242 | | |
234 | 243 | | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
235 | 286 | | |
236 | 287 | | |
237 | 288 | | |
| |||
Lines changed: 137 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
162 | | - | |
| 162 | + | |
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
167 | 260 | | |
168 | 261 | | |
169 | 262 | | |
| |||
407 | 500 | | |
408 | 501 | | |
409 | 502 | | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
410 | 546 | | |
411 | 547 | | |
412 | 548 | | |
| |||
0 commit comments