[Private Network Access] Introduce preflight policies. [chromium/src : main]

87 views
Skip to first unread message

Titouan Rigoudy (Gerrit)

unread,
Sep 27, 2021, 8:42:28 AM9/27/21
to Takashi Toyoshima, alexmo...@chromium.org, asvitkine...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, creis...@chromium.org, devtools-re...@chromium.org, gavinp...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading...@chromium.org, lucmult...@chromium.org, navigation...@chromium.org, network-ser...@chromium.org

Attention is currently required from: Takashi Toyoshima.

Titouan Rigoudy would like Takashi Toyoshima to review this change.

View Change

[Private Network Access] Introduce preflight policies.

This change:

* Adds the `kPreflightWarn` and `kPreflighBlock` private network request
policies.
* Introduces two new feature flags controlling the rollout of the new
policies.
* Modifies `network::PrivateNetworkAccessCheck()` to handle the new
policies.
* Adds unit tests for `network::URLLoader` to check this handling.
* Adds browser tests to
content/browser/renderer_host/private_network_access_browsertest.cc

Fixed: chromium:1251963
Change-Id: Ice0990bc8caa47977846e70a4e63c5dfe01add28
---
M services/network/public/mojom/client_security_state.mojom
M third_party/blink/renderer/core/inspector/inspector_network_agent.cc
M content/public/common/content_features.h
M services/network/private_network_access_check.h
M third_party/blink/public/devtools_protocol/browser_protocol.pdl
M services/network/public/cpp/private_network_access_check_result.cc
M services/network/url_loader_unittest.cc
M content/public/common/content_features.cc
M tools/metrics/histograms/enums.xml
M services/network/public/cpp/private_network_access_check_result.h
M services/network/private_network_access_check.cc
M content/browser/renderer_host/private_network_access_util.cc
M services/network/public/mojom/cors.mojom
M content/browser/renderer_host/private_network_access_browsertest.cc
M third_party/blink/renderer/platform/loader/cors/cors_error_string.cc
M content/browser/devtools/protocol/network_handler.cc
16 files changed, 710 insertions(+), 81 deletions(-)


To view, visit change 3179212. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ice0990bc8caa47977846e70a4e63c5dfe01add28
Gerrit-Change-Number: 3179212
Gerrit-PatchSet: 4
Gerrit-Owner: Titouan Rigoudy <tit...@chromium.org>
Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
Gerrit-Reviewer: Titouan Rigoudy <tit...@chromium.org>
Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
Gerrit-CC: Matt Menke <mme...@chromium.org>
Gerrit-CC: Nate Chapin <jap...@chromium.org>
Gerrit-Attention: Takashi Toyoshima <toyo...@chromium.org>
Gerrit-MessageType: newchange

Titouan Rigoudy (Gerrit)

unread,
Sep 27, 2021, 8:42:35 AM9/27/21
to alexmo...@chromium.org, asvitkine...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, creis...@chromium.org, devtools-re...@chromium.org, gavinp...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading...@chromium.org, lucmult...@chromium.org, navigation...@chromium.org, network-ser...@chromium.org, Takashi Toyoshima, Matt Menke, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, devtools...@chromium.org, Nate Chapin

Attention is currently required from: Takashi Toyoshima.

View Change

    To view, visit change 3179212. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Ice0990bc8caa47977846e70a4e63c5dfe01add28
    Gerrit-Change-Number: 3179212
    Gerrit-PatchSet: 4
    Gerrit-Owner: Titouan Rigoudy <tit...@chromium.org>
    Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
    Gerrit-Reviewer: Titouan Rigoudy <tit...@chromium.org>
    Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
    Gerrit-CC: Matt Menke <mme...@chromium.org>
    Gerrit-CC: Nate Chapin <jap...@chromium.org>
    Gerrit-Attention: Takashi Toyoshima <toyo...@chromium.org>
    Gerrit-Comment-Date: Mon, 27 Sep 2021 12:42:23 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: No
    Gerrit-MessageType: comment

    Matt Menke (Gerrit)

    unread,
    Sep 27, 2021, 10:08:08 AM9/27/21
    to Titouan Rigoudy, alexmo...@chromium.org, asvitkine...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, creis...@chromium.org, devtools-re...@chromium.org, gavinp...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading...@chromium.org, lucmult...@chromium.org, navigation...@chromium.org, network-ser...@chromium.org, Takashi Toyoshima, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, devtools...@chromium.org, Nate Chapin

    Attention is currently required from: Titouan Rigoudy, Takashi Toyoshima.

    View Change

    1 comment:

    • Patchset:

      To view, visit change 3179212. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Ice0990bc8caa47977846e70a4e63c5dfe01add28
      Gerrit-Change-Number: 3179212
      Gerrit-PatchSet: 4
      Gerrit-Owner: Titouan Rigoudy <tit...@chromium.org>
      Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
      Gerrit-Reviewer: Titouan Rigoudy <tit...@chromium.org>
      Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
      Gerrit-CC: Matt Menke <mme...@chromium.org>
      Gerrit-CC: Nate Chapin <jap...@chromium.org>
      Gerrit-Attention: Titouan Rigoudy <tit...@chromium.org>
      Gerrit-Attention: Takashi Toyoshima <toyo...@chromium.org>
      Gerrit-Comment-Date: Mon, 27 Sep 2021 14:07:56 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Titouan Rigoudy <tit...@chromium.org>
      Gerrit-MessageType: comment

      Takashi Toyoshima (Gerrit)

      unread,
      Sep 29, 2021, 11:40:10 AM9/29/21
      to Titouan Rigoudy, alexmo...@chromium.org, asvitkine...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, creis...@chromium.org, devtools-re...@chromium.org, gavinp...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading...@chromium.org, lucmult...@chromium.org, navigation...@chromium.org, network-ser...@chromium.org, Matt Menke, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, devtools...@chromium.org, Nate Chapin

      Attention is currently required from: Titouan Rigoudy.

      View Change

      9 comments:

      • File content/browser/renderer_host/private_network_access_util.cc:

        • Patch Set #4, Line 26: kAllow

          just in case, is this intentional to drop kWarn case for !IsEnabled(kWarnAboutSecurePrivateNetworkRequests) && is_web_secure_context?

        • Patch Set #4, Line 66: !policies.is_web_secure_context

          Is this really an invert of is_web_secure_context? Polarity seems inverted from the original check at line 19.

      • File content/public/common/content_features.h:

        • Patch Set #4, Line 147:

          CONTENT_EXPORT extern const base::Feature kPrivateNetworkAccessSendPreflights;
          CONTENT_EXPORT extern const base::Feature
          kPrivateNetworkAccessEnforcePreflights;

          dict order?

      • File content/public/common/content_features.cc:

        • Patch Set #4, Line 591: // Enables sending CORS preflight requests ahead of private network requests.

          Is sending preflight was the original behavior? If so, .._ENABLED_BY_DEFAULT seems preferable.

        • Patch Set #4, Line 601: EnforcePreflights

          My first impression of EnforcePreflights is to enforce to send preflight.
          How about FollowPreflightResponses, RespectPreflightResults, or so?

      • File services/network/private_network_access_check.cc:

        • Patch Set #4, Line 71: UMA_HISTOGRAM_ENUMERATION

          Is this really performance critical? Otherwise, base::UmaHistogramEnumeration was fine enough.

      • File services/network/public/cpp/private_network_access_check_result.cc:

        • Patch Set #4, Line 28:

              case Result::kBlockedByPolicyPreflightWarn:
          case Result::kBlockedByPolicyPreflightBlock:
          return CorsError::kUnexpectedPrivateNetworkAccess;

          may place at the last case after kBlockedByTargetIpAddressSpace to follow enum order for better readability.

      • File services/network/public/mojom/cors.mojom:

        • Patch Set #4, Line 139:

            // - `kUnexpectedPrivateNetworkAccess`
          // - `kInvalidPrivateNetworkAccess`
          // - `kInsecurePrivateNetwork`

          Maybe list them in the same order with enum is better if there is no reason?
          // - `kInsecurePrivateNetwork`
          // - `kInvalidPrivateNetworkAccess`
          // - `kUnexpectedPrivateNetworkAccess`
      • File third_party/blink/renderer/core/inspector/inspector_network_agent.cc:

        • Patch Set #4, Line 506:

              case network::mojom::CorsError::kUnexpectedPrivateNetworkAccess:
          return protocol::Network::CorsErrorEnum::UnexpectedPrivateNetworkAccess;


          better to be after InvalidPrivateNetworkAccess?

      To view, visit change 3179212. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Ice0990bc8caa47977846e70a4e63c5dfe01add28
      Gerrit-Change-Number: 3179212
      Gerrit-PatchSet: 4
      Gerrit-Owner: Titouan Rigoudy <tit...@chromium.org>
      Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
      Gerrit-Reviewer: Titouan Rigoudy <tit...@chromium.org>
      Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
      Gerrit-CC: Matt Menke <mme...@chromium.org>
      Gerrit-CC: Nate Chapin <jap...@chromium.org>
      Gerrit-Attention: Titouan Rigoudy <tit...@chromium.org>
      Gerrit-Comment-Date: Wed, 29 Sep 2021 15:39:57 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Gerrit-MessageType: comment

      Titouan Rigoudy (Gerrit)

      unread,
      Sep 30, 2021, 8:00:01 AM9/30/21
      to alexmo...@chromium.org, asvitkine...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, creis...@chromium.org, devtools-re...@chromium.org, gavinp...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading...@chromium.org, lucmult...@chromium.org, navigation...@chromium.org, network-ser...@chromium.org, Takashi Toyoshima, Matt Menke, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, devtools...@chromium.org, Nate Chapin

      Attention is currently required from: Takashi Toyoshima.

      View Change

      9 comments:

      • File content/browser/renderer_host/private_network_access_util.cc:

        • just in case, is this intentional to drop kWarn case for !IsEnabled(kWarnAboutSecurePrivateNetworkRe […]

          I think you mean IsEnabled(kWarn...) && is_web_secure_context, in which case see my comment below.

        • Is this really an invert of is_web_secure_context? Polarity seems inverted from the original check a […]

          It does seem that way, but it's because of the early return style used here. Note also the || instead of &&.

          We used to return kWarn if:

           is_web_secure_context &&
          IsEnabled(kWarnAboutSecure...) &&

          on L19. Now we would fall through all the previous ifs until L66 (provided the new preflight features are not enabled), at which point we would return kWarn on L69.

          If the new preflight features are enabled, however, then they would apply and we would return kPreflightBlock or kPreflightWarn.

          There are tests for all this in content/browser/renderer_host/private_network_access_browsertest.cc, dating back to the time when this check lived right inside RenderFrameHostImpl. It might be time for some unit tests here instead...

      • File content/public/common/content_features.h:

        • Patch Set #4, Line 147:

          CONTENT_EXPORT extern const base::Feature kPrivateNetworkAccessSendPreflights;
          CONTENT_EXPORT extern const base::Feature
          kPrivateNetworkAccessEnforcePreflights;

          dict order?

        • Done

      • File content/public/common/content_features.cc:

        • Patch Set #4, Line 591: // Enables sending CORS preflight requests ahead of private network requests.

          Is sending preflight was the original behavior? If so, .._ENABLED_BY_DEFAULT seems preferable.

        • It was not. We do not have the code in place to send preflights for private network requests yet, though it should be the next CL I send you 😊

        • My first impression of EnforcePreflights is to enforce to send preflight. […]

          Right, I was trying to be too terse with my single-verb form... I like your RespectPreflightResults suggestion!

      • File services/network/private_network_access_check.cc:

        • Patch Set #4, Line 28:

              case Result::kBlockedByPolicyPreflightWarn:
          case Result::kBlockedByPolicyPreflightBlock:
          return CorsError::kUnexpectedPrivateNetworkAccess;

        • may place at the last case after kBlockedByTargetIpAddressSpace to follow enum order for better read […]

          Done

      • File services/network/public/mojom/cors.mojom:

        • Patch Set #4, Line 139:

            // - `kUnexpectedPrivateNetworkAccess`
          // - `kInvalidPrivateNetworkAccess`
          // - `kInsecurePrivateNetwork`

        • Maybe list them in the same order with enum is better if there is no reason? […]

          Done

      • File third_party/blink/renderer/core/inspector/inspector_network_agent.cc:

        • Patch Set #4, Line 506:

              case network::mojom::CorsError::kUnexpectedPrivateNetworkAccess:
          return protocol::Network::CorsErrorEnum::UnexpectedPrivateNetworkAccess;


          better to be after InvalidPrivateNetworkAccess?

        • Done

      To view, visit change 3179212. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Ice0990bc8caa47977846e70a4e63c5dfe01add28
      Gerrit-Change-Number: 3179212
      Gerrit-PatchSet: 5
      Gerrit-Owner: Titouan Rigoudy <tit...@chromium.org>
      Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
      Gerrit-Reviewer: Titouan Rigoudy <tit...@chromium.org>
      Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
      Gerrit-CC: Matt Menke <mme...@chromium.org>
      Gerrit-CC: Nate Chapin <jap...@chromium.org>
      Gerrit-Attention: Takashi Toyoshima <toyo...@chromium.org>
      Gerrit-Comment-Date: Thu, 30 Sep 2021 11:59:46 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Takashi Toyoshima <toyo...@chromium.org>
      Gerrit-MessageType: comment

      Takashi Toyoshima (Gerrit)

      unread,
      Oct 1, 2021, 11:20:40 PM10/1/21
      to Titouan Rigoudy, alexmo...@chromium.org, asvitkine...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, creis...@chromium.org, devtools-re...@chromium.org, gavinp...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading...@chromium.org, lucmult...@chromium.org, navigation...@chromium.org, network-ser...@chromium.org, Matt Menke, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, devtools...@chromium.org, Nate Chapin

      Attention is currently required from: Titouan Rigoudy.

      Patch set 5:Code-Review +1

      View Change

      3 comments:

      • File content/browser/renderer_host/private_network_access_util.cc:

        • I think you mean IsEnabled(kWarn...) && is_web_secure_context, in which case see my comment below.

          Ack

        • It does seem that way, but it's because of the early return style used here. […]

          thank you for your all explanation.
          yep, this kind of condition checks would necessary be too complex, and having tests sound a right approach.

      • File services/network/private_network_access_check.cc:

        • This is called on every connection obtained during a load, so I thought that the suggestion here [1] […]

          Hum. This could be hit multiple times per second in some busy scenarios, but compared to other operations per one request (e.g. connection establishment), the time to take the histogram seems ignorably short. So, my impression is function is still fine. But it isn't a strong opinion, and feel free to decide the direction. Both would be possible.

      To view, visit change 3179212. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Ice0990bc8caa47977846e70a4e63c5dfe01add28
      Gerrit-Change-Number: 3179212
      Gerrit-PatchSet: 5
      Gerrit-Owner: Titouan Rigoudy <tit...@chromium.org>
      Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
      Gerrit-Reviewer: Titouan Rigoudy <tit...@chromium.org>
      Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
      Gerrit-CC: Matt Menke <mme...@chromium.org>
      Gerrit-CC: Nate Chapin <jap...@chromium.org>
      Gerrit-Attention: Titouan Rigoudy <tit...@chromium.org>
      Gerrit-Comment-Date: Sat, 02 Oct 2021 03:20:25 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      Comment-In-Reply-To: Titouan Rigoudy <tit...@chromium.org>

      Titouan Rigoudy (Gerrit)

      unread,
      Oct 4, 2021, 6:38:47 AM10/4/21
      to Arthur Sonzogni, Andrey Kosyakov, Robert Sesek, alexmo...@chromium.org, asvitkine...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, creis...@chromium.org, devtools-re...@chromium.org, gavinp...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading...@chromium.org, lucmult...@chromium.org, navigation...@chromium.org, network-ser...@chromium.org, Takashi Toyoshima

      Attention is currently required from: Arthur Sonzogni, Andrey Kosyakov, Robert Sesek.

      Titouan Rigoudy would like Arthur Sonzogni, Andrey Kosyakov and Robert Sesek to review this change.

      View Change

      16 files changed, 710 insertions(+), 79 deletions(-)


      To view, visit change 3179212. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Ice0990bc8caa47977846e70a4e63c5dfe01add28
      Gerrit-Change-Number: 3179212
      Gerrit-PatchSet: 6
      Gerrit-Owner: Titouan Rigoudy <tit...@chromium.org>
      Gerrit-Reviewer: Andrey Kosyakov <ca...@chromium.org>
      Gerrit-Reviewer: Arthur Sonzogni <arthurs...@chromium.org>
      Gerrit-Reviewer: Robert Sesek <rse...@chromium.org>
      Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
      Gerrit-Reviewer: Titouan Rigoudy <tit...@chromium.org>
      Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
      Gerrit-CC: Matt Menke <mme...@chromium.org>
      Gerrit-CC: Nate Chapin <jap...@chromium.org>
      Gerrit-Attention: Arthur Sonzogni <arthurs...@chromium.org>
      Gerrit-Attention: Andrey Kosyakov <ca...@chromium.org>
      Gerrit-Attention: Robert Sesek <rse...@chromium.org>
      Gerrit-MessageType: newchange

      Titouan Rigoudy (Gerrit)

      unread,
      Oct 4, 2021, 6:38:54 AM10/4/21
      to alexmo...@chromium.org, asvitkine...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, creis...@chromium.org, devtools-re...@chromium.org, gavinp...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading...@chromium.org, lucmult...@chromium.org, navigation...@chromium.org, network-ser...@chromium.org, Andrey Kosyakov, Arthur Sonzogni, Robert Sesek, Takashi Toyoshima, Matt Menke, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, devtools...@chromium.org, Nate Chapin

      Attention is currently required from: Arthur Sonzogni, Andrey Kosyakov, Robert Sesek.

      View Change

      2 comments:

      • Patchset:

        • Patch Set #6:

          Thanks for the review! Sending onwards to devtools, content and security OWNERS.

      • File services/network/private_network_access_check.cc:

        • Hum. […]

          Ok! Reverted to a function then, optimizing for code size seems preferable.

      To view, visit change 3179212. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Ice0990bc8caa47977846e70a4e63c5dfe01add28
      Gerrit-Change-Number: 3179212
      Gerrit-PatchSet: 6
      Gerrit-Owner: Titouan Rigoudy <tit...@chromium.org>
      Gerrit-Reviewer: Andrey Kosyakov <ca...@chromium.org>
      Gerrit-Reviewer: Arthur Sonzogni <arthurs...@chromium.org>
      Gerrit-Reviewer: Robert Sesek <rse...@chromium.org>
      Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
      Gerrit-Reviewer: Titouan Rigoudy <tit...@chromium.org>
      Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
      Gerrit-CC: Matt Menke <mme...@chromium.org>
      Gerrit-CC: Nate Chapin <jap...@chromium.org>
      Gerrit-Attention: Arthur Sonzogni <arthurs...@chromium.org>
      Gerrit-Attention: Andrey Kosyakov <ca...@chromium.org>
      Gerrit-Attention: Robert Sesek <rse...@chromium.org>
      Gerrit-Comment-Date: Mon, 04 Oct 2021 10:38:33 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No

      Robert Sesek (Gerrit)

      unread,
      Oct 4, 2021, 2:58:11 PM10/4/21
      to Titouan Rigoudy, alexmo...@chromium.org, asvitkine...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, creis...@chromium.org, devtools-re...@chromium.org, gavinp...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading...@chromium.org, lucmult...@chromium.org, navigation...@chromium.org, network-ser...@chromium.org, Robert Sesek, Andrey Kosyakov, Arthur Sonzogni, Takashi Toyoshima, Matt Menke, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, devtools...@chromium.org, Nate Chapin

      Attention is currently required from: Arthur Sonzogni, Andrey Kosyakov, Titouan Rigoudy.

      Patch set 6:Code-Review +1

      View Change

        To view, visit change 3179212. To unsubscribe, or for help writing mail filters, visit settings.

        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: Ice0990bc8caa47977846e70a4e63c5dfe01add28
        Gerrit-Change-Number: 3179212
        Gerrit-PatchSet: 6
        Gerrit-Owner: Titouan Rigoudy <tit...@chromium.org>
        Gerrit-Reviewer: Andrey Kosyakov <ca...@chromium.org>
        Gerrit-Reviewer: Arthur Sonzogni <arthurs...@chromium.org>
        Gerrit-Reviewer: Robert Sesek <rse...@chromium.org>
        Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
        Gerrit-Reviewer: Titouan Rigoudy <tit...@chromium.org>
        Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
        Gerrit-CC: Matt Menke <mme...@chromium.org>
        Gerrit-CC: Nate Chapin <jap...@chromium.org>
        Gerrit-Attention: Arthur Sonzogni <arthurs...@chromium.org>
        Gerrit-Attention: Andrey Kosyakov <ca...@chromium.org>
        Gerrit-Attention: Titouan Rigoudy <tit...@chromium.org>
        Gerrit-Comment-Date: Mon, 04 Oct 2021 18:57:55 +0000
        Gerrit-HasComments: No
        Gerrit-Has-Labels: Yes
        Gerrit-MessageType: comment

        Andrey Kosyakov (Gerrit)

        unread,
        Oct 4, 2021, 4:25:04 PM10/4/21
        to Titouan Rigoudy, alexmo...@chromium.org, asvitkine...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, creis...@chromium.org, devtools-re...@chromium.org, gavinp...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading...@chromium.org, lucmult...@chromium.org, navigation...@chromium.org, network-ser...@chromium.org, Robert Sesek, Arthur Sonzogni, Takashi Toyoshima, Matt Menke, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, devtools...@chromium.org, Nate Chapin

        Attention is currently required from: Arthur Sonzogni, Titouan Rigoudy.

        Patch set 6:Code-Review +1

        View Change

        2 comments:

        • Patchset:

        • File third_party/blink/public/devtools_protocol/browser_protocol.pdl:

          • Patch Set #6, Line 4921: UnexpectedPrivateNetworkAccess

            Let's start documenting these -- could you please add comments to the above three that explain when each occurs and highlight the differences. Something along the lines of cors_error_strings messages would be great.

        To view, visit change 3179212. To unsubscribe, or for help writing mail filters, visit settings.

        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: Ice0990bc8caa47977846e70a4e63c5dfe01add28
        Gerrit-Change-Number: 3179212
        Gerrit-PatchSet: 6
        Gerrit-Owner: Titouan Rigoudy <tit...@chromium.org>
        Gerrit-Reviewer: Andrey Kosyakov <ca...@chromium.org>
        Gerrit-Reviewer: Arthur Sonzogni <arthurs...@chromium.org>
        Gerrit-Reviewer: Robert Sesek <rse...@chromium.org>
        Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
        Gerrit-Reviewer: Titouan Rigoudy <tit...@chromium.org>
        Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
        Gerrit-CC: Matt Menke <mme...@chromium.org>
        Gerrit-CC: Nate Chapin <jap...@chromium.org>
        Gerrit-Attention: Arthur Sonzogni <arthurs...@chromium.org>
        Gerrit-Attention: Titouan Rigoudy <tit...@chromium.org>
        Gerrit-Comment-Date: Mon, 04 Oct 2021 20:24:54 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: Yes
        Gerrit-MessageType: comment

        Arthur Sonzogni (Gerrit)

        unread,
        Oct 5, 2021, 8:11:56 AM10/5/21
        to Titouan Rigoudy, alexmo...@chromium.org, asvitkine...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, creis...@chromium.org, devtools-re...@chromium.org, gavinp...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading...@chromium.org, lucmult...@chromium.org, navigation...@chromium.org, network-ser...@chromium.org, Andrey Kosyakov, Robert Sesek, Takashi Toyoshima, Matt Menke, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, devtools...@chromium.org, Nate Chapin

        Attention is currently required from: Titouan Rigoudy.

        Patch set 6:Code-Review +1

        View Change

        3 comments:

        To view, visit change 3179212. To unsubscribe, or for help writing mail filters, visit settings.

        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: Ice0990bc8caa47977846e70a4e63c5dfe01add28
        Gerrit-Change-Number: 3179212
        Gerrit-PatchSet: 6
        Gerrit-Owner: Titouan Rigoudy <tit...@chromium.org>
        Gerrit-Reviewer: Andrey Kosyakov <ca...@chromium.org>
        Gerrit-Reviewer: Arthur Sonzogni <arthurs...@chromium.org>
        Gerrit-Reviewer: Robert Sesek <rse...@chromium.org>
        Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
        Gerrit-Reviewer: Titouan Rigoudy <tit...@chromium.org>
        Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
        Gerrit-CC: Matt Menke <mme...@chromium.org>
        Gerrit-CC: Nate Chapin <jap...@chromium.org>
        Gerrit-Attention: Titouan Rigoudy <tit...@chromium.org>
        Gerrit-Comment-Date: Tue, 05 Oct 2021 12:11:42 +0000

        Titouan Rigoudy (Gerrit)

        unread,
        Oct 5, 2021, 9:52:30 AM10/5/21
        to alexmo...@chromium.org, asvitkine...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, creis...@chromium.org, devtools-re...@chromium.org, gavinp...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading...@chromium.org, lucmult...@chromium.org, navigation...@chromium.org, network-ser...@chromium.org, Arthur Sonzogni, Andrey Kosyakov, Robert Sesek, Takashi Toyoshima, Matt Menke, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, devtools...@chromium.org, Nate Chapin

        Patch set 7:Commit-Queue +2

        View Change

        4 comments:

        • Patchset:

        • File content/browser/renderer_host/private_network_access_browsertest.cc:

          • Ha! Good catch, thanks. Done.

          • 😊

        • File third_party/blink/public/devtools_protocol/browser_protocol.pdl:

          • Let's start documenting these -- could you please add comments to the above three that explain when […]

            Done

        To view, visit change 3179212. To unsubscribe, or for help writing mail filters, visit settings.

        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: Ice0990bc8caa47977846e70a4e63c5dfe01add28
        Gerrit-Change-Number: 3179212
        Gerrit-PatchSet: 7
        Gerrit-Owner: Titouan Rigoudy <tit...@chromium.org>
        Gerrit-Reviewer: Andrey Kosyakov <ca...@chromium.org>
        Gerrit-Reviewer: Arthur Sonzogni <arthurs...@chromium.org>
        Gerrit-Reviewer: Robert Sesek <rse...@chromium.org>
        Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
        Gerrit-Reviewer: Titouan Rigoudy <tit...@chromium.org>
        Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
        Gerrit-CC: Matt Menke <mme...@chromium.org>
        Gerrit-CC: Nate Chapin <jap...@chromium.org>
        Gerrit-Comment-Date: Tue, 05 Oct 2021 13:52:17 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: Yes
        Comment-In-Reply-To: Arthur Sonzogni <arthurs...@chromium.org>
        Comment-In-Reply-To: Andrey Kosyakov <ca...@chromium.org>
        Gerrit-MessageType: comment

        Chromium LUCI CQ (Gerrit)

        unread,
        Oct 5, 2021, 11:29:37 AM10/5/21
        to Titouan Rigoudy, alexmo...@chromium.org, asvitkine...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, creis...@chromium.org, devtools-re...@chromium.org, gavinp...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading...@chromium.org, lucmult...@chromium.org, navigation...@chromium.org, network-ser...@chromium.org, Arthur Sonzogni, Andrey Kosyakov, Robert Sesek, Takashi Toyoshima, Matt Menke, Chromium Metrics Reviews, chromium...@chromium.org, devtools...@chromium.org, Nate Chapin

        Chromium LUCI CQ submitted this change.

        View Change



        6 is the latest approved patch-set.
        The change was submitted with unreviewed changes in the following files:

        ```
        The name of the file: content/browser/renderer_host/private_network_access_browsertest.cc
        Insertions: 8, Deletions: 6.

        @@ -2616,9 +2616,10 @@

        // Check that the page can load a local resource.
        //
        - // TODO(https://crbug.com/XXX): The page should be able to load this resource,
        - // since in this feature flag configuration we should send CORS preflight
        - // requests but not gate the actual request based on the preflight's outcome.
        + // TODO(https://crbug.com/1256775): The page should be able to load this
        + // resource, since in this feature flag configuration we should send CORS
        + // preflight requests but not gate the actual request based on the preflight's
        + // outcome.
        //
        // We load the resource from a secure origin to avoid running afoul of mixed
        // content restrictions.
        @@ -2666,9 +2667,10 @@

        // Check that the page can load a local resource.
        //
        - // TODO(https://crbug.com/XXX): The page should be able to load this resource,
        - // since in this feature flag configuration we should send CORS preflight
        - // requests but not gate the actual request based on the preflight's outcome.
        + // TODO(https://crbug.com/1256775): The page should be able to load this
        + // resource, since in this feature flag configuration we should send CORS
        + // preflight requests but not gate the actual request based on the preflight's
        + // outcome.
        //
        // We load it from a secure origin to avoid running afoul of mixed content
        // restrictions.
        ```
        ```
        The name of the file: third_party/blink/public/devtools_protocol/browser_protocol.pdl
        Insertions: 5, Deletions: 0.

        @@ -4916,8 +4916,13 @@
        MethodDisallowedByPreflightResponse
        HeaderDisallowedByPreflightResponse
        RedirectContainsCredentials
        + # Request was a private network request initiated by a non-secure context.
        InsecurePrivateNetwork
        + # Request carried a target IP address space property that did not match
        + # the target resource's address space.
        InvalidPrivateNetworkAccess
        + # Request was a private network request yet did not carry a target IP
        + # address space.
        UnexpectedPrivateNetworkAccess
        NoCorsRedirectModeNotFollow

        ```

        Approvals: Takashi Toyoshima: Looks good to me Andrey Kosyakov: Looks good to me Robert Sesek: Looks good to me Arthur Sonzogni: Looks good to me Titouan Rigoudy: Commit
        [Private Network Access] Introduce preflight policies.

        This change:

        * Adds the `kPreflightWarn` and `kPreflighBlock` private network request
        policies.
        * Introduces two new feature flags controlling the rollout of the new
        policies.
        * Modifies `network::PrivateNetworkAccessCheck()` to handle the new
        policies.
        * Adds unit tests for `network::URLLoader` to check this handling.
        * Adds browser tests to
        content/browser/renderer_host/private_network_access_browsertest.cc

        Fixed: chromium:1251963
        Change-Id: Ice0990bc8caa47977846e70a4e63c5dfe01add28
        Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3179212
        Commit-Queue: Titouan Rigoudy <tit...@chromium.org>
        Reviewed-by: Robert Sesek <rse...@chromium.org>
        Reviewed-by: Andrey Kosyakov <ca...@chromium.org>
        Reviewed-by: Arthur Sonzogni <arthurs...@chromium.org>
        Reviewed-by: Takashi Toyoshima <toyo...@chromium.org>
        Cr-Commit-Position: refs/heads/main@{#928163}

        ---
        M services/network/public/mojom/client_security_state.mojom
        M third_party/blink/renderer/core/inspector/inspector_network_agent.cc
        M content/public/common/content_features.h
        M services/network/private_network_access_check.h
        M third_party/blink/public/devtools_protocol/browser_protocol.pdl
        M services/network/public/cpp/private_network_access_check_result.cc
        M services/network/url_loader_unittest.cc
        M content/public/common/content_features.cc
        M tools/metrics/histograms/enums.xml
        M services/network/public/cpp/private_network_access_check_result.h
        M services/network/private_network_access_check.cc
        M content/browser/renderer_host/private_network_access_util.cc
        M services/network/public/mojom/cors.mojom
        M content/browser/renderer_host/private_network_access_browsertest.cc
        M third_party/blink/renderer/platform/loader/cors/cors_error_string.cc
        M content/browser/devtools/protocol/network_handler.cc
        16 files changed, 724 insertions(+), 79 deletions(-)


        To view, visit change 3179212. To unsubscribe, or for help writing mail filters, visit settings.

        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: Ice0990bc8caa47977846e70a4e63c5dfe01add28
        Gerrit-Change-Number: 3179212
        Gerrit-PatchSet: 8
        Gerrit-Owner: Titouan Rigoudy <tit...@chromium.org>
        Gerrit-Reviewer: Andrey Kosyakov <ca...@chromium.org>
        Gerrit-Reviewer: Arthur Sonzogni <arthurs...@chromium.org>
        Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
        Gerrit-Reviewer: Robert Sesek <rse...@chromium.org>
        Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
        Gerrit-Reviewer: Titouan Rigoudy <tit...@chromium.org>
        Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
        Gerrit-CC: Matt Menke <mme...@chromium.org>
        Gerrit-CC: Nate Chapin <jap...@chromium.org>
        Gerrit-MessageType: merged
        Reply all
        Reply to author
        Forward
        0 new messages