openid / openid/AppAuth-iOS

Crash in OID Request

Open
#215 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Objective-C
Stars
2k
Forks
867
Avg merge
4d 48m
Merged PRs (30d)
1

Description

We're using AppAuth (0.9.1) through CocoaPods. We are using it indirectly through GTMAppAuth.

We've been having the following crash in our app for a while. It looks like the OIDTokenRequest clientID is nil. By following the trace, it looks like it's coming from clientID:_lastAuthorizationResponse.request.clientID in OIDAuthState.m.

Fatal Exception: NSInvalidArgumentException
0  CoreFoundation                 0x18162b164 __exceptionPreprocess
1  libobjc.A.dylib                0x180874528 objc_exception_throw
2  CoreFoundation                 0x1815c3c9c _CFArgv
3  CoreFoundation                 0x1814f6eec -[__NSArrayM insertObject:atIndex:]
4  HelloWorld                     0x102852760 -[OIDURLQueryComponent addParameter:value:] (OIDURLQueryComponent.m:99)
5  HelloWorld                     0x102851060 -[OIDTokenRequest URLRequest] (OIDTokenRequest.m:284)
6  HelloWorld                     0x102847dc8 +[OIDAuthorizationService performTokenRequest:callback:] (OIDAuthorizationService.m:263)
7  HelloWorld                     0x10284afcc -[OIDAuthState performActionWithFreshTokens:additionalRefreshParameters:] (OIDAuthState.m:500)
8  HelloWorld                     0x1029fe75c -[GTMAppAuthFetcherAuthorization authorizeRequestArgs:] (GTMAppAuthFetcherAuthorization.m:329)
9  HelloWorld                     0x1029fe688 -[GTMAppAuthFetcherAuthorization authorizeRequest:delegate:didFinishSelector:] (GTMAppAuthFetcherAuthorization.m:306)
10 HelloWorld                     0x102a0c778 -[GTMSessionFetcher authorizeRequest] (GTMSessionFetcher.m:1577)
11 HelloWorld                     0x102a08a1c -[GTMSessionFetcher beginFetchMayDelay:mayAuthorize:] (GTMSessionFetcher.m:733)
12 HelloWorld                     0x102a308b4 -[GTLRService fetchObjectWithURL:objectClass:bodyObject:dataToPost:ETag:httpMethod:mayAuthorize:completionHandler:executingQuery:ticket:] (GTLRService.m:836)
13 HelloWorld                     0x102a320c4 -[GTLRService fetchObjectWithURL:objectClass:bodyObject:ETag:httpMethod:mayAuthorize:completionHandler:executingQuery:ticket:] (GTLRService.m:1096)
14 HelloWorld                     0x102a3641c -[GTLRService executeQuery:completionHandler:] (GTLRService.m:2213)
15 HelloWorld                     0x102c634bc -[GoogleDocsEngine loadContent:] (GoogleDocsEngine.m:296)
16 HelloWorld                     0x102c766b0 -[TGLExportDirectoryPickerViewController viewDidAppear:] (TGLExportDirectoryPickerViewController.m:73)
17 UIKit                          0x18abfe588 -[UIViewController _setViewAppearState:isAnimating:]
18 UIKit                          0x18abfeaf4 -[UIViewController _endAppearanceTransition:]
19 UIKit                          0x18aca3dbc -[UINavigationController navigationTransitionView:didEndTransition:fromView:toView:]
20 UIKit                          0x18ad6a81c __49-[UINavigationController _startCustomTransition:]_block_invoke
21 UIKit                          0x18acf687c -[_UIViewControllerTransitionContext completeTransition:]
22 UIKit                          0x18ae3ac04 __53-[_UINavigationParallaxTransition animateTransition:]_block_invoke.124
23 UIKit                          0x18ac1e188 -[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:]
24 UIKit                          0x18ac1dafc -[UIViewAnimationState sendDelegateAnimationDidStop:finished:]
25 UIKit                          0x18ac1d808 -[UIViewAnimationState animationDidStop:finished:]
26 UIKit                          0x18ac1d8a8 -[UIViewAnimationState animationDidStop:finished:]
27 QuartzCore                     0x18567edc4 CA::Layer::run_animation_callbacks(void*)
28 libdispatch.dylib              0x180faaa14 _dispatch_client_callout
29 libdispatch.dylib              0x180fb7698 _dispatch_main_queue_callback_4CF$VARIANT$mp
30 CoreFoundation                 0x1815d3344 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
31 CoreFoundation                 0x1815d0f20 __CFRunLoopRun
32 CoreFoundation                 0x1814f0c58 CFRunLoopRunSpecific
33 GraphicsServices               0x18339cf84 GSEventRunModal
34 UIKit                          0x18ac495c4 UIApplicationMain
35 HelloWorld                     0x1024aff2c main (main.m:10)
36 libdyld.dylib                  0x18101056c start

Thanks!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with OIDAuthState.m at performActionWithFreshTokens:additionalRefreshParameters:, then inspect OIDTokenRequest.m and OIDURLQueryComponent.m at the stack-trace locations. Reproduce the refresh-token path through GTMAppAuth and determine why the clientID reaches the token request as nil. Done means the crash cause is identified and the affected path has regression coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, objective-c
Domain
authentication, mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.