Skip to content
This repository has been archived by the owner on Jan 24, 2020. It is now read-only.

Crash when loading session cookie #120

Open
lukecyca opened this issue Nov 6, 2018 · 4 comments · May be fixed by #121
Open

Crash when loading session cookie #120

lukecyca opened this issue Nov 6, 2018 · 4 comments · May be fixed by #121

Comments

@lukecyca
Copy link

lukecyca commented Nov 6, 2018

Platform: iOS

Version: master (f113747)

Steps to reproduce:

  1. Use fetch() to hit an endpoint that sets a cookie with no expiry (ie: a session cookie). For example set-cookie: foo=bar; Path=/; HttpOnly
  2. Call CookieManager.get("https://example.com");

The result is the following stacktrace:

Exception '*** -[__NSDictionaryM setObject:forKey:]: object cannot be nil (key: expiresDate)' was thrown while invoking get on target RNCookieManagerIOS with params (
    "https://app.example.com",
    0,
    24,
    25
)
callstack: (
	0   CoreFoundation                      0x00000001123e929b __exceptionPreprocess + 331
	1   libobjc.A.dylib                     0x0000000110641735 objc_exception_throw + 48
	2   CoreFoundation                      0x00000001123338fc _CFThrowFormattedException + 194
	3   CoreFoundation                      0x000000011245b3f6 -[__NSDictionaryM setObject:forKey:] + 1046
	4   CM_App                              0x000000010f9c8380 -[RNCookieManagerIOS get:useWebKit:resolver:rejecter:] + 1584
	5   CoreFoundation                      0x00000001123f011c __invoking___ + 140
	6   CoreFoundation                      0x00000001123ed5b5 -[NSInvocation invoke] + 325
	7   CoreFoundation                      0x00000001123eda06 -[NSInvocation invokeWithTarget:] + 54
	8   CM_App                              0x000000010f78a25a -[RCTModuleMethod invokeWithBridge:module:arguments:] + 2810
	9   CM_App                              0x000000010f845f96 _ZN8facebook5reactL11invokeInnerEP9RCTBridgeP13RCTModuleDatajRKN5folly7dynamicE + 790
	10  CM_App                              0x000000010f845aaf _ZZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEiENK3$_0clEv + 127
	11  CM_App                              0x000000010f845a29 ___ZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEi_block_invoke + 25
	12  libdispatch.dylib                   0x000000011526e51d _dispatch_call_block_and_release + 12
	13  libdispatch.dylib                   0x000000011526f587 _dispatch_client_callout + 8
	14  libdispatch.dylib                   0x0000000115276058 _dispatch_lane_serial_drain + 720
	15  libdispatch.dylib                   0x0000000115276b9b _dispatch_lane_invoke + 401
	16  libdispatch.dylib                   0x000000011527f9c6 _dispatch_workloop_worker_thread + 645
	17  libsystem_pthread.dylib             0x000000011564ffd2 _pthread_wqthread + 980
	18  libsystem_pthread.dylib             0x000000011564fbe9 start_wqthread + 13
)
@lukecyca
Copy link
Author

lukecyca commented Nov 7, 2018

Looks like this was introduced in the latest commit. Paging @marcshilling.

@marcshilling
Copy link
Contributor

Surprising that the expiresDate would ever be nil, but we should be able to protect against by wrapping that line with a nil check. I'll make a PR.

@marcshilling marcshilling linked a pull request Nov 7, 2018 that will close this issue
@avinash03031991
Copy link

Even if i set expiration app crashes. do we have a solution for it.

@safaiyeh
Copy link

safaiyeh commented Jan 2, 2020

I have forked the repo here: https://github.com/safaiyeh/react-native-cookie-store
We can create issues and PRs there to continue the development of the project.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants