Revert "Reject Windows reserved device names in Storage Service StrictRelativePath" This reverts commit edcbb5b03ce84a017b028416a34d2d8316f7b10f. Reason for revert: Possibly causing Chrome_Mac: Crash Report - [Dump without crash] content::BrowserChildProcessHostImpl::OnMojoError - Validation failed for storage.mojom.Directory.3 [VALIDATION_ERROR_DESERIALIZATION_FAILED] Failure Link: https://crbug.com/545283003 Original change's description: > Reject Windows reserved device names in Storage Service StrictRelativePath > > storage.mojom.StrictRelativePath deserializes paths passed over > Mojo IPC to FilesystemImpl. Previously, it only checked > path.IsAbsolute() and path.ReferencesParent(). > > On Windows, DOS reserved device names (such as CON, PRN, AUX, > NUL, COM1-COM9, LPT1-LPT9, CLOCK$, CONIN$, CONOUT$) or names with > trailing spaces/dots (which Win32 API canonicalization strips to > the underlying device, e.g., "con ") are not considered absolute > or parent-referencing by base::FilePath. When FilesystemImpl > appends such a relative path to its root directory, Win32 APIs > resolve the path to system DOS devices (\\.\CON, \\.\NUL, etc.), > bypassing the directory sandbox. > > This change: > 1. Adds conin$ and conout$ to kMagicNames (exact match) in > base::IsReservedNameOnWindows. > 2. Trims trailing spaces and dots prior to validation in > base::IsReservedNameOnWindows to prevent Win32 path > canonicalization bypasses. > 3. Enforces base::IsReservedNameOnWindows validation across all > platforms during StrictRelativePath Mojom traits deserialization. > 4. Adds unit tests in file_util_unittest.cc and > strict_relative_path_mojom_traits_unittest.cc. > > BUG=497203958 > > Change-Id: I8d51d59457cc20eb0b8e72d5cd177f09b1864b8f > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8221662 > Reviewed-by: Evan Stade <evanstade@microsoft.com> > Reviewed-by: Daniel Cheng <dcheng@chromium.org> > Commit-Queue: S Ganesh <ganesh@chromium.org> > Reviewed-by: Will Harris <wfh@chromium.org> > Cr-Commit-Position: refs/heads/main@{#1676936} Bug: 497203958,545283003 Change-Id: Ibe67270a6a6cf7308dc86ef3b45645c81684181e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8283070 Auto-Submit: S Ganesh <ganesh@chromium.org> Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com> Reviewed-by: Daniel Cheng <dcheng@chromium.org> Commit-Queue: S Ganesh <ganesh@chromium.org> Cr-Commit-Position: refs/heads/main@{#1685202} NOKEYCHECK=True GitOrigin-RevId: a8597aa126e2010c6ebbe46adb23bd02f505b3fc
Contains a written down set of principles and other information on //base. Please add to it!
Chromium is a very mature project. Most things that are generally useful are already here and things not here aren't generally useful.
The bar for adding stuff to base is that it must have demonstrated wide applicability. Prefer to add things closer to where they're used (i.e. “not base”), and pull into base only when needed. In a project our size, sometimes even duplication is OK and inevitable.
Adding a new logging macro DPVELOG_NE is not more clear than just writing the stuff you want to log in a regular logging statement, even if it makes your calling code longer. Just add it to your own code.
If the code in question does not need to be used inside base, but will have multiple consumers across the codebase, consider placing it in a new directory under components/ instead.
base is written for the Chromium project and is not intended to be used outside it. Using base outside of src.git is explicitly not supported, and base makes no guarantees about API (or even ABI) stability (like all other code in Chromium). New code that depends on base/ must be in src.git. Code that's not in src.git but pulled in through DEPS (for example, v8) cannot use base.
Owners are added when a contributor has shown the above qualifications and when they express interest. There isn't an upper bound on the number of OWNERS.
Since the primitives provided by //base are used very widely, it is important to ensure they scale to the necessary workloads and perform well under all supported platforms. The base_perftests target is a suite of synthetic microbenchmarks that measure performance in various scenarios:
thread_local, the implementation in //base, the POSIX/WinAPI directly)Regressions in these benchmarks can generally by caused by 1) operating system changes, 2) compiler version or flag changes or 3) changes in //base code itself.
Rust code in base should be organized into very small crates, split up by function. Merging crates is sometimes unavoidable (due to dependency cycles or the orphaning rule).
Rust files should live near the equivalent C++ files (if any), and use the same naming scheme (for example, run_loop.rs, not run_loop_rust.rs).
When adding FFI shims, prefer separate _shim.h files rather than adding code to existing C++ files. This helps avoid circular dependencies with the //base target. It also avoids adding code to commonly-used headers, which can increase compile size by a lot.
Crates which you expect to be widely used should be added to the public_deps of the //base:base_rust target, so that developers can simply depend on //base:base_rust the same way they do with //base.