Given: UIWebView-based browser application for iOS When: Regression testing run Then: Found blocker issue: google accounts authentication (mail, drive etc.) is not persisted between app launches on iOS 9 Problem statement
• UIWebView stores cookies in .binarycookies format on disk • Somehow it’s started to fail to read written cookies • [[NSHTTPCookieStorage sharedCookieStorage] allCookies] is nil Investigation
• Encryption library hooks UNIX file-system functions. • 200-line function with comparisons to string literals, magic numbers, system imports constants etc. • around 70-80 hooked unix implementations • And todo 17 Jan 2003 Deep investigation
• System calls atomic write to cookies file • File is written to temp • File is moved to original • Appropriate encryption applied • Hooked move is called on iOS 8 and not on iOS 9 Result
It didn’t work for this case neither. But trying it first i could save a time. And for sure I could find it myself. The library works exactly as the needed hook code
Ages of debugging on device, a week spent on implementing this for ARM architecture, offset calculations, reading Mach-O spec and i got the stubs working on iOS 9 I’ve written the solution
I was inspired by my awkward solution. I’ve reversed a big bunch of a format. I forgot about initial issue with login, cookies, etc... Once upon a time...