Bug 184239 - Add infrastructure to relax SSL for allowed hosts in DumpRenderTree and WebKitTestRunner
Summary: Add infrastructure to relax SSL for allowed hosts in DumpRenderTree and WebKi...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Daniel Bates
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-04-02 10:21 PDT by Daniel Bates
Modified: 2018-04-02 16:13 PDT (History)
4 users (show)

See Also:


Attachments
Patch (16.90 KB, patch)
2018-04-02 10:23 PDT, Daniel Bates
ap: review+
ap: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Bates 2018-04-02 10:21:03 PDT
Add infrastructure to relax SSL for allowed hosts in DumpRenderTree and WebKitTestRunner.
Comment 1 Daniel Bates 2018-04-02 10:23:39 PDT
Created attachment 336995 [details]
Patch
Comment 2 EWS Watchlist 2018-04-02 10:25:28 PDT
Attachment 336995 [details] did not pass style-queue:


ERROR: Tools/WebKitTestRunner/TestController.cpp:1763:  More than one command on the same line  [whitespace/newline] [4]
Total errors found: 1 in 12 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Alexey Proskuryakov 2018-04-02 10:35:25 PDT
Comment on attachment 336995 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=336995&action=review

> Tools/DumpRenderTree/mac/DumpRenderTree.mm:1253
> +            [NSURLRequest setAllowsAnyHTTPSCertificate:YES forHost:[[NSString alloc] initWithUTF8String:host.c_str()]];

This leaks the string (as we don't seem to be using ARC in DRT).

> Tools/WebKitTestRunner/InjectedBundle/ios/InjectedBundleIOS.mm:57
> +        [NSURLRequest setAllowsAnyHTTPSCertificate:YES forHost:host];

What are the iOS versions where we still perform network loading from the WebContent process?

> Tools/WebKitTestRunner/InjectedBundle/mac/InjectedBundleMac.mm:99
> +    for (auto& host : m_allowedHosts)
> +        [NSURLRequest setAllowsAnyHTTPSCertificate:YES forHost:host];

What are the macOS versions where we still perform network loading from the WebContent process?

> Tools/WebKitTestRunner/TestController.cpp:1763
> +            return std::any_of(m_allowedHosts.begin(), m_allowedHosts.end(), [host] (const std::string& allowedHost) { return host == allowedHost; });

Wouldn't m_allowedHosts.find() work here?
Comment 4 Daniel Bates 2018-04-02 10:47:03 PDT
(In reply to Alexey Proskuryakov from comment #3)
> Comment on attachment 336995 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=336995&action=review
> 
> > Tools/DumpRenderTree/mac/DumpRenderTree.mm:1253
> > +            [NSURLRequest setAllowsAnyHTTPSCertificate:YES forHost:[[NSString alloc] initWithUTF8String:host.c_str()]];
> 
> This leaks the string (as we don't seem to be using ARC in DRT).
> 

Oops! Will use -autorelease.

> > Tools/WebKitTestRunner/InjectedBundle/ios/InjectedBundleIOS.mm:57
> > +        [NSURLRequest setAllowsAnyHTTPSCertificate:YES forHost:host];
> 
> What are the iOS versions where we still perform network loading from the
> WebContent process?
> 
> > Tools/WebKitTestRunner/InjectedBundle/mac/InjectedBundleMac.mm:99
> > +    for (auto& host : m_allowedHosts)
> > +        [NSURLRequest setAllowsAnyHTTPSCertificate:YES forHost:host];
> 
> What are the macOS versions where we still perform network loading from the
> WebContent process?
> 

I do not know. I hope you do not mind that I defer cleaning this up.

> > Tools/WebKitTestRunner/TestController.cpp:1763
> > +            return std::any_of(m_allowedHosts.begin(), m_allowedHosts.end(), [host] (const std::string& allowedHost) { return host == allowedHost; });
> 
> Wouldn't m_allowedHosts.find() work here?

Will change m_allowedHosts from a std::vector to a std::set and use std::set::find().
Comment 5 Daniel Bates 2018-04-02 10:47:42 PDT
(In reply to Alexey Proskuryakov from comment #3)
> > Tools/WebKitTestRunner/InjectedBundle/ios/InjectedBundleIOS.mm:57
> > +        [NSURLRequest setAllowsAnyHTTPSCertificate:YES forHost:host];
> 
> What are the iOS versions where we still perform network loading from the
> WebContent process?
> 

I don't know. I hope you do not mind that I defer cleaning this up.
Comment 6 Daniel Bates 2018-04-02 11:48:30 PDT
(In reply to Daniel Bates from comment #5)
> (In reply to Alexey Proskuryakov from comment #3)
> > > Tools/WebKitTestRunner/InjectedBundle/ios/InjectedBundleIOS.mm:57
> > > +        [NSURLRequest setAllowsAnyHTTPSCertificate:YES forHost:host];
> > 
> > What are the iOS versions where we still perform network loading from the
> > WebContent process?
> > 
> 
> I don't know. I hope you do not mind that I defer cleaning this up.

We no longer need this code. We remove this code in bug #184242.

(In reply to Daniel Bates from comment #4)
> > > Tools/WebKitTestRunner/InjectedBundle/mac/InjectedBundleMac.mm:99
> > > +    for (auto& host : m_allowedHosts)
> > > +        [NSURLRequest setAllowsAnyHTTPSCertificate:YES forHost:host];
> > 
> > What are the macOS versions where we still perform network loading from the
> > WebContent process?
> > 
> 
> I do not know. I hope you do not mind that I defer cleaning this up.

We no longer need this code. We remove this code in bug #184242.
Comment 7 Daniel Bates 2018-04-02 12:14:18 PDT
(In reply to Daniel Bates from comment #4)
> (In reply to Alexey Proskuryakov from comment #3)
> > Comment on attachment 336995 [details]
> > Patch
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=336995&action=review
> > 
> > > Tools/DumpRenderTree/mac/DumpRenderTree.mm:1253
> > > +            [NSURLRequest setAllowsAnyHTTPSCertificate:YES forHost:[[NSString alloc] initWithUTF8String:host.c_str()]];
> > 
> > This leaks the string (as we don't seem to be using ARC in DRT).
> > 
> 
> Oops! Will use -autorelease.
> 

Even better, will use the convenience API -stringWithUTF8String as it calls -autorelease and using it simplifies this code.
Comment 8 Daniel Bates 2018-04-02 16:12:22 PDT
Committed r230192: <https://trac.webkit.org/changeset/230192>
Comment 9 Radar WebKit Bug Importer 2018-04-02 16:13:35 PDT
<rdar://problem/39122881>