RESOLVED FIXED152153
Remote Inspector: Verify the identity of the other side of XPC connections
https://bugs.webkit.org/show_bug.cgi?id=152153
Summary Remote Inspector: Verify the identity of the other side of XPC connections
Joseph Pecoraro
Reported 2015-12-10 15:31:24 PST
* SUMMARY Verify the identity of the other side of XPC connections Verify the service launched for the mach service name is who we think it is. Bail if it isn't.
Attachments
[PATCH] Proposed Fix (19.85 KB, patch)
2015-12-10 15:44 PST, Joseph Pecoraro
bburg: review+
Radar WebKit Bug Importer
Comment 1 2015-12-10 15:31:57 PST
Joseph Pecoraro
Comment 2 2015-12-10 15:44:07 PST
Created attachment 267133 [details] [PATCH] Proposed Fix
WebKit Commit Bot
Comment 3 2015-12-10 15:46:23 PST
Attachment 267133 [details] did not pass style-queue: ERROR: Source/JavaScriptCore/inspector/remote/RemoteInspectorXPCConnection.mm:176: This { should be at the end of the previous line [whitespace/braces] [4] Total errors found: 1 in 12 files If any of these errors are false positives, please file a bug against check-webkit-style.
Blaze Burg
Comment 4 2015-12-10 16:22:51 PST
Comment on attachment 267133 [details] [PATCH] Proposed Fix View in context: https://bugs.webkit.org/attachment.cgi?id=267133&action=review r=me. Looks good, have one question though. > Source/JavaScriptCore/inspector/remote/RemoteInspectorXPCConnection.mm:172 > + if (!m_validated) { This access and the write below aren't guarded my m_mutex. Do they need to be? Maybe its declaration needs a comment to remind what data it protects.
Andy Estes
Comment 5 2015-12-10 16:23:56 PST
Comment on attachment 267133 [details] [PATCH] Proposed Fix View in context: https://bugs.webkit.org/attachment.cgi?id=267133&action=review > Source/JavaScriptCore/inspector/remote/RemoteInspectorXPCConnection.mm:63 > + auto value = adoptCF(SecTaskCopyValueForEntitlement(task.get(), (CFStringRef)entitlement, nullptr)); > + if (!value) > + return false; > + > + if (CFGetTypeID(value.get()) != CFBooleanGetTypeID()) > + return false; > + > + return CFBooleanGetValue(static_cast<CFBooleanRef>(value.get())); This could be made more concise by using dynamic_cf_cast: auto value = adoptCF(SecTaskCopyValueForEntitlement(task.get(), (CFStringRef)entitlement, nullptr)); if (auto booleanValue = dynamic_cf_cast<CFBooleanRef>(value.get())) return CFBooleanGetValue(booleanValue); return false; > Source/WebCore/platform/network/mac/CertificateInfoMac.mm:30 > -#import "SecuritySPI.h" > +#import <wtf/spi/cocoa/SecuritySPI.h> I find it strange that we are exposing WTF headers like this (as opposed to just <wtf/SecuritySPI.h>). It looks like we do this for other WTF SPI headers, too, so you don't have to change anything. I just wanted to voice my displeasure.
Joseph Pecoraro
Comment 6 2015-12-10 16:33:23 PST
(In reply to comment #4) > Comment on attachment 267133 [details] > [PATCH] Proposed Fix > > View in context: > https://bugs.webkit.org/attachment.cgi?id=267133&action=review > > r=me. Looks good, have one question though. > > > Source/JavaScriptCore/inspector/remote/RemoteInspectorXPCConnection.mm:172 > > + if (!m_validated) { > > This access and the write below aren't guarded my m_mutex. Do they need to > be? Maybe its declaration needs a comment to remind what data it protects. m_validated is only checked/set on the serial XPC queue. There is a comment regarding what m_mutex checks, which is use of m_client, especially during closing.
Joseph Pecoraro
Comment 7 2015-12-10 16:39:14 PST
(In reply to comment #5) > This could be made more concise by using dynamic_cf_cast: > > auto value = adoptCF(SecTaskCopyValueForEntitlement(task.get(), > (CFStringRef)entitlement, nullptr)); > if (auto booleanValue = dynamic_cf_cast<CFBooleanRef>(value.get())) > return CFBooleanGetValue(booleanValue); > return false; Very cool! I'm going to avoid it here purely because of style, but it is good to know about dynamic_cf_cast. We should probably be using it in RemoteInspector breaking open the message dictionaries.
Joseph Pecoraro
Comment 8 2015-12-10 17:38:06 PST
Note You need to log in before you can comment on or make changes to this bug.