Bug 233202

Summary: Web Inspector: [Cocoa] Indicate a request was sent through proxy/private relay in Network tab
Product: WebKit Reporter: Cory Underwood <cory>
Component: Web InspectorAssignee: Patrick Angle <pangle>
Status: RESOLVED FIXED    
Severity: Normal CC: ews-watchlist, hi, inspector-bugzilla-changes, joepeck, keith_miller, mark.lam, msaboff, pangle, saam, tzagallo, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari 15   
Hardware: All   
OS: iOS 15   
Attachments:
Description Flags
Patch v1.0
none
Screenshot of Patch v1.0 (Network Overview /w IP Addresses shown)
none
Screenshot of Patch v1.0 (Network Details Headers)
none
Patch v1.1 - For EWS none

Description Cory Underwood 2021-11-16 10:49:16 PST
There does not appear to be a way for the local (user) client via Web Inspector Tools to determine that a outbound network request is being routed through the private relay network.  This seems to be the case when the 'Hide IP Address' option is set to any value.  It would be appreciated if the ability to determine when the feature was used on requests was enabled either via the Network Panel, or via the ITP Debug specific functionality like the CNAME Cloaking Mitigation reporting was enabled.
Comment 1 Radar WebKit Bug Importer 2021-11-16 11:48:07 PST
<rdar://problem/85468354>
Comment 2 Patrick Angle 2022-03-25 22:18:30 PDT
<rdar://81915515>
Comment 3 Patrick Angle 2022-03-25 23:18:24 PDT
Created attachment 455832 [details]
Patch v1.0
Comment 4 Patrick Angle 2022-03-25 23:19:11 PDT
Created attachment 455833 [details]
Screenshot of Patch v1.0 (Network Overview /w IP Addresses shown)
Comment 5 Patrick Angle 2022-03-25 23:19:58 PDT
Created attachment 455834 [details]
Screenshot of Patch v1.0 (Network Details Headers)
Comment 6 EWS Watchlist 2022-03-25 23:20:07 PDT
This patch modifies the inspector protocol. Please ensure that any frontend changes appropriately use feature checks for new protocol features.
Comment 7 Patrick Angle 2022-03-28 08:31:42 PDT
Comment on attachment 455832 [details]
Patch v1.0

GTK failures look real, and I suspect there may be Windows failures hiding behind the typical compilation issue.
Comment 8 Devin Rousso 2022-03-28 09:50:09 PDT
Comment on attachment 455832 [details]
Patch v1.0

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

r=me, neat!

> Source/WebCore/platform/network/NetworkLoadMetrics.h:137
> +    bool isProxyConnection;

Is this perhaps already covered by `PrivacyStance::Proxied`?

> Source/WebInspectorUI/UserInterface/Models/Resource.js:388
> +        return this._isProxyConnection ? WI.UIString("%s (Proxy)", "%s (Proxy) @ Resource Remote Address", "Label for the IP address of a proxy server used to retrieve a network resource.").format(this._remoteAddress) : this._remoteAddress;

Style: I'd split this onto separate lines.
```
if (this._isProxyConnection)
    return WI.UIString("%s (Proxy)", "%s (Proxy) @ Resource Remote Address", "Label for the IP address of a proxy server used to retrieve a network resource.").format(this._remoteAddress);

return this._remoteAddress;
```

> Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm:906
> +            additionalMetrics->isProxyConnection = m.proxyConnection;

eww `m.`?  That could've used a better name :(
Comment 9 Patrick Angle 2022-03-28 11:53:09 PDT
Comment on attachment 455832 [details]
Patch v1.0

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

>> Source/WebCore/platform/network/NetworkLoadMetrics.h:137
>> +    bool isProxyConnection;
> 
> Is this perhaps already covered by `PrivacyStance::Proxied`?

`PrivacyStance::Proxied` only applies to "private proxies", not all proxies.
Comment 10 Patrick Angle 2022-03-28 13:00:08 PDT
Created attachment 455945 [details]
Patch v1.1 - For EWS
Comment 11 EWS 2022-03-29 10:27:38 PDT
Committed r292037 (248980@main): <https://commits.webkit.org/248980@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 455945 [details].