TrustKit icon indicating copy to clipboard operation
TrustKit copied to clipboard

Crash in TSKSPKIHashCache.m line 234

Open tadija opened this issue 4 years ago • 2 comments

Hi,

lately we noticed increased crash rate coming from TrustKit (in thousands, although I could never reproduce it locally).

At first I thought it's related to #248 or #249 so when 2.0.0 release came out I updated TrustKit dependency hoping that it brings a fix for this and closed the crash on Crashlytics.

Unfortunately, we keep getting the crash afterwards and apparently now it comes from this line: https://github.com/datatheorem/TrustKit/blob/c7c9271ec1ec3996b4a9a719972c0098c9886716/TrustKit/Pinning/TSKSPKIHashCache.m#L234

I suspect it might have something to do with "Data Protection" capability being enabled in our project (ie. disk locked at the moment of writing cache) but I'm not sure how (or where) to fix it. Any ideas?

tadija avatar Jul 20 '21 15:07 tadija

Using NSAssert here, when failing to write to the cache, feels a little excessive.

Is crashing really the best option here?

mflint avatar Jul 28 '21 09:07 mflint

I have a PR up to fix the build settings when using SwiftPM. SwiftPM doesn't set NS_BLOCK_ASSERTIONS by default.

echamberlain avatar Nov 23 '21 00:11 echamberlain

I just released the fix as part of v2.0.1 (https://github.com/datatheorem/TrustKit/releases/tag/2.0.1). Thanks for your patience!

nabla-c0d3 avatar Aug 15 '22 09:08 nabla-c0d3