Move Chrome Native File System blocklist to own file [chromium/src : main]

1 view
Skip to first unread message

Evan Stade (Gerrit)

unread,
Apr 11, 2024, 1:48:02 PM4/11/24
to Shelley Vohr, Marijn Kruisselbrink, Daseul Lee, chromium...@chromium.org, blundell+...@chromium.org, dominickn+wat...@chromium.org, permissio...@chromium.org
Attention needed from Daseul Lee, Marijn Kruisselbrink and Shelley Vohr

Evan Stade added 2 comments

Patchset-level comments
File-level comment, Patchset 1 (Latest):
Evan Stade . resolved

Hi Shelley, thanks for the detailed CL description. I sympathize with the difficulty of maintaining downstream patches. However my thoughts are that this list belongs next to the code that uses it for two main reasons:

1) The blocklist is not independent from the code. To actually implement the same blocklist, you probably do need to use the same code. This is illustrated by the fact that `CheckPathAgainstBlocklist`/`ShouldBlockAccessToPath` are not simple functions. Extracting the blocklist and writing other code against it will inevitably lead to behavioral differences. For example, that approach would not pick up crrev.com/0dfa4991c6b522df6c130e948f8d2054d3618282

2) In general, we do prefer to inline constants in implementation files if they're only relevant to that one file. To do otherwise is to suggest to the reader that these constants need to be accessed by more than one bit of implementation. In this case, in the context of Chromium, that implication would be false. And the result is that it's pretty likely that someone will come along, be confused (bad enough on its own), and perhaps even reverse this refactorization. There is nothing in Chromium stopping this from happening.

This is a more specific way of voicing the general rule that "Code in the Chromium project should be in service of other code in the Chromium project. This is important so developers can understand the constraints informing a design
decision." [1]

[1] https://chromium.googlesource.com/chromium/src/+/main/docs/contributing.md#Code-guidelines

File chrome/browser/file_system_access/chrome_file_system_access_blocked_paths.h
Line 13, Patchset 1 (Latest):inline constexpr const int kNoBasePathKey = -1;
Evan Stade . resolved

(Easy to fix, but FWIW) we avoid adding constants to the global scope.

https://google.github.io/styleguide/cppguide.html#Nonmember,_Static_Member,_and_Global_Functions

Open in Gerrit

Related details

Attention is currently required from:
  • Daseul Lee
  • Marijn Kruisselbrink
  • Shelley Vohr
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I50b324c6a12fd3059f3129ee3de63219e867374b
Gerrit-Change-Number: 5444608
Gerrit-PatchSet: 1
Gerrit-Owner: Shelley Vohr <shelle...@gmail.com>
Gerrit-Reviewer: Daseul Lee <ds...@chromium.org>
Gerrit-Reviewer: Evan Stade <est...@chromium.org>
Gerrit-Reviewer: Marijn Kruisselbrink <m...@chromium.org>
Gerrit-Attention: Shelley Vohr <shelle...@gmail.com>
Gerrit-Attention: Marijn Kruisselbrink <m...@chromium.org>
Gerrit-Attention: Daseul Lee <ds...@chromium.org>
Gerrit-Comment-Date: Thu, 11 Apr 2024 17:47:49 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Marijn Kruisselbrink (Gerrit)

unread,
Apr 15, 2024, 7:45:23 PM4/15/24
to Shelley Vohr, Evan Stade, Daseul Lee, chromium...@chromium.org, blundell+...@chromium.org, dominickn+wat...@chromium.org, permissio...@chromium.org
Attention needed from Daseul Lee, Evan Stade and Shelley Vohr

Marijn Kruisselbrink added 1 comment

Patchset-level comments
Evan Stade . resolved

Hi Shelley, thanks for the detailed CL description. I sympathize with the difficulty of maintaining downstream patches. However my thoughts are that this list belongs next to the code that uses it for two main reasons:

1) The blocklist is not independent from the code. To actually implement the same blocklist, you probably do need to use the same code. This is illustrated by the fact that `CheckPathAgainstBlocklist`/`ShouldBlockAccessToPath` are not simple functions. Extracting the blocklist and writing other code against it will inevitably lead to behavioral differences. For example, that approach would not pick up crrev.com/0dfa4991c6b522df6c130e948f8d2054d3618282

2) In general, we do prefer to inline constants in implementation files if they're only relevant to that one file. To do otherwise is to suggest to the reader that these constants need to be accessed by more than one bit of implementation. In this case, in the context of Chromium, that implication would be false. And the result is that it's pretty likely that someone will come along, be confused (bad enough on its own), and perhaps even reverse this refactorization. There is nothing in Chromium stopping this from happening.

This is a more specific way of voicing the general rule that "Code in the Chromium project should be in service of other code in the Chromium project. This is important so developers can understand the constraints informing a design
decision." [1]

[1] https://chromium.googlesource.com/chromium/src/+/main/docs/contributing.md#Code-guidelines

Marijn Kruisselbrink

I'll defer to Daseul and Evan for actually reviewing this, but it might be reasonable to move the block list with its supporting code to a separate .h/.cc file. The .h file would then only expose some kind of "CheckPathAgainstBlocklist" method while the blocklist and all the code referencing it would still live entirely in (its own) implementation file. Of course it would still be true that nothing stops anybody from reverting such a refactor (and not sure if that would even help the electron case here), but I think an argument could be made that "file blocklist behavior" is enough of a separate thing to warrant having its own files, even if they are only used from one other file.

Open in Gerrit

Related details

Attention is currently required from:
  • Daseul Lee
  • Evan Stade
  • Shelley Vohr
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I50b324c6a12fd3059f3129ee3de63219e867374b
Gerrit-Change-Number: 5444608
Gerrit-PatchSet: 1
Gerrit-Owner: Shelley Vohr <shelle...@gmail.com>
Gerrit-Reviewer: Daseul Lee <ds...@chromium.org>
Gerrit-Reviewer: Evan Stade <est...@chromium.org>
Gerrit-Reviewer: Marijn Kruisselbrink <m...@chromium.org>
Gerrit-Attention: Shelley Vohr <shelle...@gmail.com>
Gerrit-Attention: Evan Stade <est...@chromium.org>
Gerrit-Attention: Daseul Lee <ds...@chromium.org>
Gerrit-Comment-Date: Mon, 15 Apr 2024 23:45:09 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Evan Stade <est...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Shelley Vohr (Gerrit)

unread,
Apr 16, 2024, 6:53:32 AM4/16/24
to Marijn Kruisselbrink, Evan Stade, Daseul Lee, chromium...@chromium.org, blundell+...@chromium.org, dominickn+wat...@chromium.org, permissio...@chromium.org
Attention needed from Daseul Lee, Evan Stade and Marijn Kruisselbrink

Shelley Vohr added 1 comment

Patchset-level comments
Evan Stade . resolved

Hi Shelley, thanks for the detailed CL description. I sympathize with the difficulty of maintaining downstream patches. However my thoughts are that this list belongs next to the code that uses it for two main reasons:

1) The blocklist is not independent from the code. To actually implement the same blocklist, you probably do need to use the same code. This is illustrated by the fact that `CheckPathAgainstBlocklist`/`ShouldBlockAccessToPath` are not simple functions. Extracting the blocklist and writing other code against it will inevitably lead to behavioral differences. For example, that approach would not pick up crrev.com/0dfa4991c6b522df6c130e948f8d2054d3618282

2) In general, we do prefer to inline constants in implementation files if they're only relevant to that one file. To do otherwise is to suggest to the reader that these constants need to be accessed by more than one bit of implementation. In this case, in the context of Chromium, that implication would be false. And the result is that it's pretty likely that someone will come along, be confused (bad enough on its own), and perhaps even reverse this refactorization. There is nothing in Chromium stopping this from happening.

This is a more specific way of voicing the general rule that "Code in the Chromium project should be in service of other code in the Chromium project. This is important so developers can understand the constraints informing a design
decision." [1]

[1] https://chromium.googlesource.com/chromium/src/+/main/docs/contributing.md#Code-guidelines

Marijn Kruisselbrink

I'll defer to Daseul and Evan for actually reviewing this, but it might be reasonable to move the block list with its supporting code to a separate .h/.cc file. The .h file would then only expose some kind of "CheckPathAgainstBlocklist" method while the blocklist and all the code referencing it would still live entirely in (its own) implementation file. Of course it would still be true that nothing stops anybody from reverting such a refactor (and not sure if that would even help the electron case here), but I think an argument could be made that "file blocklist behavior" is enough of a separate thing to warrant having its own files, even if they are only used from one other file.

Shelley Vohr

With regard to:

 "Code in the Chromium project should be in service of other code in the Chromium project. This is important so developers can understand the constraints informing a design decision."


I agree and do understand this! This CL was underpinned by my thinking that in this case both can be true - that code should primarily benefit the project, but that this change (or a modified version pending review) could stand alone as a reasonable change within the project to encapsulate a chunk of related code and simplify some related concerns.

Open in Gerrit

Related details

Attention is currently required from:
  • Daseul Lee
  • Evan Stade
  • Marijn Kruisselbrink
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I50b324c6a12fd3059f3129ee3de63219e867374b
Gerrit-Change-Number: 5444608
Gerrit-PatchSet: 1
Gerrit-Owner: Shelley Vohr <shelle...@gmail.com>
Gerrit-Reviewer: Daseul Lee <ds...@chromium.org>
Gerrit-Reviewer: Evan Stade <est...@chromium.org>
Gerrit-Reviewer: Marijn Kruisselbrink <m...@chromium.org>
Gerrit-Attention: Marijn Kruisselbrink <m...@chromium.org>
Gerrit-Attention: Evan Stade <est...@chromium.org>
Gerrit-Attention: Daseul Lee <ds...@chromium.org>
Gerrit-Comment-Date: Tue, 16 Apr 2024 10:53:16 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Marijn Kruisselbrink <m...@chromium.org>
Comment-In-Reply-To: Evan Stade <est...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Evan Stade (Gerrit)

unread,
Apr 16, 2024, 11:55:13 AM4/16/24
to Shelley Vohr, Marijn Kruisselbrink, Daseul Lee, chromium...@chromium.org, blundell+...@chromium.org, dominickn+wat...@chromium.org, permissio...@chromium.org
Attention needed from Daseul Lee, Marijn Kruisselbrink and Shelley Vohr

Evan Stade added 1 comment

Patchset-level comments
Evan Stade . resolved

Hi Shelley, thanks for the detailed CL description. I sympathize with the difficulty of maintaining downstream patches. However my thoughts are that this list belongs next to the code that uses it for two main reasons:

1) The blocklist is not independent from the code. To actually implement the same blocklist, you probably do need to use the same code. This is illustrated by the fact that `CheckPathAgainstBlocklist`/`ShouldBlockAccessToPath` are not simple functions. Extracting the blocklist and writing other code against it will inevitably lead to behavioral differences. For example, that approach would not pick up crrev.com/0dfa4991c6b522df6c130e948f8d2054d3618282

2) In general, we do prefer to inline constants in implementation files if they're only relevant to that one file. To do otherwise is to suggest to the reader that these constants need to be accessed by more than one bit of implementation. In this case, in the context of Chromium, that implication would be false. And the result is that it's pretty likely that someone will come along, be confused (bad enough on its own), and perhaps even reverse this refactorization. There is nothing in Chromium stopping this from happening.

This is a more specific way of voicing the general rule that "Code in the Chromium project should be in service of other code in the Chromium project. This is important so developers can understand the constraints informing a design
decision." [1]

[1] https://chromium.googlesource.com/chromium/src/+/main/docs/contributing.md#Code-guidelines

Marijn Kruisselbrink

I'll defer to Daseul and Evan for actually reviewing this, but it might be reasonable to move the block list with its supporting code to a separate .h/.cc file. The .h file would then only expose some kind of "CheckPathAgainstBlocklist" method while the blocklist and all the code referencing it would still live entirely in (its own) implementation file. Of course it would still be true that nothing stops anybody from reverting such a refactor (and not sure if that would even help the electron case here), but I think an argument could be made that "file blocklist behavior" is enough of a separate thing to warrant having its own files, even if they are only used from one other file.

Shelley Vohr

With regard to:

 "Code in the Chromium project should be in service of other code in the Chromium project. This is important so developers can understand the constraints informing a design decision."


I agree and do understand this! This CL was underpinned by my thinking that in this case both can be true - that code should primarily benefit the project, but that this change (or a modified version pending review) could stand alone as a reasonable change within the project to encapsulate a chunk of related code and simplify some related concerns.

Evan Stade

There are almost 3000 lines in `chrome_file_system_access_permission_context.cc` so I agree that it could conceivably be beneficial to split up somewhat. I don't feel that pulling these constants out of the file is the way to do that (for the reasons listed above).

I will leave it up to Daseul, but if there's some way in which refactoring this file makes sense in the service of Chromium, then that is of course fine to pursue. If the end result of that lessens the burden of downstream maintainers, then terrific! But the explicit justification for the current CL is the benefit of a particular downstream project, and that alone is insufficient to motivate a change.

Open in Gerrit

Related details

Attention is currently required from:
  • Daseul Lee
  • Marijn Kruisselbrink
  • Shelley Vohr
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I50b324c6a12fd3059f3129ee3de63219e867374b
Gerrit-Change-Number: 5444608
Gerrit-PatchSet: 1
Gerrit-Owner: Shelley Vohr <shelle...@gmail.com>
Gerrit-Reviewer: Daseul Lee <ds...@chromium.org>
Gerrit-Reviewer: Evan Stade <est...@chromium.org>
Gerrit-Reviewer: Marijn Kruisselbrink <m...@chromium.org>
Gerrit-Attention: Shelley Vohr <shelle...@gmail.com>
Gerrit-Attention: Marijn Kruisselbrink <m...@chromium.org>
Gerrit-Attention: Daseul Lee <ds...@chromium.org>
Gerrit-Comment-Date: Tue, 16 Apr 2024 15:54:58 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Shelley Vohr <shelle...@gmail.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Daseul Lee (Gerrit)

unread,
Apr 16, 2024, 7:05:07 PM4/16/24
to Shelley Vohr, Marijn Kruisselbrink, Evan Stade, chromium...@chromium.org, blundell+...@chromium.org, dominickn+wat...@chromium.org, permissio...@chromium.org
Attention needed from Evan Stade, Marijn Kruisselbrink and Shelley Vohr

Daseul Lee added 1 comment

Patchset-level comments
Evan Stade . resolved

Hi Shelley, thanks for the detailed CL description. I sympathize with the difficulty of maintaining downstream patches. However my thoughts are that this list belongs next to the code that uses it for two main reasons:

1) The blocklist is not independent from the code. To actually implement the same blocklist, you probably do need to use the same code. This is illustrated by the fact that `CheckPathAgainstBlocklist`/`ShouldBlockAccessToPath` are not simple functions. Extracting the blocklist and writing other code against it will inevitably lead to behavioral differences. For example, that approach would not pick up crrev.com/0dfa4991c6b522df6c130e948f8d2054d3618282

2) In general, we do prefer to inline constants in implementation files if they're only relevant to that one file. To do otherwise is to suggest to the reader that these constants need to be accessed by more than one bit of implementation. In this case, in the context of Chromium, that implication would be false. And the result is that it's pretty likely that someone will come along, be confused (bad enough on its own), and perhaps even reverse this refactorization. There is nothing in Chromium stopping this from happening.

This is a more specific way of voicing the general rule that "Code in the Chromium project should be in service of other code in the Chromium project. This is important so developers can understand the constraints informing a design
decision." [1]

[1] https://chromium.googlesource.com/chromium/src/+/main/docs/contributing.md#Code-guidelines

Marijn Kruisselbrink

I'll defer to Daseul and Evan for actually reviewing this, but it might be reasonable to move the block list with its supporting code to a separate .h/.cc file. The .h file would then only expose some kind of "CheckPathAgainstBlocklist" method while the blocklist and all the code referencing it would still live entirely in (its own) implementation file. Of course it would still be true that nothing stops anybody from reverting such a refactor (and not sure if that would even help the electron case here), but I think an argument could be made that "file blocklist behavior" is enough of a separate thing to warrant having its own files, even if they are only used from one other file.

Shelley Vohr

With regard to:

 "Code in the Chromium project should be in service of other code in the Chromium project. This is important so developers can understand the constraints informing a design decision."


I agree and do understand this! This CL was underpinned by my thinking that in this case both can be true - that code should primarily benefit the project, but that this change (or a modified version pending review) could stand alone as a reasonable change within the project to encapsulate a chunk of related code and simplify some related concerns.

Evan Stade

There are almost 3000 lines in `chrome_file_system_access_permission_context.cc` so I agree that it could conceivably be beneficial to split up somewhat. I don't feel that pulling these constants out of the file is the way to do that (for the reasons listed above).

I will leave it up to Daseul, but if there's some way in which refactoring this file makes sense in the service of Chromium, then that is of course fine to pursue. If the end result of that lessens the burden of downstream maintainers, then terrific! But the explicit justification for the current CL is the benefit of a particular downstream project, and that alone is insufficient to motivate a change.

Daseul Lee

Thanks for all the input. I do agree this Context file has grown too much and deserves refactoring (and has been on my radar), but first I'd like to understand where/how the blocklist would be used from?

As Evan mentioned, that blocklist alone is only part of the "blocklist" check, so refactoring that list only itself is already a feature parity. There are also checks for symbolic link, local UNC path, profile dir, safe browsing check, which are added over the course of time via various security issues. Any plans to incorporate these safeguards?

Open in Gerrit

Related details

Attention is currently required from:
  • Evan Stade
  • Marijn Kruisselbrink
  • Shelley Vohr
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I50b324c6a12fd3059f3129ee3de63219e867374b
Gerrit-Change-Number: 5444608
Gerrit-PatchSet: 1
Gerrit-Owner: Shelley Vohr <shelle...@gmail.com>
Gerrit-Reviewer: Daseul Lee <ds...@chromium.org>
Gerrit-Reviewer: Evan Stade <est...@chromium.org>
Gerrit-Reviewer: Marijn Kruisselbrink <m...@chromium.org>
Gerrit-Attention: Shelley Vohr <shelle...@gmail.com>
Gerrit-Attention: Marijn Kruisselbrink <m...@chromium.org>
Gerrit-Attention: Evan Stade <est...@chromium.org>
Gerrit-Comment-Date: Tue, 16 Apr 2024 23:04:46 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Shelley Vohr (Gerrit)

unread,
5:14 AM (2 hours ago) 5:14 AM
to Marijn Kruisselbrink, Evan Stade, chromium...@chromium.org, blundell+...@chromium.org, dominickn+wat...@chromium.org, permissio...@chromium.org

Shelley Vohr abandoned this change.

View Change

Abandoned

Shelley Vohr abandoned this change

Related details

Attention set is empty
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: abandon
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I50b324c6a12fd3059f3129ee3de63219e867374b
    Gerrit-Change-Number: 5444608
    Gerrit-PatchSet: 3
    Gerrit-Owner: Shelley Vohr <shelle...@gmail.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Nuance Tulel (Gerrit)

    unread,
    6:07 AM (1 hour ago) 6:07 AM
    to Shelley Vohr, Marijn Kruisselbrink, Evan Stade, chromium...@chromium.org, blundell+...@chromium.org, dominickn+wat...@chromium.org, permissio...@chromium.org

    Related details

    Attention set is empty
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I50b324c6a12fd3059f3129ee3de63219e867374b
    Gerrit-Change-Number: 5444608
    Gerrit-PatchSet: 3
    Gerrit-Owner: Shelley Vohr <shelle...@gmail.com>
    Gerrit-Reviewer: Evan Stade <est...@chromium.org>
    Gerrit-Reviewer: Marijn Kruisselbrink <m...@chromium.org>
    Gerrit-CC: Nuance Tulel <tulel...@gmail.com>
    Gerrit-Comment-Date: Sun, 02 Aug 2026 10:06:58 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Nuance Tulel (Gerrit)

    unread,
    6:07 AM (1 hour ago) 6:07 AM
    to Shelley Vohr, Marijn Kruisselbrink, Evan Stade, chromium...@chromium.org, blundell+...@chromium.org, dominickn+wat...@chromium.org, permissio...@chromium.org

    Nuance Tulel added 1 comment

    Patchset-level comments
    Open in Gerrit

    Related details

    Attention set is empty
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I50b324c6a12fd3059f3129ee3de63219e867374b
    Gerrit-Change-Number: 5444608
    Gerrit-PatchSet: 3
    Gerrit-Owner: Shelley Vohr <shelle...@gmail.com>
    Gerrit-Reviewer: Evan Stade <est...@chromium.org>
    Gerrit-Reviewer: Marijn Kruisselbrink <m...@chromium.org>
    Gerrit-CC: Nuance Tulel <tulel...@gmail.com>
    Gerrit-Comment-Date: Sun, 02 Aug 2026 10:07:21 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy
    Reply all
    Reply to author
    Forward
    0 new messages