Changeset 239698 in webkit


Ignore:
Timestamp:
Jan 7, 2019 2:18:59 PM (5 years ago)
Author:
Devin Rousso
Message:

Web Inspector: Network: show secure connection details per-request
https://bugs.webkit.org/show_bug.cgi?id=191539
<rdar://problem/45979891>

Reviewed by Joseph Pecoraro.

Source/JavaScriptCore:

  • inspector/protocol/Security.json:

Add Connection type.

  • inspector/protocol/Network.json:

Send Security.Connection information when request metrics become available.

Source/WebCore:

Test: http/tests/inspector/network/resource-security-connection.html

  • platform/network/NetworkLoadMetrics.h:

(WebCore::NetworkLoadMetrics:isolatedCopy):
(WebCore::NetworkLoadMetrics:clearNonTimingData):
(WebCore::NetworkLoadMetrics:operator==):
(WebCore::NetworkLoadMetrics:encode):
(WebCore::NetworkLoadMetrics:decode):

  • inspector/agents/InspectorNetworkAgent.cpp:

(WebCore::InspectorNetworkAgent::buildObjectForMetrics):

Source/WebCore/PAL:

  • pal/spi/cf/CFNetworkSPI.h:

Source/WebInspectorUI:

  • UserInterface/Models/Resource.js:

(WI.Resource):
(WI.Resource.prototype.get security): Added.
(WI.Resource.prototype.updateForResponse):
(WI.Resource.prototype.updateWithMetrics):
(WI.Resource.prototype.get responseSecurity): Deleted.

  • UserInterface/Views/ResourceSecurityContentView.js:

(WI.ResourceSecurityContentView):
(WI.ResourceSecurityContentView.prototype.initialLayout):
(WI.ResourceSecurityContentView.prototype.layout):
(WI.ResourceSecurityContentView.prototype._refreshConnectionSection): Added.
(WI.ResourceSecurityContentView.prototype._refreshCetificateSection):
(WI.ResourceSecurityContentView.prototype._handleResourceMetricsDidChange): Added.

  • UserInterface/Views/ResourceSecurityContentView.css:

(body[dir] .resource-security > section:matches(.connection, .certificate) > .details): Added.
(@media (prefers-dark-interface) body[dir] .resource-security > section:matches(.connection, .certificate) > .details): Added.
(body[dir] .resource-security > section.certificate > .details): Deleted.
(@media (prefers-dark-interface) body[dir] .resource-security > section.certificate > .details): Deleted.

  • Localizations/en.lproj/localizedStrings.js:

Source/WebKit:

  • NetworkProcess/cocoa/NetworkSessionCocoa.mm:

(stringForSSLProtocol): Added.
(stringForSSLCipher): Added.
(-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]):

LayoutTests:

  • http/tests/inspector/network/resource-security-connection-expected.txt: Added.
  • http/tests/inspector/network/resource-security-connection.html: Added.
  • http/tests/inspector/network/resource-security-certificate-expected.txt: Added.
  • http/tests/inspector/network/resource-security-certificate.html: Added.
  • http/tests/inspector/network/resource-response-security-expected.txt: Deleted.
  • http/tests/inspector/network/resource-response-security.html: Deleted.
  • platform/gtk/TestExpectations:
  • platform/mac/TestExpectations:
  • platform/wincairo/TestExpectations:
  • platform/wpe/TestExpectations:
Location:
trunk
Files:
2 added
20 edited
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r239695 r239698  
     12019-01-07  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: Network: show secure connection details per-request
     4        https://bugs.webkit.org/show_bug.cgi?id=191539
     5        <rdar://problem/45979891>
     6
     7        Reviewed by Joseph Pecoraro.
     8
     9        * http/tests/inspector/network/resource-security-connection-expected.txt: Added.
     10        * http/tests/inspector/network/resource-security-connection.html: Added.
     11
     12        * http/tests/inspector/network/resource-security-certificate-expected.txt: Added.
     13        * http/tests/inspector/network/resource-security-certificate.html: Added.
     14        * http/tests/inspector/network/resource-response-security-expected.txt: Deleted.
     15        * http/tests/inspector/network/resource-response-security.html: Deleted.
     16
     17        * platform/gtk/TestExpectations:
     18        * platform/mac/TestExpectations:
     19        * platform/wincairo/TestExpectations:
     20        * platform/wpe/TestExpectations:
     21
    1222019-01-07  Truitt Savell  <tsavell@apple.com>
    223
  • trunk/LayoutTests/http/tests/inspector/network/resource-security-certificate-expected.txt

    r239697 r239698  
    1 Tests that a resource has security information.
     1Tests for resource security certificate information.
    22
    33
    4 == Running test suite: Resource.Security
    5 -- Running test case: Resource.Security.Certificate
     4== Running test suite: Resource.Security.Certificate
     5-- Running test case: Resource.Security.Certificate.Basic
    66PASS: Resource should have been loaded securely.
    77PASS: Resource should have security information.
    88PASS: Security information should include certificate information.
    9 PASS: Certificate should have subject
     9PASS: Certificate should have subject.
    1010PASS: Certificate should have a validFrom date.
    1111PASS: Certificate should have a validUntil date.
  • trunk/LayoutTests/http/tests/inspector/network/resource-security-certificate.html

    r239697 r239698  
    55<script src="../resources/inspector-test.js"></script>
    66<script>
     7let requestCount = 0;
     8
    79function createSecureRequest() {
    810    let img = document.createElement("img");
    9     img.src = "https://localhost:8443/resources/square100.png";
     11    img.src = "https://localhost:8443/resources/square100.png?" + (++requestCount);
    1012    document.body.appendChild(img);
    1113}
     
    1315function test()
    1416{
    15     let suite = InspectorTest.createAsyncSuite("Resource.Security");
     17    let suite = InspectorTest.createAsyncSuite("Resource.Security.Certificate");
    1618
    1719    suite.addTestCase({
    18         name: "Resource.Security.Certificate",
     20        name: "Resource.Security.Certificate.Basic",
    1921        description: "Check if a resource has security certificate information.",
    2022        test(resolve, reject) {
     
    2426                InspectorTest.expectThat(resource.loadedSecurely, "Resource should have been loaded securely.");
    2527
    26                 let responseSecurity = resource.responseSecurity;
    27                 InspectorTest.expectNotNull(responseSecurity, "Resource should have security information.");
     28                let security = resource.security;
     29                InspectorTest.expectNotNull(security, "Resource should have security information.");
    2830
    29                 let certificate = responseSecurity.certificate;
     31                let certificate = security.certificate;
    3032                InspectorTest.expectNotNull(certificate, "Security information should include certificate information.");
    31                 InspectorTest.expectGreaterThan(certificate.subject.length, 0, "Certificate should have subject");
     33                InspectorTest.expectGreaterThan(certificate.subject.length, 0, "Certificate should have subject.");
    3234                InspectorTest.expectGreaterThan(certificate.validFrom, 0, "Certificate should have a validFrom date.");
    3335                InspectorTest.expectGreaterThan(certificate.validUntil, 0, "Certificate should have a validUntil date.");
     
    4547</head>
    4648<body onload="runTest()">
    47     <p>Tests that a resource has security information.</p>
     49    <p>Tests for resource security certificate information.</p>
    4850</body>
    4951</html>
  • trunk/LayoutTests/platform/gtk/TestExpectations

    r239693 r239698  
    19741974
    19751975webkit.org/b/186847 http/tests/inspector/network/resource-sizes-memory-cache.html [ Pass Failure ]
    1976 webkit.org/b/191497 http/tests/inspector/network/resource-response-security.html [ Skip ]
     1976webkit.org/b/192407 http/tests/inspector/network/resource-security-connection.html [ Skip ]
     1977webkit.org/b/191497 http/tests/inspector/network/resource-security-certificate.html [ Skip ]
    19771978webkit.org/b/191497 http/tests/inspector/network/getSerializedCertificate.html [ Skip ]
    19781979
  • trunk/LayoutTests/platform/mac/TestExpectations

    r239695 r239698  
    11111111webkit.org/b/156634 inspector/formatting/formatting-javascript.html [ Pass Timeout ]
    11121112webkit.org/b/158948 inspector/timeline [ Pass Timeout ]
     1113webkit.org/b/191539 http/tests/inspector/network/resource-security-connection.html [ Skip ]
    11131114
    11141115webkit.org/b/187622 [ Debug ] inspector/view/asynchronous-layout.html [ Pass Timeout ]
  • trunk/LayoutTests/platform/wincairo/TestExpectations

    r239424 r239698  
    10041004http/tests/xmlviewer [ Skip ]
    10051005
    1006 webkit.org/b/191498 http/tests/inspector/network/resource-response-security.html [ Skip ]
     1006webkit.org/b/192406 http/tests/inspector/network/resource-security-connection.html [ Skip ]
     1007webkit.org/b/191498 http/tests/inspector/network/resource-security-certificate.html [ Skip ]
    10071008webkit.org/b/191498 http/tests/inspector/network/getSerializedCertificate.html [ Skip ]
    10081009
  • trunk/LayoutTests/platform/wpe/TestExpectations

    r239673 r239698  
    541541Bug(WPE) fast/dom/HTMLAnchorElement [ Skip ]
    542542
    543 webkit.org/b/191497 http/tests/inspector/network/resource-response-security.html [ Skip ]
     543webkit.org/b/192407 http/tests/inspector/network/resource-security-connection.html [ Skip ]
     544webkit.org/b/191497 http/tests/inspector/network/resource-security-certificate.html [ Skip ]
    544545webkit.org/b/191497 http/tests/inspector/network/getSerializedCertificate.html [ Skip ]
    545546
  • trunk/Source/JavaScriptCore/ChangeLog

    r239626 r239698  
     12019-01-07  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: Network: show secure connection details per-request
     4        https://bugs.webkit.org/show_bug.cgi?id=191539
     5        <rdar://problem/45979891>
     6
     7        Reviewed by Joseph Pecoraro.
     8
     9        * inspector/protocol/Security.json:
     10        Add `Connection` type.
     11
     12        * inspector/protocol/Network.json:
     13        Send `Security.Connection` information when request metrics become available.
     14
    1152019-01-04  Tadeu Zagallo  <tzagallo@apple.com>
    216
  • trunk/Source/JavaScriptCore/inspector/protocol/Network.json

    r238350 r239698  
    9494                { "name": "responseHeaderBytesReceived", "type": "number", "optional": true, "description": "Total HTTP response header bytes received over the network." },
    9595                { "name": "responseBodyBytesReceived", "type": "number", "optional": true, "description": "Total HTTP response body bytes received over the network." },
    96                 { "name": "responseBodyDecodedSize", "type": "number", "optional": true, "description": "Total decoded response body size in bytes." }
     96                { "name": "responseBodyDecodedSize", "type": "number", "optional": true, "description": "Total decoded response body size in bytes." },
     97                { "name": "securityConnection", "$ref": "Security.Connection", "optional": true, "description": "Connection information for the completed request." }
    9798            ]
    9899        },
  • trunk/Source/JavaScriptCore/inspector/protocol/Security.json

    r238122 r239698  
    33    "description": "Security domain allows the frontend to query for information relating to the security of the page (e.g. HTTPS info, TLS info, user activity, etc.).",
    44    "types": [
     5        {
     6            "id": "Connection",
     7            "type": "object",
     8            "description": "Information about a SSL connection to display in the frontend.",
     9            "properties": [
     10                { "name": "protocol", "type": "string", "optional": true },
     11                { "name": "cipher", "type": "string", "optional": true }
     12            ]
     13        },
    514        {
    615            "id": "Certificate",
     
    2029            "description": "Security information for a given Network.Response.",
    2130            "properties": [
     31                { "name": "connection", "$ref": "Connection", "optional": true },
    2232                { "name": "certificate", "$ref": "Certificate", "optional": true }
    2333            ]
  • trunk/Source/WebCore/ChangeLog

    r239694 r239698  
     12019-01-07  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: Network: show secure connection details per-request
     4        https://bugs.webkit.org/show_bug.cgi?id=191539
     5        <rdar://problem/45979891>
     6
     7        Reviewed by Joseph Pecoraro.
     8
     9        Test: http/tests/inspector/network/resource-security-connection.html
     10
     11        * platform/network/NetworkLoadMetrics.h:
     12        (WebCore::NetworkLoadMetrics:isolatedCopy):
     13        (WebCore::NetworkLoadMetrics:clearNonTimingData):
     14        (WebCore::NetworkLoadMetrics:operator==):
     15        (WebCore::NetworkLoadMetrics:encode):
     16        (WebCore::NetworkLoadMetrics:decode):
     17
     18        * inspector/agents/InspectorNetworkAgent.cpp:
     19        (WebCore::InspectorNetworkAgent::buildObjectForMetrics):
     20
    1212019-01-07  Eric Carlson  <eric.carlson@apple.com>
    222
  • trunk/Source/WebCore/PAL/ChangeLog

    r239636 r239698  
     12019-01-07  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: Network: show secure connection details per-request
     4        https://bugs.webkit.org/show_bug.cgi?id=191539
     5        <rdar://problem/45979891>
     6
     7        Reviewed by Joseph Pecoraro.
     8
     9        * pal/spi/cf/CFNetworkSPI.h:
     10
    1112019-01-04  Jer Noble  <jer.noble@apple.com>
    212
  • trunk/Source/WebCore/PAL/pal/spi/cf/CFNetworkSPI.h

    r239322 r239698  
    210210@property (assign, readonly) int64_t _responseBodyBytesReceived;
    211211@property (assign, readonly) int64_t _responseBodyBytesDecoded;
     212@end
     213#endif
     214
     215#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101500) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 130000)
     216@interface NSURLSessionTaskTransactionMetrics ()
     217@property (assign) SSLProtocol _negotiatedTLSProtocol;
     218@property (assign) SSLCipherSuite _negotiatedTLSCipher;
    212219@end
    213220#endif
  • trunk/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp

    r239427 r239698  
    265265        metrics->setResponseBodyDecodedSize(networkLoadMetrics.responseBodyDecodedSize);
    266266
     267    auto connectionPayload = Inspector::Protocol::Security::Connection::create()
     268        .release();
     269
     270    if (!networkLoadMetrics.tlsProtocol.isEmpty())
     271        connectionPayload->setProtocol(networkLoadMetrics.tlsProtocol);
     272
     273    if (!networkLoadMetrics.tlsCipher.isEmpty())
     274        connectionPayload->setCipher(networkLoadMetrics.tlsCipher);
     275
     276    metrics->setSecurityConnection(WTFMove(connectionPayload));
     277
    267278    return metrics;
    268279}
  • trunk/Source/WebCore/platform/network/NetworkLoadMetrics.h

    r239427 r239698  
    7272        copy.connectionIdentifier = connectionIdentifier.isolatedCopy();
    7373        copy.priority = priority;
     74        copy.tlsProtocol = tlsProtocol.isolatedCopy();
     75        copy.tlsCipher = tlsCipher.isolatedCopy();
    7476        copy.requestHeaders = requestHeaders.isolatedCopy();
    7577
     
    103105        connectionIdentifier = String();
    104106        priority = NetworkLoadPriority::Unknown;
     107        tlsProtocol = String();
     108        tlsCipher = String();
    105109        requestHeaders.clear();
    106110        requestHeaderBytesSent = std::numeric_limits<uint32_t>::max();
     
    126130            && connectionIdentifier == other.connectionIdentifier
    127131            && priority == other.priority
     132            && tlsProtocol == other.tlsProtocol
     133            && tlsCipher == other.tlsCipher
    128134            && requestHeaders == other.requestHeaders
    129135            && requestHeaderBytesSent == other.requestHeaderBytesSent
     
    162168    String connectionIdentifier;
    163169    NetworkLoadPriority priority;
     170
     171    String tlsProtocol;
     172    String tlsCipher;
    164173
    165174    // Whether or not all of the properties (0 or otherwise) have been set.
     
    199208    encoder << connectionIdentifier;
    200209    encoder << priority;
     210    encoder << tlsProtocol;
     211    encoder << tlsCipher;
    201212    encoder << requestHeaders;
    202213    encoder << requestHeaderBytesSent;
     
    223234        && decoder.decode(metrics.connectionIdentifier)
    224235        && decoder.decode(metrics.priority)
     236        && decoder.decode(metrics.tlsProtocol)
     237        && decoder.decode(metrics.tlsCipher)
    225238        && decoder.decode(metrics.requestHeaders)
    226239        && decoder.decode(metrics.requestHeaderBytesSent)
  • trunk/Source/WebInspectorUI/ChangeLog

    r239690 r239698  
     12019-01-07  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: Network: show secure connection details per-request
     4        https://bugs.webkit.org/show_bug.cgi?id=191539
     5        <rdar://problem/45979891>
     6
     7        Reviewed by Joseph Pecoraro.
     8
     9        * UserInterface/Models/Resource.js:
     10        (WI.Resource):
     11        (WI.Resource.prototype.get security): Added.
     12        (WI.Resource.prototype.updateForResponse):
     13        (WI.Resource.prototype.updateWithMetrics):
     14        (WI.Resource.prototype.get responseSecurity): Deleted.
     15
     16        * UserInterface/Views/ResourceSecurityContentView.js:
     17        (WI.ResourceSecurityContentView):
     18        (WI.ResourceSecurityContentView.prototype.initialLayout):
     19        (WI.ResourceSecurityContentView.prototype.layout):
     20        (WI.ResourceSecurityContentView.prototype._refreshConnectionSection): Added.
     21        (WI.ResourceSecurityContentView.prototype._refreshCetificateSection):
     22        (WI.ResourceSecurityContentView.prototype._handleResourceMetricsDidChange): Added.
     23        * UserInterface/Views/ResourceSecurityContentView.css:
     24        (body[dir] .resource-security > section:matches(.connection, .certificate) > .details): Added.
     25        (@media (prefers-dark-interface) body[dir] .resource-security > section:matches(.connection, .certificate) > .details): Added.
     26        (body[dir] .resource-security > section.certificate > .details): Deleted.
     27        (@media (prefers-dark-interface) body[dir] .resource-security > section.certificate > .details): Deleted.
     28
     29        * Localizations/en.lproj/localizedStrings.js:
     30
    1312019-01-07  Nikita Vasilyev  <nvasilyev@apple.com>
    232
  • trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js

    r239646 r239698  
    189189localizedStrings["Child added to "] = "Child added to ";
    190190localizedStrings["Children"] = "Children";
     191localizedStrings["Cipher"] = "Cipher";
    191192localizedStrings["Classes"] = "Classes";
    192193localizedStrings["Clear Filters"] = "Clear Filters";
     
    622623localizedStrings["No Watch Expressions"] = "No Watch Expressions";
    623624localizedStrings["No audit selected"] = "No audit selected";
     625localizedStrings["No certificate security information."] = "No certificate security information.";
     626localizedStrings["No connection security information."] = "No connection security information.";
    624627localizedStrings["No matching ARIA role"] = "No matching ARIA role";
    625628localizedStrings["No preview available"] = "No preview available";
     
    630633localizedStrings["No response cookies."] = "No response cookies.";
    631634localizedStrings["No response headers"] = "No response headers";
    632 localizedStrings["No response security certificate."] = "No response security certificate.";
    633 localizedStrings["No response security information."] = "No response security information.";
    634635localizedStrings["Node"] = "Node";
    635636localizedStrings["Node Removed"] = "Node Removed";
  • trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js

    r238350 r239698  
    7171        this._receivedNetworkLoadMetrics = false;
    7272        this._responseSource = WI.Resource.ResponseSource.Unknown;
    73         this._responseSecurity = null;
     73        this._security = null;
    7474        this._timingData = new WI.ResourceTimingData(this);
    7575        this._protocol = null;
     
    308308    get statusText() { return this._statusText; }
    309309    get responseSource() { return this._responseSource; }
    310     get responseSecurity() { return this._responseSecurity; }
     310    get security() { return this._security; }
    311311    get timingData() { return this._timingData; }
    312312    get protocol() { return this._protocol; }
     
    716716            this._responseSource = WI.Resource.responseSourceFromPayload(source);
    717717
    718         if (security)
    719             this._responseSecurity = security;
     718        this._security = security || {};
    720719
    721720        const headerBaseSize = 12; // Length of "HTTP/1.1 ", " ", and "\r\n".
     
    792791            this.dispatchEventToListeners(WI.Resource.Event.SizeDidChange, {previousSize: this._estimatedSize});
    793792            this.dispatchEventToListeners(WI.Resource.Event.TransferSizeDidChange);
     793        }
     794
     795        if (metrics.securityConnection) {
     796            if (!this._security)
     797                this._security = {};
     798            this._security.connection = metrics.securityConnection;
    794799        }
    795800
  • trunk/Source/WebInspectorUI/UserInterface/Views/ResourceSecurityContentView.css

    r238350 r239698  
    2424 */
    2525
    26 body[dir] .resource-security > section.certificate > .details {
     26body[dir] .resource-security > section:matches(.connection, .certificate) > .details {
    2727    border-color: var(--network-dns-color);
    2828}
     
    5555
    5656@media (prefers-dark-interface) {
    57     body[dir] .resource-security > section.certificate > .details {
     57    body[dir] .resource-security > section:matches(.connection, .certificate) > .details {
    5858        border-color: var(--network-pseudo-header-color);
    5959    }
  • trunk/Source/WebInspectorUI/UserInterface/Views/ResourceSecurityContentView.js

    r238350 r239698  
    3535
    3636        this._insecureMessageElement = null;
     37        this._needsConnectionRefresh = true;
    3738        this._needsCertificateRefresh = true;
    3839
     
    5354        super.initialLayout();
    5455
     56        this._connectionSection = new WI.ResourceDetailsSection(WI.UIString("Connection"), "connection");
     57        this.element.appendChild(this._connectionSection.element);
     58
    5559        this._certificateSection = new WI.ResourceDetailsSection(WI.UIString("Certificate"), "certificate");
    5660        this.element.appendChild(this._certificateSection.element);
    5761
    5862        this._resource.addEventListener(WI.Resource.Event.ResponseReceived, this._handleResourceResponseReceived, this);
     63        this._resource.addEventListener(WI.Resource.Event.MetricsDidChange, this._handleResourceMetricsDidChange, this);
    5964    }
    6065
     
    7075        }
    7176
     77        if (this._needsConnectionRefresh) {
     78            this._needsConnectionRefresh = false;
     79            this._refreshConnectionSection();
     80        }
     81
    7282        if (this._needsCertificateRefresh) {
    7383            this._needsCertificateRefresh = false;
     
    167177    // Private
    168178
     179    _refreshConnectionSection()
     180    {
     181        let detailsElement = this._connectionSection.detailsElement;
     182        detailsElement.removeChildren();
     183
     184        let security = this._resource.security;
     185        if (isEmptyObject(security)) {
     186            this._connectionSection.markIncompleteSectionWithMessage(WI.UIString("No connection security information."));
     187            return;
     188        }
     189
     190        let connection = security.connection;
     191        if (isEmptyObject(connection) || Object.values(connection).every((value) => !value)) {
     192            this._connectionSection.markIncompleteSectionWithMessage(WI.UIString("No connection security information."));
     193            return;
     194        }
     195
     196        this._connectionSection.appendKeyValuePair(WI.UIString("Protocol"), connection.protocol || emDash);
     197        this._connectionSection.appendKeyValuePair(WI.UIString("Cipher"), connection.cipher || emDash);
     198    }
     199
    169200    _refreshCetificateSection()
    170201    {
     
    172203        detailsElement.removeChildren();
    173204
    174         let responseSecurity = this._resource.responseSecurity;
    175         if (!responseSecurity) {
    176             this._certificateSection.markIncompleteSectionWithMessage(WI.UIString("No response security information."));
    177             return;
    178         }
    179 
    180         let certificate = responseSecurity.certificate;
    181         if (!certificate) {
    182             this._certificateSection.markIncompleteSectionWithMessage(WI.UIString("No response security certificate."));
     205        let security = this._resource.security;
     206        if (isEmptyObject(security)) {
     207            this._certificateSection.markIncompleteSectionWithMessage(WI.UIString("No certificate security information."));
     208            return;
     209        }
     210
     211        let certificate = security.certificate;
     212        if (isEmptyObject(certificate) || Object.values(certificate).every((value) => !value)) {
     213            this._certificateSection.markIncompleteSectionWithMessage(WI.UIString("No certificate security information."));
    183214            return;
    184215        }
     
    208239        }
    209240
    210         this._certificateSection.appendKeyValuePair(WI.UIString("Subject"), certificate.subject);
     241        this._certificateSection.appendKeyValuePair(WI.UIString("Subject"), certificate.subject || emDash);
    211242
    212243        let appendFormattedDate = (key, timestamp) => {
     
    310341        this.needsLayout();
    311342    }
     343
     344    _handleResourceMetricsDidChange(event)
     345    {
     346        this._needsConnectionRefresh = true;
     347        this.needsLayout();
     348    }
    312349};
  • trunk/Source/WebKit/ChangeLog

    r239697 r239698  
     12019-01-07  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: Network: show secure connection details per-request
     4        https://bugs.webkit.org/show_bug.cgi?id=191539
     5        <rdar://problem/45979891>
     6
     7        Reviewed by Joseph Pecoraro.
     8
     9        * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
     10        (stringForSSLProtocol): Added.
     11        (stringForSSLCipher): Added.
     12        (-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]):
     13
    1142019-01-07  Joseph Pecoraro  <pecoraro@apple.com>
    215
  • trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm

    r239680 r239698  
    5353#import <wtf/ProcessPrivilege.h>
    5454#import <wtf/URL.h>
     55#import <wtf/text/WTFString.h>
    5556
    5657using namespace WebKit;
     
    9394    return WebCore::NetworkLoadPriority::Medium;
    9495}
     96
     97#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101500) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 130000)
     98static String stringForSSLProtocol(SSLProtocol protocol)
     99{
     100    switch (protocol) {
     101    case kDTLSProtocol1:
     102        return "DTLS 1.0"_s;
     103    case kSSLProtocol2:
     104        return "SSL 2.0"_s;
     105    case kSSLProtocol3:
     106        return "SSL 3.0"_s;
     107    case kSSLProtocol3Only:
     108        return "SSL 3.0 (Only)"_s;
     109    case kTLSProtocol1:
     110        return "TLS 1.0"_s;
     111    case kTLSProtocol1Only:
     112        return "TLS 1.0 (Only)"_s;
     113    case kTLSProtocol11:
     114        return "TLS 1.1"_s;
     115    case kTLSProtocol12:
     116        return "TLS 1.2"_s;
     117    case kTLSProtocol13:
     118        return "TLS 1.3"_s;
     119    case kSSLProtocolAll:
     120        return "All";
     121    case kSSLProtocolUnknown:
     122        return "Unknown";
     123    case kTLSProtocolMaxSupported:
     124    default:
     125        ASSERT_NOT_REACHED();
     126        return emptyString();
     127    }
     128}
     129
     130static String stringForSSLCipher(SSLCipherSuite cipher)
     131{
     132#define STRINGIFY_CIPHER(cipher) \
     133    case cipher: \
     134        return "" #cipher ""_s
     135
     136    switch (cipher) {
     137    STRINGIFY_CIPHER(SSL_RSA_EXPORT_WITH_RC4_40_MD5);
     138    STRINGIFY_CIPHER(SSL_RSA_EXPORT_WITH_RC2_CBC_40_MD5);
     139    STRINGIFY_CIPHER(SSL_RSA_WITH_IDEA_CBC_SHA);
     140    STRINGIFY_CIPHER(SSL_RSA_EXPORT_WITH_DES40_CBC_SHA);
     141    STRINGIFY_CIPHER(SSL_RSA_WITH_DES_CBC_SHA);
     142    STRINGIFY_CIPHER(SSL_DH_DSS_EXPORT_WITH_DES40_CBC_SHA);
     143    STRINGIFY_CIPHER(SSL_DH_DSS_WITH_DES_CBC_SHA);
     144    STRINGIFY_CIPHER(SSL_DH_RSA_EXPORT_WITH_DES40_CBC_SHA);
     145    STRINGIFY_CIPHER(SSL_DH_RSA_WITH_DES_CBC_SHA);
     146    STRINGIFY_CIPHER(SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA);
     147    STRINGIFY_CIPHER(SSL_DHE_DSS_WITH_DES_CBC_SHA);
     148    STRINGIFY_CIPHER(SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA);
     149    STRINGIFY_CIPHER(SSL_DHE_RSA_WITH_DES_CBC_SHA);
     150    STRINGIFY_CIPHER(SSL_DH_anon_EXPORT_WITH_RC4_40_MD5);
     151    STRINGIFY_CIPHER(SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA);
     152    STRINGIFY_CIPHER(SSL_DH_anon_WITH_DES_CBC_SHA);
     153    STRINGIFY_CIPHER(SSL_FORTEZZA_DMS_WITH_NULL_SHA);
     154    STRINGIFY_CIPHER(SSL_FORTEZZA_DMS_WITH_FORTEZZA_CBC_SHA);
     155    STRINGIFY_CIPHER(TLS_RSA_WITH_AES_128_CBC_SHA);
     156    STRINGIFY_CIPHER(TLS_DH_DSS_WITH_AES_128_CBC_SHA);
     157    STRINGIFY_CIPHER(TLS_DH_RSA_WITH_AES_128_CBC_SHA);
     158    STRINGIFY_CIPHER(TLS_DHE_DSS_WITH_AES_128_CBC_SHA);
     159    STRINGIFY_CIPHER(TLS_DHE_RSA_WITH_AES_128_CBC_SHA);
     160    STRINGIFY_CIPHER(TLS_DH_anon_WITH_AES_128_CBC_SHA);
     161    STRINGIFY_CIPHER(TLS_RSA_WITH_AES_256_CBC_SHA);
     162    STRINGIFY_CIPHER(TLS_DH_DSS_WITH_AES_256_CBC_SHA);
     163    STRINGIFY_CIPHER(TLS_DH_RSA_WITH_AES_256_CBC_SHA);
     164    STRINGIFY_CIPHER(TLS_DHE_DSS_WITH_AES_256_CBC_SHA);
     165    STRINGIFY_CIPHER(TLS_DHE_RSA_WITH_AES_256_CBC_SHA);
     166    STRINGIFY_CIPHER(TLS_DH_anon_WITH_AES_256_CBC_SHA);
     167    STRINGIFY_CIPHER(TLS_ECDH_ECDSA_WITH_NULL_SHA);
     168    STRINGIFY_CIPHER(TLS_ECDH_ECDSA_WITH_RC4_128_SHA);
     169    STRINGIFY_CIPHER(TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA);
     170    STRINGIFY_CIPHER(TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA);
     171    STRINGIFY_CIPHER(TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA);
     172    STRINGIFY_CIPHER(TLS_ECDHE_ECDSA_WITH_NULL_SHA);
     173    STRINGIFY_CIPHER(TLS_ECDHE_ECDSA_WITH_RC4_128_SHA);
     174    STRINGIFY_CIPHER(TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA);
     175    STRINGIFY_CIPHER(TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA);
     176    STRINGIFY_CIPHER(TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA);
     177    STRINGIFY_CIPHER(TLS_ECDH_RSA_WITH_NULL_SHA);
     178    STRINGIFY_CIPHER(TLS_ECDH_RSA_WITH_RC4_128_SHA);
     179    STRINGIFY_CIPHER(TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA);
     180    STRINGIFY_CIPHER(TLS_ECDH_RSA_WITH_AES_128_CBC_SHA);
     181    STRINGIFY_CIPHER(TLS_ECDH_RSA_WITH_AES_256_CBC_SHA);
     182    STRINGIFY_CIPHER(TLS_ECDHE_RSA_WITH_NULL_SHA);
     183    STRINGIFY_CIPHER(TLS_ECDHE_RSA_WITH_RC4_128_SHA);
     184    STRINGIFY_CIPHER(TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA);
     185    STRINGIFY_CIPHER(TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA);
     186    STRINGIFY_CIPHER(TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA);
     187    STRINGIFY_CIPHER(TLS_ECDH_anon_WITH_NULL_SHA);
     188    STRINGIFY_CIPHER(TLS_ECDH_anon_WITH_RC4_128_SHA);
     189    STRINGIFY_CIPHER(TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA);
     190    STRINGIFY_CIPHER(TLS_ECDH_anon_WITH_AES_128_CBC_SHA);
     191    STRINGIFY_CIPHER(TLS_ECDH_anon_WITH_AES_256_CBC_SHA);
     192    // STRINGIFY_CIPHER(SSL_NULL_WITH_NULL_NULL);
     193    STRINGIFY_CIPHER(TLS_NULL_WITH_NULL_NULL);
     194    // STRINGIFY_CIPHER(SSL_RSA_WITH_NULL_MD5);
     195    STRINGIFY_CIPHER(TLS_RSA_WITH_NULL_MD5);
     196    // STRINGIFY_CIPHER(SSL_RSA_WITH_NULL_SHA);
     197    STRINGIFY_CIPHER(TLS_RSA_WITH_NULL_SHA);
     198    // STRINGIFY_CIPHER(SSL_RSA_WITH_RC4_128_MD5);
     199    STRINGIFY_CIPHER(TLS_RSA_WITH_RC4_128_MD5);
     200    // STRINGIFY_CIPHER(SSL_RSA_WITH_RC4_128_SHA);
     201    STRINGIFY_CIPHER(TLS_RSA_WITH_RC4_128_SHA);
     202    // STRINGIFY_CIPHER(SSL_RSA_WITH_3DES_EDE_CBC_SHA);
     203    STRINGIFY_CIPHER(TLS_RSA_WITH_3DES_EDE_CBC_SHA);
     204    STRINGIFY_CIPHER(TLS_RSA_WITH_NULL_SHA256);
     205    STRINGIFY_CIPHER(TLS_RSA_WITH_AES_128_CBC_SHA256);
     206    STRINGIFY_CIPHER(TLS_RSA_WITH_AES_256_CBC_SHA256);
     207    // STRINGIFY_CIPHER(SSL_DH_DSS_WITH_3DES_EDE_CBC_SHA);
     208    STRINGIFY_CIPHER(TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA);
     209    // STRINGIFY_CIPHER(SSL_DH_RSA_WITH_3DES_EDE_CBC_SHA);
     210    STRINGIFY_CIPHER(TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA);
     211    // STRINGIFY_CIPHER(SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA);
     212    STRINGIFY_CIPHER(TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA);
     213    // STRINGIFY_CIPHER(SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA);
     214    STRINGIFY_CIPHER(TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA);
     215    STRINGIFY_CIPHER(TLS_DH_DSS_WITH_AES_128_CBC_SHA256);
     216    STRINGIFY_CIPHER(TLS_DH_RSA_WITH_AES_128_CBC_SHA256);
     217    STRINGIFY_CIPHER(TLS_DHE_DSS_WITH_AES_128_CBC_SHA256);
     218    STRINGIFY_CIPHER(TLS_DHE_RSA_WITH_AES_128_CBC_SHA256);
     219    STRINGIFY_CIPHER(TLS_DH_DSS_WITH_AES_256_CBC_SHA256);
     220    STRINGIFY_CIPHER(TLS_DH_RSA_WITH_AES_256_CBC_SHA256);
     221    STRINGIFY_CIPHER(TLS_DHE_DSS_WITH_AES_256_CBC_SHA256);
     222    STRINGIFY_CIPHER(TLS_DHE_RSA_WITH_AES_256_CBC_SHA256);
     223    // STRINGIFY_CIPHER(SSL_DH_anon_WITH_RC4_128_MD5);
     224    STRINGIFY_CIPHER(TLS_DH_anon_WITH_RC4_128_MD5);
     225    // STRINGIFY_CIPHER(SSL_DH_anon_WITH_3DES_EDE_CBC_SHA);
     226    STRINGIFY_CIPHER(TLS_DH_anon_WITH_3DES_EDE_CBC_SHA);
     227    STRINGIFY_CIPHER(TLS_DH_anon_WITH_AES_128_CBC_SHA256);
     228    STRINGIFY_CIPHER(TLS_DH_anon_WITH_AES_256_CBC_SHA256);
     229    STRINGIFY_CIPHER(TLS_PSK_WITH_RC4_128_SHA);
     230    STRINGIFY_CIPHER(TLS_PSK_WITH_3DES_EDE_CBC_SHA);
     231    STRINGIFY_CIPHER(TLS_PSK_WITH_AES_128_CBC_SHA);
     232    STRINGIFY_CIPHER(TLS_PSK_WITH_AES_256_CBC_SHA);
     233    STRINGIFY_CIPHER(TLS_DHE_PSK_WITH_RC4_128_SHA);
     234    STRINGIFY_CIPHER(TLS_DHE_PSK_WITH_3DES_EDE_CBC_SHA);
     235    STRINGIFY_CIPHER(TLS_DHE_PSK_WITH_AES_128_CBC_SHA);
     236    STRINGIFY_CIPHER(TLS_DHE_PSK_WITH_AES_256_CBC_SHA);
     237    STRINGIFY_CIPHER(TLS_RSA_PSK_WITH_RC4_128_SHA);
     238    STRINGIFY_CIPHER(TLS_RSA_PSK_WITH_3DES_EDE_CBC_SHA);
     239    STRINGIFY_CIPHER(TLS_RSA_PSK_WITH_AES_128_CBC_SHA);
     240    STRINGIFY_CIPHER(TLS_RSA_PSK_WITH_AES_256_CBC_SHA);
     241    STRINGIFY_CIPHER(TLS_PSK_WITH_NULL_SHA);
     242    STRINGIFY_CIPHER(TLS_DHE_PSK_WITH_NULL_SHA);
     243    STRINGIFY_CIPHER(TLS_RSA_PSK_WITH_NULL_SHA);
     244    STRINGIFY_CIPHER(TLS_RSA_WITH_AES_128_GCM_SHA256);
     245    STRINGIFY_CIPHER(TLS_RSA_WITH_AES_256_GCM_SHA384);
     246    STRINGIFY_CIPHER(TLS_DHE_RSA_WITH_AES_128_GCM_SHA256);
     247    STRINGIFY_CIPHER(TLS_DHE_RSA_WITH_AES_256_GCM_SHA384);
     248    STRINGIFY_CIPHER(TLS_DH_RSA_WITH_AES_128_GCM_SHA256);
     249    STRINGIFY_CIPHER(TLS_DH_RSA_WITH_AES_256_GCM_SHA384);
     250    STRINGIFY_CIPHER(TLS_DHE_DSS_WITH_AES_128_GCM_SHA256);
     251    STRINGIFY_CIPHER(TLS_DHE_DSS_WITH_AES_256_GCM_SHA384);
     252    STRINGIFY_CIPHER(TLS_DH_DSS_WITH_AES_128_GCM_SHA256);
     253    STRINGIFY_CIPHER(TLS_DH_DSS_WITH_AES_256_GCM_SHA384);
     254    STRINGIFY_CIPHER(TLS_DH_anon_WITH_AES_128_GCM_SHA256);
     255    STRINGIFY_CIPHER(TLS_DH_anon_WITH_AES_256_GCM_SHA384);
     256    STRINGIFY_CIPHER(TLS_PSK_WITH_AES_128_GCM_SHA256);
     257    STRINGIFY_CIPHER(TLS_PSK_WITH_AES_256_GCM_SHA384);
     258    STRINGIFY_CIPHER(TLS_DHE_PSK_WITH_AES_128_GCM_SHA256);
     259    STRINGIFY_CIPHER(TLS_DHE_PSK_WITH_AES_256_GCM_SHA384);
     260    STRINGIFY_CIPHER(TLS_RSA_PSK_WITH_AES_128_GCM_SHA256);
     261    STRINGIFY_CIPHER(TLS_RSA_PSK_WITH_AES_256_GCM_SHA384);
     262    STRINGIFY_CIPHER(TLS_PSK_WITH_AES_128_CBC_SHA256);
     263    STRINGIFY_CIPHER(TLS_PSK_WITH_AES_256_CBC_SHA384);
     264    STRINGIFY_CIPHER(TLS_PSK_WITH_NULL_SHA256);
     265    STRINGIFY_CIPHER(TLS_PSK_WITH_NULL_SHA384);
     266    STRINGIFY_CIPHER(TLS_DHE_PSK_WITH_AES_128_CBC_SHA256);
     267    STRINGIFY_CIPHER(TLS_DHE_PSK_WITH_AES_256_CBC_SHA384);
     268    STRINGIFY_CIPHER(TLS_DHE_PSK_WITH_NULL_SHA256);
     269    STRINGIFY_CIPHER(TLS_DHE_PSK_WITH_NULL_SHA384);
     270    STRINGIFY_CIPHER(TLS_RSA_PSK_WITH_AES_128_CBC_SHA256);
     271    STRINGIFY_CIPHER(TLS_RSA_PSK_WITH_AES_256_CBC_SHA384);
     272    STRINGIFY_CIPHER(TLS_RSA_PSK_WITH_NULL_SHA256);
     273    STRINGIFY_CIPHER(TLS_RSA_PSK_WITH_NULL_SHA384);
     274    STRINGIFY_CIPHER(TLS_AES_128_GCM_SHA256);
     275    STRINGIFY_CIPHER(TLS_AES_256_GCM_SHA384);
     276    STRINGIFY_CIPHER(TLS_CHACHA20_POLY1305_SHA256);
     277    STRINGIFY_CIPHER(TLS_AES_128_CCM_SHA256);
     278    STRINGIFY_CIPHER(TLS_AES_128_CCM_8_SHA256);
     279    STRINGIFY_CIPHER(TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256);
     280    STRINGIFY_CIPHER(TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384);
     281    STRINGIFY_CIPHER(TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256);
     282    STRINGIFY_CIPHER(TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384);
     283    STRINGIFY_CIPHER(TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256);
     284    STRINGIFY_CIPHER(TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384);
     285    STRINGIFY_CIPHER(TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256);
     286    STRINGIFY_CIPHER(TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384);
     287    STRINGIFY_CIPHER(TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256);
     288    STRINGIFY_CIPHER(TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384);
     289    STRINGIFY_CIPHER(TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256);
     290    STRINGIFY_CIPHER(TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384);
     291    STRINGIFY_CIPHER(TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256);
     292    STRINGIFY_CIPHER(TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384);
     293    STRINGIFY_CIPHER(TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256);
     294    STRINGIFY_CIPHER(TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384);
     295    STRINGIFY_CIPHER(TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256);
     296    STRINGIFY_CIPHER(TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256);
     297    STRINGIFY_CIPHER(TLS_EMPTY_RENEGOTIATION_INFO_SCSV);
     298    STRINGIFY_CIPHER(SSL_RSA_WITH_RC2_CBC_MD5);
     299    STRINGIFY_CIPHER(SSL_RSA_WITH_IDEA_CBC_MD5);
     300    STRINGIFY_CIPHER(SSL_RSA_WITH_DES_CBC_MD5);
     301    STRINGIFY_CIPHER(SSL_RSA_WITH_3DES_EDE_CBC_MD5);
     302    STRINGIFY_CIPHER(SSL_NO_SUCH_CIPHERSUITE);
     303    default:
     304        ASSERT_NOT_REACHED();
     305        return emptyString();
     306    }
     307
     308#undef STRINGIFY_CIPHER
     309}
     310#endif
    95311
    96312@interface WKNetworkSessionDelegate : NSObject <NSURLSessionDataDelegate> {
     
    446662#endif
    447663
     664#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101500) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 130000)
     665            networkLoadMetrics.tlsProtocol = stringForSSLProtocol(m._negotiatedTLSProtocol);
     666            networkLoadMetrics.tlsCipher = stringForSSLCipher(m._negotiatedTLSCipher);
     667#endif
     668
    448669            __block WebCore::HTTPHeaderMap requestHeaders;
    449670            [m.request.allHTTPHeaderFields enumerateKeysAndObjectsUsingBlock:^(NSString *name, NSString *value, BOOL *) {
Note: See TracChangeset for help on using the changeset viewer.