Repository navigation
Guard XML-RPC remote construction on missing credentials - #26159
Closed
feather2222 wants to merge 1 commit into
Closed
feather2222 wants to merge 1 commit into
feather2222 wants to merge 1 commit into
Conversation
A wpcom blog whose auth token is unreadable falls through to the XML-RPC remote with no username/password, hitting the NSParameterAssert in ServiceRemoteWordPressXMLRPC and crashing debug builds at launch. Return nil instead; callers already tolerate a nil remote. Fixes wordpress-mobile#26158
Contributor
|
Thanks for the PR. The issue has been fixed in #26132. I'm going to close this one. But feel free to let me know if you think otherwise. |
Contributor
Author
|
No worries at all — #26132 is a much more thorough fix. Glad the report was useful! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #26158
What
Guard the XML-RPC remote construction in
-[BlogService remoteForBlog:]so it is only created when the blog actually has XML-RPC credentials:Why
When a wpcom blog's auth token is unreadable from the keychain (observed as repeated
Error while retrieving WordPressComOAuthKeychainServiceName tokenlog entries),blog.wordPressComRestApiisnilandremoteForBlog:falls through to the XML-RPC path. A wpcom blog has nousername/password, so-[ServiceRemoteWordPressXMLRPC initWithApi:username:password:]hitsNSParameterAssert(password != nil)and crashes every debug launch until the app data is wiped. Release builds survive because the assert is compiled out, but the resulting remote is useless anyway.Returning
nildegrades the broken blog to "doesn't sync" instead of crashing; all callers tolerate anilremote via Objective-C nil messaging.Testing
BlogDetailsViewController.preloadMetadata()→syncBlogAndAllMetadata:completionHandler:→remoteForBlog:.