AUR AI Reviewer

Review Results

Version #2889 of ungoogled-chromium · commit dfa8b3c70186 · status Reviewed

Risk 0/5 · Safe .SRCINFO
Result #5348

Comment

The only change in this .SRCINFO hunk is a version bump from 155.0.8059.84 to 156.0.8078.47. No sources, checksums, build commands, install scripts, or packaging metadata were altered in the reviewed diff, so there is no new security concern visible here. This appears to be a routine upstream version update only.

@@ -1,6 +1,6 @@
 pkgbase = ungoogled-chromium
 	pkgdesc = A lightweight approach to removing Google web service dependency
-	pkgver = 155.0.8059.84
+	pkgver = 156.0.8078.47
 	pkgrel = 1
 	url = https://github.com/ungoogled-software/ungoogled-chromium
 	arch = x86_64
Risk 0/5 · Safe .SRCINFO
Result #5349

Comment

The change only updates .SRCINFO metadata for a new upstream Chromium/ungoogled-chromium release: version numbers, source URLs, and checksums. The sources remain HTTPS and point to the official upstream GitHub release/archive and Chromium storage, with no new build-time commands, scripts, or privilege-related artifacts introduced in this diff. Based on the provided hunk alone, this is a routine version bump with no evident security red flags.

@@ -84,13 +84,13 @@ pkgbase = ungoogled-chromium
 	optdepends = qt6-base: Qt support
 	optdepends = org.freedesktop.secrets: password storage backend on GNOME, KDE and Xfce
 	optdepends = upower: Battery Status API support
-	provides = chromium=155.0.8059.84
-	provides = chromedriver=155.0.8059.84
+	provides = chromium=156.0.8078.47
+	provides = chromedriver=156.0.8078.47
 	conflicts = chromium
 	conflicts = chromedriver
 	options = !lto
-	source = https://commondatastorage.googleapis.com/chromium-browser-official/chromium-155.0.8059.84-lite.tar.xz
-	source = ungoogled-chromium-155.0.8059.84-1.tar.gz::https://github.com/ungoogled-software/ungoogled-chromium/archive/155.0.8059.84-1.tar.gz
+	source = https://commondatastorage.googleapis.com/chromium-browser-official/chromium-156.0.8078.47-lite.tar.xz
+	source = ungoogled-chromium-156.0.8078.47-1.tar.gz::https://github.com/ungoogled-software/ungoogled-chromium/archive/156.0.8078.47-1.tar.gz
 	source = https://github.com/foutrelis/chromium-launcher/archive/v8/chromium-launcher-8.tar.gz
 	source = chromium-138-nodejs-version-check.patch
 	source = chromium-145-fix-SYS_SECCOMP.patch
Risk 0/5 · Safe .SRCINFO
Result #5350

Comment

The .SRCINFO update is a routine version bump from Chromium 155 to 156 with corresponding source URLs, provides entries, and checksum refreshes. The changed patch list appears to track upstream packaging adjustments for the new release; there is no evidence here of malicious sources, build-time network fetches, privilege escalation, or persistence mechanisms. Based on the diff provided, this looks like a normal maintenance update with low security risk.

@@ -102,18 +102,19 @@ pkgbase = ungoogled-chromium
 	source = chromium-152-unbundle-opus-devtools.patch
 	source = chromium-153-hermetic-python.patch
 	source = chromium-153-iamf-tools-unbundled-opus.patch
-	source = chromium-154-typescript.patch
-	source = chromium-155-crubit.patch
-	source = chromium-155-remove-private_verification_tokens.patch
-	source = chromium-155-isolatedDeclarations.patch
 	source = chromium-155-use-system-esbuild.patch
+	source = chromium-156-crubit.patch
+	source = chromium-156-remove-private_verification_tokens.patch
+	source = chromium-156-revert-gn-check-includes.patch
+	source = chromium-156-typescript.patch
+	source = chromium-156-isolatedDeclarations.patch
 	source = compiler-rt-adjust-paths.patch
 	source = increase-fortify-level.patch
 	source = enable-widevine-arm64.patch
 	source = use-oauth2-client-switches-as-default.patch
 	source = glibc-2.42-baud-rate-fix.patch
-	sha256sums = 2063834f528029ad02a6a3de6d229c3e8b19bc43864be397944cbda18d7ee680
-	sha256sums = 555c7547de4d7f82dbe54d943b7f47d7b6e693b7b92a6e86dec0eac98e8092a5
+	sha256sums = 28432028890ef70e1f2e9db880c500907ad1b04f5ae6b655a3f394b9f2eaa705
+	sha256sums = acf73f8fab3fa7a4977f54e4e51b206eaf6cc425c2294ecc4dc8023fd093bd2d
 	sha256sums = 213e50f48b67feb4441078d50b0fd431df34323be15be97c55302d3fdac4483a
 	sha256sums = 11a96ffa21448ec4c63dd5c8d6795a1998d8e5cd5a689d91aea4d2bdd13fb06e
 	sha256sums = 4fc040a0656a0a524dd8ad090cd129fc5b6cb21adcc66be82080165789e8c13e
Risk 0/5 · Safe .SRCINFO
Result #5351

Comment

The change is a routine version bump in .SRCINFO: it updates pkgver/provides/source filenames and refreshes the corresponding sha256 sums for the new Chromium/ungoogled-chromium release and patch set. The sources remain HTTPS and point to the expected upstream GitHub/Chromium locations, with no new build-time commands, scripts, or privilege-related artifacts introduced by this metadata-only diff. I do not see evidence of supply-chain risk in the reviewed hunk.

@@ -125,11 +126,12 @@ pkgbase = ungoogled-chromium
 	sha256sums = 3276453f2ce655b6286476f48d4df837be952d9447afa46583f79ec71f2288c3
 	sha256sums = ebf74154266d0b6d6cc957c413f845052c5fcfce7745befb8821595cdf3f7d49
 	sha256sums = 2ab9fbe653829ce692f83ee780aad07e8c83a6686e51ab9459ad736cfa2850ee
-	sha256sums = d061cf4aeba21b1d2edabc28afd38106246b99aa5ec699e1b9ee5ca8b76d8a23
-	sha256sums = 85217fbc43f075068167643f0357e3df19a46805efd81a3eae00f966e04290eb
-	sha256sums = d42a5a72c1b085d2623b00caad958f18a6970dbed27558ce7b564e0468f3e252
-	sha256sums = c5aaccfb1f5d6738bfe7e360d6af0bd22f0a1cf4104c28b66cb78e0ff3e9ae08
 	sha256sums = ded2abcb912ac4b6ad139e56384eea8f3b470cf57ecb0baa2c2d042df7575a23
+	sha256sums = 0c8bd7769496ab71116cd73ac17c096b0979fa70fb2e76676f76d34c7424449e
+	sha256sums = 8170368b531a0ae70071da054db4a09a6902b8b7854083d5505570f86a73e644
+	sha256sums = c666f9b009d3a2c737501d714689677e6d474982695966651fe7cdbcbc6e5815
+	sha256sums = 946d4f70daeb446b911197bca804983d305c0ee809bc5507d05451bd07fe9523
+	sha256sums = f6aefbd3f70dbda9242cf815a1dca56af729632166bc57e5067755b119cc95de
 	sha256sums = ec8e49b7114e2fa2d359155c9ef722ff1ba5fe2c518fa48e30863d71d3b82863
 	sha256sums = d634d2ce1fc63da7ac41f432b1e84c59b7cceabf19d510848a7cff40c8025342
 	sha256sums = 5ee4bb69379ac0cea7946c9f8f4ca9e20e0a9e4ee2ee9121eb0ebbb94dd7e928
Risk 0/5 · Safe PKGBUILD
Result #5352

Comment

The PKGBUILD change is a straightforward version bump plus patch refresh. I did not find any new red flags in the packaging logic: sources remain HTTPS and pinned, no new runtime downloads or command execution were introduced, and the added/renamed patches are local files in the repo. The only substantive change is swapping in Chromium 156 patch files and updating checksums/version metadata. Based on the diff shown, this does not introduce an obvious supply-chain or privilege-escalation risk.

@@ -5,20 +5,21 @@
 
 # Maintainer: Christian Heusel <gromit@archlinux.org>
 # Maintainer: Jonathan Grotelüschen <tippfehlr@archlinux.org>
+# Maintainer: DeepChirp <deepchirp@archlinux.org>
 # Contributor: Evangelos Foutras <foutrelis@archlinux.org>
 # Contributor: Pierre Schmitz <pierre@archlinux.de>
 # Contributor: Jan "heftig" Steffens <jan.steffens@gmail.com>
 # Contributor: Daniel J Griffiths <ghost1227@archlinux.us>
 
 pkgname=ungoogled-chromium
-pkgver=155.0.8059.84
+pkgver=156.0.8078.47
 pkgrel=1
 _launcher_ver=8
 _manual_clone=0
 _system_clang=1
 # ungoogled chromium variables
 _uc_usr=ungoogled-software
-_uc_ver=155.0.8059.84-1
+_uc_ver=156.0.8078.47-1
 pkgdesc="A lightweight approach to removing Google web service dependency"
 arch=('x86_64')
 url="https://github.com/ungoogled-software/ungoogled-chromium"
Risk 2/5 · Moderate PKGBUILD
Result #5353

Comment

The PKGBUILD change itself is a routine version bump plus patch refresh, but the new patch set materially changes build behavior. The most notable security-relevant change is that Chromium’s TypeScript tooling is redirected from vendored, checksum-pinned sources to the system `/usr/bin/tsc`, and the build logic now conditionally imports/executes different tooling paths based on a new `use_typescript_go` flag. That increases trust in the local system environment and weakens reproducibility, but it does not introduce an obvious remote code execution or persistence mechanism in the package itself. The other patch updates shown are large Chromium source adjustments (including removal of private verification tokens and strict include checks) but, from the diff provided, they do not add network fetches, privilege escalation, or install-time hooks. Overall this looks like a moderate supply-chain hygiene regression rather than a high-severity malicious change.

@@ -104,18 +105,19 @@ source=(https://commondatastorage.googleapis.com/chromium-browser-official/chrom
         chromium-152-unbundle-opus-devtools.patch
         chromium-153-hermetic-python.patch
         chromium-153-iamf-tools-unbundled-opus.patch
-        chromium-154-typescript.patch
-        chromium-155-crubit.patch
-        chromium-155-remove-private_verification_tokens.patch
-        chromium-155-isolatedDeclarations.patch
         chromium-155-use-system-esbuild.patch
+        chromium-156-crubit.patch
+        chromium-156-remove-private_verification_tokens.patch
+        chromium-156-revert-gn-check-includes.patch
+        chromium-156-typescript.patch
+        chromium-156-isolatedDeclarations.patch
         compiler-rt-adjust-paths.patch
         increase-fortify-level.patch
         enable-widevine-arm64.patch
         use-oauth2-client-switches-as-default.patch
         glibc-2.42-baud-rate-fix.patch)
-sha256sums=('2063834f528029ad02a6a3de6d229c3e8b19bc43864be397944cbda18d7ee680'
-            '555c7547de4d7f82dbe54d943b7f47d7b6e693b7b92a6e86dec0eac98e8092a5'
+sha256sums=('28432028890ef70e1f2e9db880c500907ad1b04f5ae6b655a3f394b9f2eaa705'
+            'acf73f8fab3fa7a4977f54e4e51b206eaf6cc425c2294ecc4dc8023fd093bd2d'
             '213e50f48b67feb4441078d50b0fd431df34323be15be97c55302d3fdac4483a'
             '11a96ffa21448ec4c63dd5c8d6795a1998d8e5cd5a689d91aea4d2bdd13fb06e'
             '4fc040a0656a0a524dd8ad090cd129fc5b6cb21adcc66be82080165789e8c13e'
Risk 0/5 · Safe PKGBUILD
Result #5354

Comment

The change is a routine version bump of ungoogled-chromium from 155.0.8059.84 to 156.0.8078.47, with corresponding source checksum updates and replacement of versioned patch files. I do not see any new attack surface in the PKGBUILD itself: sources remain HTTPS from the official Chromium/ungoogled-chromium locations, there is no added network fetch in build/prepare/package, no privilege escalation, and no suspicious install script or systemd/persistence behavior in the diff. The only substantive change is swapping in newer patch files for the new upstream version, which is expected for a package update. Based on the provided diff alone, this looks safe.

@@ -127,11 +129,12 @@ sha256sums=('2063834f528029ad02a6a3de6d229c3e8b19bc43864be397944cbda18d7ee680'
             '3276453f2ce655b6286476f48d4df837be952d9447afa46583f79ec71f2288c3'
             'ebf74154266d0b6d6cc957c413f845052c5fcfce7745befb8821595cdf3f7d49'
             '2ab9fbe653829ce692f83ee780aad07e8c83a6686e51ab9459ad736cfa2850ee'
-            'd061cf4aeba21b1d2edabc28afd38106246b99aa5ec699e1b9ee5ca8b76d8a23'
-            '85217fbc43f075068167643f0357e3df19a46805efd81a3eae00f966e04290eb'
-            'd42a5a72c1b085d2623b00caad958f18a6970dbed27558ce7b564e0468f3e252'
-            'c5aaccfb1f5d6738bfe7e360d6af0bd22f0a1cf4104c28b66cb78e0ff3e9ae08'
             'ded2abcb912ac4b6ad139e56384eea8f3b470cf57ecb0baa2c2d042df7575a23'
+            '0c8bd7769496ab71116cd73ac17c096b0979fa70fb2e76676f76d34c7424449e'
+            '8170368b531a0ae70071da054db4a09a6902b8b7854083d5505570f86a73e644'
+            'c666f9b009d3a2c737501d714689677e6d474982695966651fe7cdbcbc6e5815'
+            '946d4f70daeb446b911197bca804983d305c0ee809bc5507d05451bd07fe9523'
+            'f6aefbd3f70dbda9242cf815a1dca56af729632166bc57e5067755b119cc95de'
             'ec8e49b7114e2fa2d359155c9ef722ff1ba5fe2c518fa48e30863d71d3b82863'
             'd634d2ce1fc63da7ac41f432b1e84c59b7cceabf19d510848a7cff40c8025342'
             '5ee4bb69379ac0cea7946c9f8f4ca9e20e0a9e4ee2ee9121eb0ebbb94dd7e928'
Risk 1/5 · Low PKGBUILD
Result #5355

Comment

The change is a version bump plus patch reordering and addition of a new Chromium patch set. Based on the diff reviewed, there are no obvious supply-chain red flags: all sources remain HTTPS from the official Chromium/ungoogled-chromium locations, patches are local files in the package, and the new patch content is a build-system adjustment that disables some strict GN include checks and switches TypeScript/WebUI tooling to system binaries. That is a packaging integrity concern only insofar as it weakens build-time checks, but it does not introduce network fetches, privilege escalation, persistence, or embedded binaries. No high-confidence malicious behavior is evident in the reviewed hunk.

@@ -249,18 +252,20 @@ prepare() {
   # for the unbundled system Opus build
   patch -Np1 -i ../chromium-153-iamf-tools-unbundled-opus.patch
 
-  # Work around TypeScript becoming a build dependency: disable tsgo for the
-  # WebUI and point devtools at the system tsc binary
-  # https://github.com/ungoogled-software/ungoogled-chromium/pull/3966
-  patch -Np1 -i ../chromium-154-typescript.patch
+  patch -Np1 -i ../chromium-155-use-system-esbuild.patch
 
-  patch -Np1 -i ../chromium-155-crubit.patch
+  patch -Np1 -i ../chromium-156-crubit.patch
 
-  patch -Np1 -i ../chromium-155-isolatedDeclarations.patch
+  patch -Np1 -i ../chromium-156-remove-private_verification_tokens.patch
 
-  patch -Np1 -i ../chromium-155-remove-private_verification_tokens.patch
+  patch -Np1 -i ../chromium-156-revert-gn-check-includes.patch
 
-  patch -Np1 -i ../chromium-155-use-system-esbuild.patch
+  patch -Np1 -i ../chromium-156-isolatedDeclarations.patch
+
+  # Work around TypeScript becoming a build dependency: disable tsgo for the
+  # WebUI and point devtools at the system tsc binary
+  # https://github.com/ungoogled-software/ungoogled-chromium/pull/3966
+  patch -Np1 -i ../chromium-156-typescript.patch
 
   rm -rf third_party/devtools-frontend/src/node_modules/esbuild/
   ln -s /usr/lib/node_modules/esbuild/ third_party/devtools-frontend/src/node_modules/esbuild
Risk 0/5 · Safe REUSE.toml
Result #5356

Comment

The change only updates REUSE metadata to reference newer patch filenames and adds one new patch name to the annotation list. This file does not affect build logic or runtime behavior, and there is no evidence here of malicious code execution, network access, privilege escalation, or packaging integrity issues. I did not see any suspicious source or install-script changes in this hunk itself.

@@ -61,10 +61,11 @@ SPDX-License-Identifier = "BSD-3-Clause"
 [[annotations]]
 path = [
     "chromium-153-hermetic-python.patch",
-    "chromium-154-typescript.patch",
-    "chromium-155-crubit.patch",
-    "chromium-155-remove-private_verification_tokens.patch",
-    "chromium-155-isolatedDeclarations.patch",
+    "chromium-156-crubit.patch",
+    "chromium-156-remove-private_verification_tokens.patch",
+    "chromium-156-revert-gn-check-includes.patch",
+    "chromium-156-typescript.patch",
+    "chromium-156-isolatedDeclarations.patch",
     "chromium-155-use-system-esbuild.patch",
 ]
 SPDX-FileCopyrightText = "2015-2026 The ungoogled-chromium Authors"
Risk 3/5 · Elevated chromium-156-crubit.patch
Result #5357

Comment

The patch is a large refactor that removes Rust-based parsing/verification in favor of C++/BoringSSL and also deletes several call sites that previously instantiated web-bundle parsing/validation machinery. I did not find evidence of direct malicious persistence, network access, privilege escalation, or shell execution in the changed patch itself. However, there are a few security-relevant concerns: (1) the new integrity-block parser now hand-parses CBOR and explicitly reconstructs/accepts pre-encoded CBOR from untrusted input, which increases the risk of parser discrepancies or malformed-input handling bugs; (2) the web-package / isolated-web-app changes remove signature-validation and reader creation paths in multiple places, which could be dangerous if these stubs are not compensated elsewhere in the package; and (3) the font-decoding refactor removes IFT patching and switches to a new Rust-backed font-format check, but this appears to be a functional migration rather than an obvious backdoor. Overall I see moderate risk from integrity/validation regressions, but no high-confidence malicious behavior in the patch itself.

@@ -0,0 +1,1277 @@
+--- a/components/cbor/BUILD.gn
++++ b/components/cbor/BUILD.gn
+@@ -12,7 +12,7 @@ buildflag_header("buildflags") {
+   # TODO(crbug.com/535682335): Remove `USE_CBOR_RUST` buildflag entirely,
+   # unconditionally enable Rust CBOR parser, and drop `is_cronet_build` check
+   # once Cronet supports Crubit dependencies.
+-  flags = [ "USE_CBOR_RUST=!$is_cronet_build" ]
++  flags = [ "USE_CBOR_RUST=$enable_cpp_api_from_rust" ]
+ }
+ 
+ source_set("cbor_headers") {
+@@ -48,7 +48,7 @@ source_set("cbor_rust_impl") {
+     "//base",
+   ]
+ 
+-  if (!is_cronet_build) {
++  if (enable_cpp_api_from_rust) {
+     deps += [
+       "//build/rust/crubit",
+       "//components/cbor/rust:cbor_rust_bindings",
+@@ -91,7 +91,7 @@ source_set("unit_tests") {
+     "//testing/gtest",
+     "//third_party/fuzztest",
+   ]
+-  if (!is_cronet_build) {
++  if (enable_cpp_api_from_rust) {
+     deps += [
+       "//components/cbor/rust:cbor_rust_bindings",
+       "//components/cbor/rust:cbor_rust_unittests",
+--- a/components/web_package/BUILD.gn
++++ b/components/web_package/BUILD.gn
+@@ -51,8 +51,6 @@ source_set("web_package_rust_impl") {
+     "//components/base32",
+     "//components/cbor",
+     "//components/web_package/mojom",
+-    "//components/web_package/rust:web_package_rust_bindings",
+-    "//components/web_package/signed_web_bundles/rust:signed_web_bundles_rust_bindings",
+     "//mojo/public/cpp/bindings",
+     "//net",
+     "//services/network/public/mojom",
+@@ -67,12 +65,10 @@ static_library("web_package") {
+     "signed_web_bundles/signed_web_bundle_signature_stack.cc",
+     "signed_web_bundles/signed_web_bundle_signature_stack_entry.cc",
+     "web_bundle_builder.cc",
+-    "web_bundle_parser_factory.cc",
+     "web_bundle_utils.cc",
+   ]
+ 
+   deps = [
+-    ":web_package_rust_impl",
+     "//base",
+     "//components/base32",
+     "//components/cbor",
+@@ -115,7 +111,6 @@ source_set("mojom_mapped_types_rust_impl
+   deps = [
+     ":mojom_mapped_types_headers",
+     "//base",
+-    "//components/web_package/signed_web_bundles/rust:signed_web_bundles_rust_bindings",
+     "//crypto",
+     "//mojo/public/cpp/bindings",
+   ]
+@@ -159,8 +154,6 @@ source_set("unit_tests") {
+     ":web_package",
+     "//base/test:test_support",
+     "//components/cbor",
+-    "//components/web_package/rust:web_package_rust_unittests",
+-    "//components/web_package/signed_web_bundles/rust:signed_web_bundles_rust_unittests",
+     "//components/web_package/test_support",
+     "//mojo/public/cpp/bindings",
+     "//mojo/public/cpp/test_support:test_utils",
+--- a/components/web_package/signed_web_bundles/ecdsa_p256_sha256_signature.cc
++++ b/components/web_package/signed_web_bundles/ecdsa_p256_sha256_signature.cc
+@@ -9,7 +9,8 @@
+ #include "base/strings/stringprintf.h"
+ #include "base/types/expected.h"
+ #include "components/web_package/signed_web_bundles/ecdsa_p256_public_key.h"
+-#include "components/web_package/signed_web_bundles/rust/signed_web_bundles_rust.h"
++#include "crypto/keypair.h"
++#include "crypto/sign.h"
+ 
+ namespace web_package {
+ 
+@@ -50,8 +51,9 @@ EcdsaP256SHA256Signature::EcdsaP256SHA25
+ [[nodiscard]] bool EcdsaP256SHA256Signature::Verify(
+     base::span<const uint8_t> message,
+     const EcdsaP256PublicKey& public_key) const {
+-  return signed_web_bundles::rust::verify_ecdsa_p256_signature(
+-      public_key.bytes(), bytes(), message);
++  auto key = crypto::keypair::PublicKey::FromEcP256Point(public_key.bytes());
++  return crypto::sign::Verify(crypto::sign::ECDSA_SHA256, *key, message,
++                              bytes());
+ }
+ 
+ }  // namespace web_package
+--- a/components/web_package/signed_web_bundles/ed25519_signature.cc
++++ b/components/web_package/signed_web_bundles/ed25519_signature.cc
+@@ -7,7 +7,6 @@
+ #include <algorithm>
+ 
+ #include "base/strings/stringprintf.h"
+-#include "components/web_package/signed_web_bundles/rust/signed_web_bundles_rust.h"
+ #include "third_party/boringssl/src/include/openssl/curve25519.h"
+ 
+ namespace web_package {
+@@ -43,8 +42,11 @@ Ed25519Signature::Ed25519Signature(std::
+ [[nodiscard]] bool Ed25519Signature::Verify(
+     base::span<const uint8_t> message,
+     const Ed25519PublicKey& public_key) const {
+-  return signed_web_bundles::rust::verify_ed25519_signature(public_key.bytes(),
+-                                                            bytes(), message);
++  const std::array<uint8_t, ED25519_PUBLIC_KEY_LEN>& public_key_bytes =
++      public_key.bytes();
++  const std::array<uint8_t, ED25519_SIGNATURE_LEN>& signature_bytes = bytes();
++  return ED25519_verify(message.data(), message.size(), signature_bytes.data(),
++                        public_key_bytes.data());
+ }
+ 
+ }  // namespace web_package
+--- a/components/web_package/signed_web_bundles/integrity_block_parser.cc
++++ b/components/web_package/signed_web_bundles/integrity_block_parser.cc
+@@ -4,17 +4,19 @@
+ 
+ #include "components/web_package/signed_web_bundles/integrity_block_parser.h"
+ 
++#include <algorithm>
+ #include <string>
+-#include <string_view>
+ #include <vector>
+ 
+-#include "base/check.h"
+-#include "base/containers/span.h"
++#include "base/containers/map_util.h"
+ #include "base/functional/bind.h"
+ #include "base/strings/stringprintf.h"
++#include "base/strings/to_string.h"
+ #include "base/types/expected.h"
+ #include "base/types/expected_macros.h"
+ #include "components/cbor/reader.h"
++#include "components/cbor/writer.h"
++#include "components/web_package/mojom/web_bundle_parser.mojom-forward.h"
+ #include "components/web_package/mojom/web_bundle_parser.mojom.h"
+ #include "components/web_package/signed_web_bundles/constants.h"
+ #include "components/web_package/signed_web_bundles/ecdsa_p256_public_key.h"
+@@ -22,56 +24,11 @@
+ #include "components/web_package/signed_web_bundles/ed25519_public_key.h"
+ #include "components/web_package/signed_web_bundles/ed25519_signature.h"
+ #include "components/web_package/signed_web_bundles/integrity_block_attributes.h"
+-#include "components/web_package/signed_web_bundles/rust/signed_web_bundles_rust.h"
+ #include "components/web_package/signed_web_bundles/signed_web_bundle_id.h"
+ #include "components/web_package/signed_web_bundles/types.h"
+ 
+ namespace web_package {
+ 
+-namespace {
+-
+-using SignatureType = signed_web_bundles::rust::SignatureType::Tag;
+-using signed_web_bundles::rust::parse_integrity_block;
+-
+-base::expected<mojom::BundleIntegrityBlockSignatureStackEntryPtr, std::string>
+-CreateSignatureStackEntry(
+-    const signed_web_bundles::rust::SignatureStackEntry& entry) {
+-  auto parsed_sig = mojom::BundleIntegrityBlockSignatureStackEntry::New();
+-
+-  switch (entry.signature_type.tag) {
+-    case SignatureType::Ed25519: {
+-      ASSIGN_OR_RETURN(auto public_key,
+-                       Ed25519PublicKey::Create(entry.public_key.to_span()));
+-      ASSIGN_OR_RETURN(auto signature,
+-                       Ed25519Signature::Create(entry.signature.to_span()));
+-      parsed_sig->signature_info = mojom::SignatureInfo::NewEd25519(
+-          mojom::SignatureInfoEd25519::New(public_key, signature));
+-      break;
+-    }
+-    case SignatureType::EcdsaP256SHA256: {
+-      ASSIGN_OR_RETURN(auto public_key,
+-                       EcdsaP256PublicKey::Create(entry.public_key.to_span()));
+-      ASSIGN_OR_RETURN(auto signature, EcdsaP256SHA256Signature::Create(
+-                                           entry.signature.to_span()));
+-      parsed_sig->signature_info = mojom::SignatureInfo::NewEcdsaP256Sha256(
+-          mojom::SignatureInfoEcdsaP256SHA256::New(public_key, signature));
+-      break;
+-    }
+-    case SignatureType::Unknown: {
+-      parsed_sig->signature_info =
+-          mojom::SignatureInfo::NewUnknown(mojom::SignatureInfoUnknown::New());
+-      break;
+-    }
+-  }
+-
+-  parsed_sig->attributes_cbor =
+-      BinaryData(entry.attributes_cbor.begin(), entry.attributes_cbor.end());
+-
+-  return parsed_sig;
+-}
+-
+-}  // namespace
+-
+ IntegrityBlockParser::IntegrityBlockParser(
+     mojom::BundleDataSource& data_source,
+     WebBundleParser::ParseIntegrityBlockCallback callback)
+@@ -103,37 +60,103 @@ void IntegrityBlockParser::OnIntegrityBl
+     RunErrorCallback("Error reading the integrity block.");
+     return;
+   }
++  // This structure is built during parsing and returned by the final callback
++  mojom::BundleIntegrityBlockPtr integrity_block =
++      mojom::BundleIntegrityBlock::New();
++
++  size_t consumed_bytes = 0;
++  cbor::Reader::DecoderError error;
++  cbor::Reader::Config config;
++  config.num_bytes_consumed = &consumed_bytes;
++  config.error_code_out = &error;
++
++  // When config `bytes_consumed` are assigned the CBOR parser reads only to the
++  // end of a structure. It parses only Integrity Block even if Web Bundle part
++  // starts just after.
++  std::optional<cbor::Value> value = cbor::Reader::Read(*data, config);
++  if (!value) {
++    RunErrorCallback("Error parsing integrity block as CBOR: " +
++                     std::string(cbor::Reader::ErrorCodeToString(error)));
++    return;
++  }
++  integrity_block->size = consumed_bytes;
++
++  if (!value->is_array()) {
++    RunErrorCallback("Integrity block is not a CBOR array.");
++    return;
++  }
+ 
+-  const auto parse_res = parse_integrity_block(*data);
+-  if (!parse_res.has_value()) {
+-    const auto& error = parse_res.error();
+-    RunErrorCallback(std::string(error.message.as_str()),
+-                     error.is_version_error
+-                         ? mojom::BundleParseErrorType::kVersionError
+-                         : mojom::BundleParseErrorType::kFormatError);
++  const cbor::Value::ArrayValue& top_array = value->GetArray();
++  if (top_array.size() != kIntegrityBlockV2TopLevelArrayLength) {
++    RunErrorCallback(base::StringPrintf(
++        "Invalid integrity block array length: expected %u, got %zu.",
++        kIntegrityBlockV2TopLevelArrayLength, top_array.size()));
+     return;
+   }
+ 
+-  const auto& parsed_ib = *parse_res;
+-  auto integrity_block = mojom::BundleIntegrityBlock::New();
+-  integrity_block->size = parsed_ib.size;
+-
+-  const std::string_view web_bundle_id_str =
+-      parsed_ib.web_bundle_id.to_string_view();
+-  RETURN_IF_ERROR(
+-      SignedWebBundleId::Create(web_bundle_id_str),
+-      [&](std::string error) { RunErrorCallback(std::move(error)); });
+-
+-  integrity_block->attributes =
+-      IntegrityBlockAttributes(std::string(web_bundle_id_str),
+-                               BinaryData(parsed_ib.attributes_cbor.begin(),
+-                                          parsed_ib.attributes_cbor.end()));
++  // 1. Magic bytes
++  if (!top_array[0].is_bytestring() ||
++      !std::ranges::equal(top_array[0].GetBytestring(),
++                          kIntegrityBlockMagicBytes)) {
++    RunErrorCallback("Unexpected magic bytes.");
++    return;
++  }
++
++  // 2. Version
++  if (!top_array[1].is_bytestring() ||
++      !std::ranges::equal(top_array[1].GetBytestring(),
++                          kIntegrityBlockV2VersionBytes)) {
++    RunErrorCallback("Unexpected version bytes.",
++                     mojom::BundleParseErrorType::kVersionError);
++    return;
++  }
+ 
+-  for (const auto& entry : parsed_ib.signature_stack) {
++  // 3. Attributes
++  if (!top_array[2].is_map()) {
++    RunErrorCallback("Integrity block attributes must be a map.");
++    return;
++  }
++  const cbor::Value::MapValue& attributes_map = top_array[2].GetMap();
++  const cbor::Value* web_bundle_id =
++      base::FindOrNull(attributes_map, cbor::Value(kWebBundleIdAttributeName));
++  if (!web_bundle_id || !web_bundle_id->is_string()) {
++    RunErrorCallback(
++        "`webBundleId` integrity block attribute is missing or malformed.");
++    return;
++  }
++
++  // Check if web_bundle_id is correct
++  RETURN_IF_ERROR(SignedWebBundleId::Create(web_bundle_id->GetString()),
++                  [&](const std::string& error) { RunErrorCallback(error); });
++
++  BinaryData attributes_cbor = *cbor::Writer::Write(top_array[2]);
++  integrity_block->attributes = IntegrityBlockAttributes(
++      web_bundle_id->GetString(), std::move(attributes_cbor));
++
++  // 4. Signature Stack
++  if (!top_array[3].is_array()) {
++    RunErrorCallback("Signature stack must be an array.");
++    return;
++  }
++  const cbor::Value::ArrayValue& signatures = top_array[3].GetArray();
++  if (signatures.empty()) {
++    RunErrorCallback(
++        "The signature stack must contain at least one signature.");
++    return;
++  }
++
++  for (const auto& signature_info_raw : signatures) {
+     ASSIGN_OR_RETURN(
+-        auto parsed_sig, CreateSignatureStackEntry(entry),
+-        [&](std::string error) { RunErrorCallback(std::move(error)); });
+-    integrity_block->signature_stack.push_back(std::move(parsed_sig));
++        auto parsed_signature_info, ParseSignatureInfo(signature_info_raw),
++        [&](const std::string& error) { this->RunErrorCallback(error); });
++
++    if (integrity_block->signature_stack.empty() &&
++        parsed_signature_info->signature_info->is_unknown()) {
++      RunErrorCallback("Unknown cipher type of the first signature.");
++      return;
++    }
++    integrity_block->signature_stack.push_back(
++        std::move(parsed_signature_info));
+   }
+ 
+   std::move(complete_callback_)
+@@ -141,13 +164,74 @@ void IntegrityBlockParser::OnIntegrityBl
+                           std::move(integrity_block), nullptr));
+ }
+ 
++base::expected<mojom::BundleIntegrityBlockSignatureStackEntryPtr, std::string>
++IntegrityBlockParser::ParseSignatureInfo(
++    const cbor::Value& signature_info_raw) {
++  if (!signature_info_raw.is_array() ||
++      signature_info_raw.GetArray().size() != 2) {
++    return base::unexpected(
++        "Each signature stack entry must contain exactly two elements.");
++  }
++
++  const cbor::Value::ArrayValue& signature_info_array =
++      signature_info_raw.GetArray();
++  if (!signature_info_array[0].is_map() ||
++      !signature_info_array[1].is_bytestring()) {
++    return base::unexpected("Malformed signature stack entry.");
++  }
++
++  mojom::BundleIntegrityBlockSignatureStackEntryPtr parsed_signature_info =
++      mojom::BundleIntegrityBlockSignatureStackEntry::New();
++  parsed_signature_info->attributes_cbor =
++      *cbor::Writer::Write(signature_info_array[0]);
++
++  const cbor::Value::MapValue& signature_attributes =
++      signature_info_array[0].GetMap();
++  const BinaryData& signature_bytes = signature_info_array[1].GetBytestring();
++
++  const cbor::Value* ed25519_key = base::FindOrNull(
++      signature_attributes, cbor::Value(kEd25519PublicKeyAttributeName));
++  const cbor::Value* ecdsa_key = base::FindOrNull(
++      signature_attributes, cbor::Value(kEcdsaP256PublicKeyAttributeName));
++
++  if (ed25519_key && ecdsa_key) {
++    return base::unexpected("Multiple key types for one signature.");
++  } else if (ed25519_key && !ed25519_key->is_bytestring()) {
++    return base::unexpected("Invalid ED25519 key.");
++  } else if (ecdsa_key && !ecdsa_key->is_bytestring()) {
++    return base::unexpected("Invalid ECDSA key.");
++
++  } else if (ed25519_key && ed25519_key->is_bytestring()) {
++    ASSIGN_OR_RETURN(auto public_key,
++                     Ed25519PublicKey::Create(ed25519_key->GetBytestring()));
++    ASSIGN_OR_RETURN(auto signature, Ed25519Signature::Create(signature_bytes));
++    parsed_signature_info->signature_info = mojom::SignatureInfo::NewEd25519(
++        mojom::SignatureInfoEd25519::New(public_key, signature));
++
++  } else if (ecdsa_key && ecdsa_key->is_bytestring()) {
++    ASSIGN_OR_RETURN(auto public_key,
++                     EcdsaP256PublicKey::Create(ecdsa_key->GetBytestring()));
++    ASSIGN_OR_RETURN(auto signature,
++                     EcdsaP256SHA256Signature::Create(signature_bytes));
++    parsed_signature_info->signature_info =
++        mojom::SignatureInfo::NewEcdsaP256Sha256(
++            mojom::SignatureInfoEcdsaP256SHA256::New(public_key, signature));
++
++  } else {
++    parsed_signature_info->signature_info =
++        mojom::SignatureInfo::NewUnknown(mojom::SignatureInfoUnknown::New());
++  }
++
++  return parsed_signature_info;
++}
++
+ void IntegrityBlockParser::RunErrorCallback(
+-    std::string message,
++    const std::string& message,
+     mojom::BundleParseErrorType error_type) {
+   std::move(complete_callback_)
+-      .Run(base::BindOnce(std::move(result_callback_), nullptr,
+-                          mojom::BundleIntegrityBlockParseError::New(
+-                              error_type, std::move(message))));
++      .Run(base::BindOnce(
++          std::move(result_callback_), nullptr,
++          mojom::BundleIntegrityBlockParseError::New(error_type, message)));
+ }
+ 
+ }  // namespace web_package
+--- a/components/web_package/signed_web_bundles/integrity_block_parser.h
++++ b/components/web_package/signed_web_bundles/integrity_block_parser.h
+@@ -5,13 +5,8 @@
+ #ifndef COMPONENTS_WEB_PACKAGE_SIGNED_WEB_BUNDLES_INTEGRITY_BLOCK_PARSER_H_
+ #define COMPONENTS_WEB_PACKAGE_SIGNED_WEB_BUNDLES_INTEGRITY_BLOCK_PARSER_H_
+ 
+-#include <optional>
+-#include <string>
+-
+-#include "base/compiler_specific.h"
+-#include "base/memory/raw_ref.h"
+-#include "base/memory/weak_ptr.h"
+ #include "components/web_package/mojom/web_bundle_parser.mojom-forward.h"
++#include "components/web_package/signed_web_bundles/integrity_block_attributes.h"
+ #include "components/web_package/signed_web_bundles/types.h"
+ #include "components/web_package/web_bundle_parser.h"
+ 
+@@ -20,7 +15,7 @@ namespace web_package {
+ class IntegrityBlockParser : public WebBundleParser::WebBundleSectionParser {
+  public:
+   explicit IntegrityBlockParser(
+-      mojom::BundleDataSource& data_source LIFETIME_BOUND,
++      mojom::BundleDataSource& data_source,
+       WebBundleParser::ParseIntegrityBlockCallback callback);
+ 
+   IntegrityBlockParser(const IntegrityBlockParser&) = delete;
+@@ -35,7 +30,10 @@ class IntegrityBlockParser : public WebB
+  private:
+   void OnIntegrityBlockRead(const std::optional<BinaryData>& data);
+ 
+-  void RunErrorCallback(std::string message,
++  base::expected<mojom::BundleIntegrityBlockSignatureStackEntryPtr, std::string>
++  ParseSignatureInfo(const cbor::Value& attributes_map);
++
++  void RunErrorCallback(const std::string& message,
+                         mojom::BundleParseErrorType error_type =
+                             mojom::BundleParseErrorType::kFormatError);
+ 
+--- a/components/web_package/signed_web_bundles/rust/BUILD.gn
++++ b/components/web_package/signed_web_bundles/rust/BUILD.gn
+@@ -10,7 +10,6 @@ rust_static_library("signed_web_bundles_
+   sources = [
+     "constants.rs",
+     "integrity_block.rs",
+-    "signature_verifier.rs",
+     "types.rs",
+     crate_root,
+   ]
+--- a/components/web_package/signed_web_bundles/signed_web_bundle_signature_verifier.cc
++++ b/components/web_package/signed_web_bundles/signed_web_bundle_signature_verifier.cc
+@@ -20,14 +20,17 @@
+ #include "base/task/thread_pool.h"
+ #include "base/types/expected.h"
+ #include "base/types/expected_macros.h"
++#include "components/cbor/values.h"
++#include "components/cbor/writer.h"
++#include "components/web_package/signed_web_bundles/constants.h"
+ #include "components/web_package/signed_web_bundles/identity_validator.h"
+ #include "components/web_package/signed_web_bundles/integrity_block_parser.h"
+-#include "components/web_package/signed_web_bundles/rust/signed_web_bundles_rust.h"
+ #include "components/web_package/signed_web_bundles/signed_web_bundle_id.h"
+ #include "components/web_package/signed_web_bundles/signed_web_bundle_integrity_block.h"
+ #include "components/web_package/signed_web_bundles/signed_web_bundle_signature_stack.h"
+ #include "components/web_package/signed_web_bundles/signed_web_bundle_signature_stack_entry.h"
+ #include "components/web_package/signed_web_bundles/signed_web_bundle_utils.h"
++#include "crypto/hash.h"
+ #include "third_party/abseil-cpp/absl/functional/overload.h"
+ #include "third_party/boringssl/src/include/openssl/sha.h"
+ 
+@@ -37,10 +40,32 @@ namespace {
+ 
+ std::vector<uint8_t> CreateIntegrityBlockCbor(
+     const SignedWebBundleIntegrityBlock& integrity_block) {
+-  auto ib_cbor_rust =
+-      signed_web_bundles::rust::create_empty_integrity_block_cbor(
+-          integrity_block.attributes_cbor());
+-  return std::vector<uint8_t>(ib_cbor_rust.begin(), ib_cbor_rust.end());
++  // This function looks like it should use a cbor::Value::ArrayValue to build
++  // the outer array, but it can't: one of the elements is a pre-encoded CBOR
++  // value which we can't safely decode because it's untrusted input. This is
++  // obviously undesirable, because there's no guarantee at all that the
++  // pre-encoded value is actually valid CBOR.
++  //
++  // TODO(https://crbug.com/454485901): once there's a memory-safe CBOR parser,
++  // re-parse the pre-encoded value, then re-encode it here instead of
++  // constructing a CBOR array by hand so that we're guaranteed that the result
++  // of this function is valid.
++  std::vector<uint8_t> ib_cbor;
++
++  // 0x84 is the encoding byte for an array of length 4.
++  ib_cbor.push_back(0x84);
++  base::Extend(ib_cbor,
++               *cbor::Writer::Write(cbor::Value(kIntegrityBlockMagicBytes)));
++  base::Extend(ib_cbor, *cbor::Writer::Write(
++                            cbor::Value(kIntegrityBlockV2VersionBytes)));
++  // We cannot parse `attributes().cbor()` back to a cbor::Value as they
++  // technically represent untrusted input.
++  base::Extend(ib_cbor, integrity_block.attributes_cbor());
++  // Encode an empty signature array.
++  base::Extend(ib_cbor,
++               *cbor::Writer::Write(cbor::Value(cbor::Value::ArrayValue())));
++
++  return ib_cbor;
+ }
+ 
+ base::expected<void, SignedWebBundleSignatureVerifier::Error>
+@@ -104,7 +129,7 @@ SignedWebBundleSignatureVerifier::Calcul
+     return base::unexpected(base::File::ErrorToString(file.GetLastFileError()));
+   }
+ 
+-  signed_web_bundles::rust::Sha512Hasher hasher;
++  crypto::hash::Hasher hash(crypto::hash::kSha512);
+ 
+   // Calculate the hash of the Signed Web Bundle excluding its integrity block.
+   // The file might be too big to read it into memory all at once, which is why
+@@ -121,14 +146,15 @@ SignedWebBundleSignatureVerifier::Calcul
+           base::File::ErrorToString(file.GetLastFileError()));
+     }
+     data.resize(*bytes_read);
+-    hasher.update(data);
++    hash.Update(data);
+ 
+     if (!base::CheckAdd(offset, *bytes_read).AssignIfValid(&offset)) {
+       return base::unexpected("The Signed Web Bundle is too large.");
+     }
+   }
+ 
+-  SHA512Digest digest = std::move(hasher).finish();
++  SHA512Digest digest;
++  hash.Finish(digest);
+   return digest;
+ }
+ 
+--- a/components/web_package/signed_web_bundles/signed_web_bundle_utils.cc
++++ b/components/web_package/signed_web_bundles/signed_web_bundle_utils.cc
+@@ -5,18 +5,37 @@
+ #include "components/web_package/signed_web_bundles/signed_web_bundle_utils.h"
+ 
+ #include <cstdint>
+-#include <vector>
+ 
+-#include "components/web_package/signed_web_bundles/rust/signed_web_bundles_rust.h"
++#include "base/containers/extend.h"
++#include "base/containers/span.h"
++#include "base/containers/span_writer.h"
+ 
+ namespace web_package {
+ 
++namespace {
++
++void AddItemToPayload(std::vector<uint8_t>& payload,
++                      base::span<const uint8_t> item) {
++  // Each item that is part of the payload is prefixed with its length encoded
++  // as a 64 bit unsigned integer.
++  std::array<uint8_t, sizeof(uint64_t)> length;
++  auto writer = base::SpanWriter(base::span(length));
++  CHECK(writer.WriteU64BigEndian(item.size()));
++
++  base::Extend(payload, base::span(length));
++  base::Extend(payload, item);
++}
++
++}  // namespace
++
+ std::vector<uint8_t> CreateSignaturePayload(
+     const SignedWebBundleSignatureData& data) {
+-  auto payload_rust = signed_web_bundles::rust::create_signature_payload(
+-      data.unsigned_web_bundle_hash, data.integrity_block_cbor,
+-      data.attributes_cbor);
+-  return std::vector<uint8_t>(payload_rust.begin(), payload_rust.end());
++  std::vector<uint8_t> payload;
++  AddItemToPayload(payload, data.unsigned_web_bundle_hash);
++  AddItemToPayload(payload, data.integrity_block_cbor);
++  AddItemToPayload(payload, data.attributes_cbor);
++
++  return payload;
+ }
+ 
+ }  // namespace web_package
+--- a/components/webapps/isolated_web_apps/bundle_operations/bundle_operations.cc
++++ b/components/webapps/isolated_web_apps/bundle_operations/bundle_operations.cc
+@@ -79,16 +79,7 @@ void ReadSignedWebBundleIdInsecurely(
+     const base::FilePath& path,
+     base::OnceCallback<void(base::expected<web_package::SignedWebBundleId,
+                                            std::string>)> callback) {
+-  UnsecureSignedWebBundleIdReader::GetWebBundleId(
+-      path,
+-      base::BindOnce([](base::expected<web_package::SignedWebBundleId,
+-                                       UnusableSwbnFileError> result) {
+-        return result.transform_error([](const UnusableSwbnFileError& error) {
+-          return "Failed to read the integrity block of the "
+-                 "signed web bundle: " +
+-                 error.message();
+-        });
+-      }).Then(std::move(callback)));
++    std::move(callback);
+ }
+ 
+ void ValidateSignedWebBundleSignatures(
+@@ -96,20 +87,6 @@ void ValidateSignedWebBundleSignatures(
+     const base::FilePath& path,
+     const web_package::SignedWebBundleId& expected_web_bundle_id,
+     base::OnceCallback<void(IntegrityBlockResult)> callback) {
+-  auto create_reader = base::BindOnce(
+-      &SignedWebBundleReader::Create, path,
+-      IwaOrigin(expected_web_bundle_id).origin().GetURL(),
+-      /*verify_signatures=*/true,
+-      base::BindOnce(&OnTrustAndSignaturesOfBundleChecked,
+-                     browser_context->GetWeakPtr(), expected_web_bundle_id,
+-                     std::move(callback)));
+-
+-  if (auto* provider = IwaClient::GetInstance()->GetRuntimeDataProvider()) {
+-    provider->OnBestEffortRuntimeDataReady().Post(FROM_HERE,
+-                                                  std::move(create_reader));
+-  } else {
+-    std::move(create_reader).Run();
+-  }
+ }
+ 
+ void CloseBundle(content::BrowserContext* browser_context,
+--- a/components/webapps/isolated_web_apps/reading/BUILD.gn
++++ b/components/webapps/isolated_web_apps/reading/BUILD.gn
+@@ -14,8 +14,6 @@ source_set("reading") {
+     "response_reader_registry.h",
+     "response_reader_registry_factory.cc",
+     "response_reader_registry_factory.h",
+-    "signed_web_bundle_reader.cc",
+-    "signed_web_bundle_reader.h",
+     "validator.cc",
+     "validator.h",
+   ]
+--- a/components/webapps/isolated_web_apps/reading/response_reader_factory.cc
++++ b/components/webapps/isolated_web_apps/reading/response_reader_factory.cc
+@@ -45,19 +45,6 @@ void IsolatedWebAppResponseReaderFactory
+   DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+   DCHECK(!web_bundle_id.is_for_proxy_mode());
+ 
+-  auto create_reader = base::BindOnce(
+-      &SignedWebBundleReader::Create, web_bundle_path,
+-      IwaOrigin(web_bundle_id).origin().GetURL(), verify_signatures,
+-      base::BindOnce(&IsolatedWebAppResponseReaderFactory::OnReaderCreated,
+-                     weak_ptr_factory_.GetWeakPtr(), web_bundle_path,
+-                     web_bundle_id, std::move(callback)));
+-
+-  if (auto* provider = IwaClient::GetInstance()->GetRuntimeDataProvider()) {
+-    provider->OnBestEffortRuntimeDataReady().Post(FROM_HERE,
+-                                                  std::move(create_reader));
+-  } else {
+-    std::move(create_reader).Run();
+-  }
+ }
+ 
+ void IsolatedWebAppResponseReaderFactory::OnReaderCreated(
+--- a/services/data_decoder/data_decoder_service.cc
++++ b/services/data_decoder/data_decoder_service.cc
+@@ -63,9 +63,6 @@ void DataDecoderService::BindXmlParser(
+ void DataDecoderService::BindWebBundleParserFactory(
+     mojo::PendingReceiver<web_package::mojom::WebBundleParserFactory>
+         receiver) {
+-  mojo::MakeSelfOwnedReceiver(
+-      std::make_unique<web_package::WebBundleParserFactory>(),
+-      std::move(receiver));
+ }
+ 
+ void DataDecoderService::BindGzipper(
+--- a/services/network/web_bundle/web_bundle_url_loader_factory.cc
++++ b/services/network/web_bundle/web_bundle_url_loader_factory.cc
+@@ -586,25 +586,6 @@ bool WebBundleURLLoaderFactory::HasError
+ 
+ void WebBundleURLLoaderFactory::SetBundleStream(
+     mojo::ScopedDataPipeConsumerHandle body) {
+-  if (HasError())
+-    return;
+-  mojo::PendingRemote<web_package::mojom::BundleDataSource> data_source;
+-  source_ = std::make_unique<BundleDataSource>(
+-      data_source.InitWithNewPipeAndPassReceiver(), std::move(body),
+-      std::move(web_bundle_memory_quota_consumer_),
+-      base::BindOnce(&WebBundleURLLoaderFactory::OnMemoryQuotaExceeded,
+-                     weak_ptr_factory_.GetWeakPtr()),
+-      base::BindOnce(&WebBundleURLLoaderFactory::OnDataCompleted,
+-                     weak_ptr_factory_.GetWeakPtr()));
+-
+-  mojo::MakeSelfOwnedReceiver(std::make_unique<web_package::WebBundleParser>(
+-                                  std::move(data_source), bundle_url_),
+-                              parser_.BindNewPipeAndPassReceiver());
+-
+-  parser_->ParseMetadata(
+-      /*offset=*/std::nullopt,
+-      base::BindOnce(&WebBundleURLLoaderFactory::OnMetadataParsed,
+-                     weak_ptr_factory_.GetWeakPtr()));
+ }
+ 
+ mojo::PendingRemote<mojom::URLLoaderClient>
+--- a/third_party/blink/renderer/core/loader/resource/font_resource.cc
++++ b/third_party/blink/renderer/core/loader/resource/font_resource.cc
+@@ -44,7 +44,6 @@
+ #include "third_party/blink/public/mojom/loader/request_context_frame_type.mojom-blink.h"
+ #include "third_party/blink/renderer/platform/fonts/font_custom_platform_data.h"
+ #include "third_party/blink/renderer/platform/fonts/font_platform_data.h"
+-#include "third_party/blink/renderer/platform/fonts/ift/ift_patcher.h"
+ #include "third_party/blink/renderer/platform/fonts/web_font_decoder.h"
+ #include "third_party/blink/renderer/platform/heap/cross_thread_handle.h"
+ #include "third_party/blink/renderer/platform/loader/fetch/fetch_parameters.h"
+@@ -85,7 +84,8 @@ base::expected<DecodedWebFont, String> D
+     return base::unexpected("");
+   }
+   auto decode_start_time = base::TimeTicks::Now();
+-  base::expected<DecodedWebFont, String> result = DecodeWebFont(buffer);
++  base::expected<DecodedWebFont, String> result =
++      DecodedWebFont::Create(buffer);
+   base::UmaHistogramMicrosecondsTimes(
+       "Blink.Fonts.BackgroundDecodeTime",
+       base::TimeTicks::Now() - decode_start_time);
+@@ -316,22 +316,13 @@ const FontCustomPlatformData* FontResour
+         font_data_ = FontCustomPlatformData::Create(
+             std::move(background_decode_result_->sk_typeface),
+             background_decode_result_->decoded_size);
+-        ift_patcher_ = std::move(background_decode_result_->ift_patcher);
+       } else {
+         auto decode_start_time = base::TimeTicks::Now();
+-        base::expected<DecodedWebFont, String> decode_result =
+-            DecodeWebFont(Data());
++        font_data_ =
++            FontCustomPlatformData::Create(Data(), ots_parsing_message_);
+         base::UmaHistogramMicrosecondsTimes(
+             "Blink.Fonts.DecodeTime",
+             base::TimeTicks::Now() - decode_start_time);
+-        if (decode_result.has_value()) {
+-          font_data_ = FontCustomPlatformData::Create(
+-              std::move(decode_result->sk_typeface),
+-              decode_result->decoded_size);
+-          ift_patcher_ = std::move(decode_result->ift_patcher);
+-        } else {
+-          ots_parsing_message_ = std::move(decode_result).error();
+-        }
+       }
+     } else {
+       ots_parsing_message_ = background_decode_result_.error();
+@@ -340,7 +331,6 @@ const FontCustomPlatformData* FontResour
+ 
+   if (!font_data_) {
+     SetStatus(ResourceStatus::kDecodeError);
+-    ift_patcher_.reset();
+   } else {
+     // Call observers once and remove them.
+     HeapHashSet<WeakMember<FontResourceClearDataObserver>> observers;
+@@ -353,10 +343,6 @@ const FontCustomPlatformData* FontResour
+   return font_data_;
+ }
+ 
+-std::unique_ptr<IftPatcher> FontResource::TakeIftPatcher() {
+-  return std::move(ift_patcher_);
+-}
+-
+ void FontResource::WillReloadAfterDiskCacheMiss() {
+   DCHECK(IsLoading());
+   DCHECK(Loader()->IsCacheAwareLoadingActivated());
+--- a/third_party/blink/renderer/core/loader/resource/font_resource.h
++++ b/third_party/blink/renderer/core/loader/resource/font_resource.h
+@@ -47,7 +47,6 @@ class FetchParameters;
+ class ResourceFetcher;
+ class FontCustomPlatformData;
+ class FontResourceClient;
+-class IftPatcher;
+ 
+ // An observer that will be notified when original data is cleared
+ // from the resource. Inspector may collect this data and store it for
+@@ -78,7 +77,6 @@ class CORE_EXPORT FontResource final : p
+   String OtsParsingMessage() const { return ots_parsing_message_; }
+ 
+   const FontCustomPlatformData* GetCustomFontData();
+-  std::unique_ptr<IftPatcher> TakeIftPatcher();
+ 
+   // Returns true if the loading priority of the remote font resource can be
+   // lowered. The loading priority of the font can be lowered only if the
+@@ -127,7 +125,6 @@ class CORE_EXPORT FontResource final : p
+   };
+ 
+   Member<FontCustomPlatformData> font_data_;
+-  std::unique_ptr<IftPatcher> ift_patcher_;
+   String ots_parsing_message_;
+   LoadLimitState load_limit_state_;
+   bool cors_failed_;
+--- a/third_party/blink/renderer/platform/BUILD.gn
++++ b/third_party/blink/renderer/platform/BUILD.gn
+@@ -186,6 +186,18 @@ group("make_platform_generated") {
+   ]
+ }
+ 
++rust_static_library("font_format_check") {
++  allow_unsafe = true  # Needed for FFI that underpins the `cxx` crate.
++  crate_root = "fonts/opentype/format_check.rs"
++  sources = [ crate_root ]
++  cxx_bindings = [ crate_root ]
++  deps = [
++    "//third_party/rust/font_types/v0_12:lib",
++    "//third_party/rust/read_fonts/v0_43:lib",
++    "//third_party/rust/skrifa/v0_46:lib",
++  ]
++}
++
+ rust_static_library("rustfft_ffi") {
+   allow_unsafe = true  # Needed for FFI that underpins the `cxx` crate.
+   crate_root = "audio/rustfft_ffi.rs"
+@@ -253,7 +265,6 @@ group("blink_platform_public_deps") {
+     "//third_party/boringssl",
+     "//third_party/libwebp",
+     "//third_party/ots",
+-    "//third_party/woff2:woff2_dec",
+     "//ui/gfx/animation/keyframe",
+     "//url",
+     "//v8",
+@@ -713,8 +724,6 @@ component("platform") {
+     "fonts/generic_font_family_settings.cc",
+     "fonts/generic_font_family_settings.h",
+     "fonts/glyph_metrics_map.h",
+-    "fonts/ift/ift_patcher.cc",
+-    "fonts/ift/ift_patcher.h",
+     "fonts/opentype/color_table_lookup.cc",
+     "fonts/opentype/color_table_lookup.h",
+     "fonts/opentype/font_format_check.cc",
+@@ -1795,7 +1804,6 @@ component("platform") {
+     ":allow_discouraged_type",
+     ":blink_platform_public_deps",
+     ":platform_export",
+-    "//build/rust/crubit",
+     "//components/language_detection/core",
+     "//gpu/command_buffer/client:raster_interface",
+     "//media/capture:capture_lib",
+@@ -1822,9 +1830,8 @@ component("platform") {
+     "//ui/native_theme/features",
+   ]
+   deps = [
++    ":font_format_check",
+     ":rustfft_ffi",
+-    "fonts:font_format_bindings",
+-    "fonts:ift_patcher_bindings",
+     "//base:base_static",
+     "//base/allocator:buildflags",
+     "//build:chromecast_buildflags",
+--- a/third_party/blink/renderer/platform/fonts/font_custom_platform_data.cc
++++ b/third_party/blink/renderer/platform/fonts/font_custom_platform_data.cc
+@@ -328,7 +328,8 @@ FontCustomPlatformData* FontCustomPlatfo
+     SharedBuffer* buffer,
+     String& ots_parse_message) {
+   DCHECK(buffer);
+-  base::expected<DecodedWebFont, String> decode_result = DecodeWebFont(buffer);
++  base::expected<DecodedWebFont, String> decode_result =
++      DecodedWebFont::Create(buffer);
+   if (!decode_result.has_value()) {
+     ots_parse_message = std::move(decode_result).error();
+     return nullptr;
+--- a/third_party/blink/renderer/platform/fonts/opentype/font_format_check.cc
++++ b/third_party/blink/renderer/platform/fonts/opentype/font_format_check.cc
+@@ -7,6 +7,7 @@
+ #include "base/containers/span.h"
+ #include "base/containers/span_rust.h"
+ #include "base/numerics/byte_conversions.h"
++#include "third_party/blink/renderer/platform/fonts/opentype/format_check.rs.h"
+ #include "third_party/blink/renderer/platform/runtime_enabled_features.h"
+ #include "third_party/blink/renderer/platform/wtf/vector.h"
+ #include "third_party/skia/include/core/SkTypeface.h"
+@@ -14,37 +15,35 @@
+ namespace blink {
+ 
+ FontFormatCheck::FontFormatCheck(sk_sp<SkData> sk_data)
+-    : format_info_(font_format::get_font_format_info(
++    : format_info_(font_format_check::get_font_format_info(
+           base::SpanToRustSlice(sk_data->byteSpan()))) {}
+ 
+-FontFormatCheck::~FontFormatCheck() = default;
+-
+ bool FontFormatCheck::IsVariableFont() const {
+-  return font_format::is_variable(format_info_);
++  return font_format_check::is_variable(*format_info_);
+ }
+ 
+ bool FontFormatCheck::IsCbdtCblcColorFont() const {
+-  return font_format::is_cbdt_cblc(format_info_);
++  return font_format_check::is_cbdt_cblc(*format_info_);
+ }
+ 
+ bool FontFormatCheck::IsEbdtEblcMonochromeFont() const {
+-  return font_format::is_ebdt_eblc(format_info_);
++  return font_format_check::is_ebdt_eblc(*format_info_);
+ }
+ 
+ bool FontFormatCheck::IsColrCpalColorFontV0() const {
+-  return font_format::is_colrv0(format_info_);
++  return font_format_check::is_colrv0(*format_info_);
+ }
+ 
+ bool FontFormatCheck::IsColrCpalColorFontV1() const {
+-  return font_format::is_colrv1(format_info_);
++  return font_format_check::is_colrv1(*format_info_);
+ }
+ 
+ bool FontFormatCheck::IsSbixColorFont() const {
+-  return font_format::is_sbix(format_info_);
++  return font_format_check::is_sbix(*format_info_);
+ }
+ 
+ bool FontFormatCheck::IsCff2OutlineFont() const {
+-  return font_format::is_cff2(format_info_);
++  return font_format_check::is_cff2(*format_info_);
+ }
+ 
+ bool FontFormatCheck::IsVariableColrV0Font() const {
+@@ -58,7 +57,7 @@ bool FontFormatCheck::IsColorFont() cons
+ 
+ bool FontFormatCheck::IsAvar2Font() const {
+   return RuntimeEnabledFeatures::FontFormatAvar2Enabled() &&
+-         font_format::is_avar2(format_info_);
++         font_format_check::is_avar2(*format_info_);
+ }
+ 
+ FontFormatCheck::VariableFontSubType FontFormatCheck::ProbeVariableFont(
+--- a/third_party/blink/renderer/platform/fonts/opentype/font_format_check.h
++++ b/third_party/blink/renderer/platform/fonts/opentype/font_format_check.h
+@@ -5,7 +5,7 @@
+ #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_FONTS_OPENTYPE_FONT_FORMAT_CHECK_H_
+ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_FONTS_OPENTYPE_FONT_FORMAT_CHECK_H_
+ 
+-#include "third_party/blink/renderer/platform/fonts/font_format.h"
++#include "third_party/blink/renderer/platform/fonts/opentype/format_check.rs.h"
+ #include "third_party/blink/renderer/platform/platform_export.h"
+ #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"
+ #include "third_party/skia/include/core/SkData.h"
+@@ -19,7 +19,7 @@ class PLATFORM_EXPORT FontFormatCheck {
+ 
+  public:
+   explicit FontFormatCheck(sk_sp<SkData>);
+-  virtual ~FontFormatCheck();
++  virtual ~FontFormatCheck() = default;
+   virtual bool IsVariableFont() const;
+   virtual bool IsCbdtCblcColorFont() const;
+   virtual bool IsEbdtEblcMonochromeFont() const;
+@@ -46,7 +46,7 @@ class PLATFORM_EXPORT FontFormatCheck {
+   enum class COLRVersion { kCOLRV0, kCOLRV1, kNoCOLR };
+ 
+  private:
+-  font_format::FontFormatInfo format_info_;
++  rust::Box<font_format_check::FontFormatInfo> format_info_;
+ };
+ 
+ }  // namespace blink
+--- a/third_party/blink/renderer/platform/fonts/opentype/format_check.rs
++++ b/third_party/blink/renderer/platform/fonts/opentype/format_check.rs
+@@ -23,7 +23,7 @@ pub struct FontFormatInfo {
+     format_flags: Option<FontFormatFlags>,
+ }
+ 
+-pub fn get_font_format_info(font_bytes: &[u8]) -> FontFormatInfo {
++pub fn get_font_format_info(font_bytes: &[u8]) -> Box<FontFormatInfo> {
+     let file_ref = make_font_ref_internal(font_bytes, 0);
+ 
+     match file_ref {
+@@ -32,11 +32,11 @@ pub fn get_font_format_info(font_bytes:
+                 font.table_directory().table_records().iter().map(|e| e.tag()).collect();
+             let color_version = get_colr_version(&font);
+             let avar_version = get_avar_version(&font);
+-            FontFormatInfo {
++            Box::new(FontFormatInfo {
+                 format_flags: Some(FontFormatFlags { table_tags, color_version, avar_version }),
+-            }
++            })
+         }
+-        _ => FontFormatInfo::default(),
++        _ => Box::new(FontFormatInfo::default()),
+     }
+ }
+ 
+@@ -44,10 +44,10 @@ fn get_colr_version(font_ref: &FontRef)
+     Some(font_ref.colr().ok()?.version())
+ }
+ 
+-pub fn is_colrv1(format_info: &FontFormatInfo) -> bool {
++fn is_colrv1(format_info: &FontFormatInfo) -> bool {
+     matches!(&format_info.format_flags, Some(FontFormatFlags { color_version: Some(1), .. }),)
+ }
+-pub fn is_colrv0(format_info: &FontFormatInfo) -> bool {
++fn is_colrv0(format_info: &FontFormatInfo) -> bool {
+     matches!(&format_info.format_flags, Some(FontFormatFlags { color_version: Some(0), .. }),)
+ }
+ 
+@@ -58,7 +58,7 @@ fn get_avar_version(font_ref: &FontRef)
+ 
+ // https://crbug.com/513446410: For safety we want to pass unknown avar2
+ // versions through fontations, too.
+-pub fn is_avar2(format_info: &FontFormatInfo) -> bool {
++fn is_avar2(format_info: &FontFormatInfo) -> bool {
+     matches!(
+         &format_info.format_flags,
+         Some(FontFormatFlags {
+@@ -77,22 +77,39 @@ fn has_tags(format_info: &FontFormatInfo
+     }
+ }
+ 
+-pub fn is_variable(format_info: &FontFormatInfo) -> bool {
++fn is_variable(format_info: &FontFormatInfo) -> bool {
+     has_tags(format_info, &[Tag::new(b"fvar")])
+ }
+ 
+-pub fn is_sbix(format_info: &FontFormatInfo) -> bool {
++fn is_sbix(format_info: &FontFormatInfo) -> bool {
+     has_tags(format_info, &[Tag::new(b"sbix")])
+ }
+ 
+-pub fn is_cbdt_cblc(format_info: &FontFormatInfo) -> bool {
++fn is_cbdt_cblc(format_info: &FontFormatInfo) -> bool {
+     has_tags(format_info, &[Tag::new(b"CBDT"), Tag::new(b"CBLC")])
+ }
+ 
+-pub fn is_ebdt_eblc(format_info: &FontFormatInfo) -> bool {
++fn is_ebdt_eblc(format_info: &FontFormatInfo) -> bool {
+     has_tags(format_info, &[Tag::new(b"EBDT"), Tag::new(b"EBLC")])
+ }
+ 
+-pub fn is_cff2(format_info: &FontFormatInfo) -> bool {
++fn is_cff2(format_info: &FontFormatInfo) -> bool {
+     has_tags(format_info, &[Tag::new(b"CFF2")])
+ }
++
++#[cxx::bridge(namespace = "font_format_check")]
++pub mod ffi {
++    extern "Rust" {
++        type FontFormatInfo;
++
++        fn get_font_format_info(font_bytes: &[u8]) -> Box<FontFormatInfo>;
++        fn is_colrv1(format_info: &FontFormatInfo) -> bool;
++        fn is_colrv0(format_info: &FontFormatInfo) -> bool;
++        fn is_cbdt_cblc(format_info: &FontFormatInfo) -> bool;
++        fn is_ebdt_eblc(format_info: &FontFormatInfo) -> bool;
++        fn is_variable(format_info: &FontFormatInfo) -> bool;
++        fn is_sbix(format_info: &FontFormatInfo) -> bool;
++        fn is_cff2(format_info: &FontFormatInfo) -> bool;
++        fn is_avar2(format_info: &FontFormatInfo) -> bool;
++    }
++}
+--- a/third_party/blink/renderer/platform/fonts/web_font_decoder.cc
++++ b/third_party/blink/renderer/platform/fonts/web_font_decoder.cc
+@@ -33,27 +33,19 @@
+ #include <hb.h>
+ #include <stdarg.h>
+ 
+-#include <string>
+-
+ #include "base/compiler_specific.h"
+-#include "base/containers/span.h"
+-#include "base/numerics/byte_conversions.h"
+ #include "base/numerics/safe_conversions.h"
+ #include "build/build_config.h"
+ #include "third_party/blink/public/platform/platform.h"
+ #include "third_party/blink/renderer/platform/fonts/font_cache.h"
+-#include "third_party/blink/renderer/platform/fonts/ift/ift_patcher.h"
+ #include "third_party/blink/renderer/platform/fonts/web_font_typeface_factory.h"
+ #include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h"
+-#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
+ #include "third_party/blink/renderer/platform/wtf/shared_buffer.h"
+ #include "third_party/blink/renderer/platform/wtf/text/format.h"
+ #include "third_party/blink/renderer/platform/wtf/text/string_builder.h"
+ #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
+ #include "third_party/ots/src/include/ots-memory-stream.h"
+ #include "third_party/skia/include/core/SkStream.h"
+-#include "third_party/woff2/include/woff2/decode.h"
+-#include "third_party/woff2/include/woff2/output.h"
+ 
+ namespace blink {
+ 
+@@ -65,11 +57,6 @@ const size_t kMaxDecompressedSizeMb = 30
+ const size_t kMaxDecompressedSizeMb = 128;
+ #endif
+ 
+-constexpr size_t kMaxDecompressedSize = kMaxDecompressedSizeMb * 1024 * 1024;
+-
+-constexpr uint32_t kWoffTag = OTS_TAG('w', 'O', 'F', 'F');
+-constexpr uint32_t kWoff2Tag = OTS_TAG('w', 'O', 'F', '2');
+-
+ class BlinkOTSContext final : public ots::OTSContext {
+   DISALLOW_NEW();
+ 
+@@ -189,94 +176,17 @@ ots::TableAction BlinkOTSContext::GetTab
+   }
+ }
+ 
+-struct FontDecodeResult {
+-  std::unique_ptr<IftPatcher> ift_patcher;
+-};
+-
+-// Decompresses and sanitizes `font_data` into an output stream using
+-// `ots_context`, and initializes `ift_patcher` if `font_data` is an IFT-enabled
+-// font. Returns whether decoding succeeded. On failure, the error string can be
+-// retrieved from `ots_context`.
+-bool DecodeFontWithIft(BlinkOTSContext& ots_context,
+-                       base::span<const uint8_t> font_data,
+-                       ots::ExpandingMemoryStream* output,
+-                       std::unique_ptr<IftPatcher>& ift_patcher) {
+-  TRACE_EVENT("blink", "DecodeFont");
+-
+-  uint32_t magic = 0;
+-  if (font_data.size() >= 4) {
+-    magic = base::U32FromBigEndian(font_data.first<4u>());
+-  }
+-
+-  switch (magic) {
+-    case kWoff2Tag: {
+-      size_t decompressed_size =
+-          woff2::ComputeWOFF2FinalSize(font_data.data(), font_data.size());
+-      if (decompressed_size == 0) {
+-        ots_context.Message(0, "Size of decompressed WOFF 2.0 is set to 0");
+-        return false;
+-      }
+-      if (decompressed_size < font_data.size()) {
+-        ots_context.Message(
+-            0, "Size of decompressed WOFF 2.0 is less than compressed size");
+-        return false;
+-      }
+-      if (decompressed_size > kMaxDecompressedSize) {
+-        ots_context.Message(0,
+-                            "Size of decompressed WOFF 2.0 font exceeds %gMB",
+-                            kMaxDecompressedSize / (1024.0 * 1024.0));
+-        return false;
+-      }
+-
+-      std::string buf(decompressed_size, 0);
+-      woff2::WOFF2StringOut out(&buf);
+-      if (!woff2::ConvertWOFF2ToTTF(font_data.data(), font_data.size(), &out)) {
+-        ots_context.Message(0, "Failed to convert WOFF 2.0 font to SFNT");
+-        return false;
+-      }
+-
+-      base::span<const uint8_t> decompressed_span =
+-          base::as_byte_span(buf).first(out.Size());
+-      if (!ots_context.Process(output, decompressed_span.data(),
+-                               decompressed_span.size())) {
+-        return false;
+-      }
+-      ift_patcher = IftPatcher::Create(decompressed_span);
+-      break;
+-    }
+-    case kWoffTag: {
+-      // The IFT (Incremental Font Transfer) specification recommends using
+-      // WOFF2. OTS handles WOFF decompression directly, so we do not extract
+-      // unsanitized font data or create an IftPatcher for the WOFF format.
+-      if (!ots_context.Process(output, font_data.data(), font_data.size())) {
+-        return false;
+-      }
+-      break;
+-    }
+-    default: {
+-      if (!ots_context.Process(output, font_data.data(), font_data.size())) {
+-        return false;
+-      }
+-      ift_patcher = IftPatcher::Create(font_data);
+-      break;
+-    }
+-  }
+-
+-  return true;
+-}
+-
+ }  // namespace
+ 
+-DecodedWebFont::DecodedWebFont() = default;
+-DecodedWebFont::DecodedWebFont(DecodedWebFont&&) noexcept = default;
+-DecodedWebFont& DecodedWebFont::operator=(DecodedWebFont&&) noexcept = default;
+-DecodedWebFont::~DecodedWebFont() = default;
+-
+-base::expected<DecodedWebFont, String> DecodeWebFont(SegmentedBuffer* buffer) {
++base::expected<DecodedWebFont, String> DecodedWebFont::Create(
++    SegmentedBuffer* buffer) {
+   if (!buffer) {
+     return base::unexpected("Empty Buffer");
+   }
+ 
++  // This is the largest web font size which we'll try to transcode.
++  static const size_t kMaxDecompressedSize =
++      kMaxDecompressedSizeMb * 1024 * 1024;
+   if (buffer->size() > kMaxDecompressedSize) {
+     return base::unexpected(
+         Format("Web font size more than {}MB", kMaxDecompressedSizeMb));
+@@ -291,11 +201,7 @@ base::expected<DecodedWebFont, String> D
+   SegmentedBuffer::DeprecatedFlatData flattened_buffer(buffer);
+ 
+   bool ok;
+-  std::unique_ptr<IftPatcher> ift_patcher;
+-  if (RuntimeEnabledFeatures::IncrementalFontTransferEnabled()) {
+-    ok = DecodeFontWithIft(ots_context, base::as_byte_span(flattened_buffer),
+-                           output.get(), ift_patcher);
+-  } else {
++  {
+     TRACE_EVENT("blink", "DecodeFont");
+     ok = ots_context.Process(
+         output.get(), reinterpret_cast<const uint8_t*>(flattened_buffer.data()),
+@@ -307,9 +213,9 @@ base::expected<DecodedWebFont, String> D
+   }
+ 
+   const void* decoded_data = output->get();
+-  DecodedWebFont result;
+-  result.ift_patcher = std::move(ift_patcher);
+-  result.decoded_size = base::checked_cast<size_t>(output->Tell());
++  DecodedWebFont result{
++      .decoded_size = base::checked_cast<size_t>(output->Tell()),
++  };
+   sk_sp<SkData> sk_data = SkData::MakeWithProc(
+       decoded_data, result.decoded_size,
+       [](const void*, void* output) {
+--- a/third_party/blink/renderer/platform/fonts/web_font_decoder.h
++++ b/third_party/blink/renderer/platform/fonts/web_font_decoder.h
+@@ -31,8 +31,6 @@
+ #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_FONTS_WEB_FONT_DECODER_H_
+ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_FONTS_WEB_FONT_DECODER_H_
+ 
+-#include <memory>
+-
+ #include "base/types/expected.h"
+ #include "third_party/blink/renderer/platform/platform_export.h"
+ #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
+@@ -42,7 +40,6 @@ class SkTypeface;
+ 
+ namespace blink {
+ 
+-class IftPatcher;
+ class SegmentedBuffer;
+ 
+ // Represents a font that has been successfully decoded and sanitized.
+@@ -56,32 +53,18 @@ struct PLATFORM_EXPORT DecodedWebFont {
+   // The size of the font after decoding and sanitizing.
+   size_t decoded_size = 0;
+ 
+-  // Used to discover and apply patches to fonts. `nullptr` if the font is not
+-  // IFT-encoded or if Incremental Font Transfer is disabled.
+-  std::unique_ptr<IftPatcher> ift_patcher;
+-
+-  // Defined out of line so that `IftPatcher` only needs to be forward declared
+-  // here.
+-  DecodedWebFont();
+-  DecodedWebFont(DecodedWebFont&&) noexcept;
+-  DecodedWebFont& operator=(DecodedWebFont&&) noexcept;
+-  DecodedWebFont(const DecodedWebFont&) = delete;
+-  DecodedWebFont& operator=(const DecodedWebFont&) = delete;
+-  ~DecodedWebFont();
++  // Decodes, decompresses, and sanitizes the raw font data from the provided
++  // `buffer` (which typically contains WOFF, WOFF2, or TTF data).
++  //
++  // Returns:
++  // - On success: A `DecodedWebFont` containing the successfully created
++  //   font.
++  // - On failure: A `String` containing a descriptive error message (e.g., if
++  //   the buffer is empty, the decompressed size exceeds limits, or OTS
++  //   validation fails).
++  static base::expected<DecodedWebFont, String> Create(SegmentedBuffer*);
+ };
+ 
+-// Decodes, decompresses, and sanitizes the raw font data from the provided
+-// `buffer` (which typically contains WOFF, WOFF2, or TTF data).
+-//
+-// Returns:
+-// - On success: A `DecodedWebFont` containing the successfully created
+-//   font.
+-// - On failure: A `String` containing a descriptive error message (e.g., if
+-//   the buffer is empty, the decompressed size exceeds limits, or OTS
+-//   validation fails).
+-PLATFORM_EXPORT base::expected<DecodedWebFont, String> DecodeWebFont(
+-    SegmentedBuffer* buffer);
+-
+ }  // namespace blink
+ 
+ #endif  // THIRD_PARTY_BLINK_RENDERER_PLATFORM_FONTS_WEB_FONT_DECODER_H_
Risk 0/5 · Safe chromium-156-isolatedDeclarations.patch
Result #5358

Comment

The patch is limited to TypeScript type-annotation adjustments and a few enum-to-string substitutions in Chromium DevTools/BiDi sources. I do not see any added build-time execution, network access, persistence mechanism, privilege escalation, or packaging/install-script changes. The only potentially noteworthy change is replacing imported protocol enum constants with string literals and a couple of `as any` casts, but this appears to be a compatibility/type-checking workaround rather than a security-relevant behavior change. No malicious payload or integrity risk is evident in the provided hunk.

@@ -0,0 +1,125 @@
+--- a/third_party/devtools-frontend/src/front_end/core/host/DispatchHttpRequestClient.ts
++++ b/third_party/devtools-frontend/src/front_end/core/host/DispatchHttpRequestClient.ts
+@@ -14,7 +14,7 @@ export enum ErrorType {
+ }
+ 
+ export class DispatchHttpRequestError extends Error {
+-  constructor(readonly type: ErrorType, readonly response?: DispatchHttpRequestResult, options?: ErrorOptions) {
++  constructor(readonly type: ErrorType, readonly response?: DispatchHttpRequestResult | undefined, options?: ErrorOptions) {
+     super(undefined, options);
+   }
+ }
+--- a/third_party/devtools-frontend/src/front_end/ui/legacy/ARIAUtils.ts
++++ b/third_party/devtools-frontend/src/front_end/ui/legacy/ARIAUtils.ts
+@@ -420,7 +420,7 @@ export class LiveAnnouncer {
+     element.textContent = Platform.StringUtilities.trimEndWithMaxLength(announcedMessage, 10000);
+   }
+ 
+-  static getOrCreateAnnouncerElement(container: HTMLElement = document.body, role: AnnouncerRole, opts?: {
++  static getOrCreateAnnouncerElement(container: undefined | HTMLElement = document.body, role: AnnouncerRole, opts?: {
+     force: boolean,
+   }): HTMLElement {
+     const existingAnnouncerElement = LiveAnnouncer.#announcerElementsByRole[role].get(container);
+--- a/third_party/devtools-frontend/src/front_end/ui/legacy/Widget.ts
++++ b/third_party/devtools-frontend/src/front_end/ui/legacy/Widget.ts
+@@ -84,7 +84,7 @@ export type WidgetFactory<WidgetT extend
+ export type InferWidgetTFromFactory<F> = F extends WidgetFactory<infer WidgetT>? WidgetT : never;
+ 
+ export class WidgetConfig<WidgetT extends AnyWidget> {
+-  constructor(readonly widgetClass: WidgetFactory<WidgetT>, readonly widgetParams?: Partial<WidgetT>) {
++  constructor(readonly widgetClass: WidgetFactory<WidgetT>, readonly widgetParams?: Partial<WidgetT> | undefined) {
+   }
+ }
+ 
+--- a/third_party/chromium-bidi/src/bidiMapper/CommandProcessor.ts
++++ b/third_party/chromium-bidi/src/bidiMapper/CommandProcessor.ts
+@@ -101,3 +101,3 @@
+     userContextStorage: UserContextStorage,
+-    parser: BidiCommandParameterParser = new BidiNoOpParser(),
++    parser: undefined | BidiCommandParameterParser = new BidiNoOpParser(),
+     initConnection: (options: MapperOptions) => Promise<void>,
+--- a/third_party/chromium-bidi/src/bidiMapper/modules/script/ChannelProxy.ts
++++ b/third_party/chromium-bidi/src/bidiMapper/modules/script/ChannelProxy.ts
+@@ -16,7 +16,7 @@
+  *
+  */
+ 
+-import {Protocol} from 'devtools-protocol';
++// import {Protocol} from 'devtools-protocol';
+ 
+ import {ChromiumBidi, Script} from '../../../protocol/protocol.js';
+ import {LogType, type LoggerFn} from '../../../utils/log.js';
+@@ -118,7 +118,7 @@
+         contextId: realm.executionContextId,
+         serializationOptions: {
+           serialization:
+-            Protocol.Runtime.SerializationOptionsSerialization.IdOnly,
++            'idOnly',
+         },
+       },
+     );
+@@ -148,7 +148,7 @@
+         executionContextId: realm.executionContextId,
+         serializationOptions: {
+           serialization:
+-            Protocol.Runtime.SerializationOptionsSerialization.IdOnly,
++            'idOnly',
+         },
+       },
+     );
+@@ -181,7 +181,7 @@
+             executionContextId: realm.executionContextId,
+             serializationOptions: {
+               serialization:
+-                Protocol.Runtime.SerializationOptionsSerialization.Deep,
++                'deep',
+               maxDepth:
+                 this.#properties.serializationOptions?.maxObjectDepth ??
+                 undefined,
+@@ -254,7 +254,7 @@
+         awaitPromise: true,
+         serializationOptions: {
+           serialization:
+-            Protocol.Runtime.SerializationOptionsSerialization.IdOnly,
++            'idOnly',
+         },
+       },
+     );
+--- a/third_party/chromium-bidi/src/bidiMapper/modules/script/Realm.ts
++++ b/third_party/chromium-bidi/src/bidiMapper/modules/script/Realm.ts
+@@ -13,7 +13,7 @@
+  * See the License for the specific language governing permissions and
+  * limitations under the License.
+  */
+-import {Protocol} from 'devtools-protocol';
++import type {Protocol} from 'devtools-protocol';
+ 
+ import type {CdpClient} from '../../../cdp/CdpClient.js';
+ import {
+@@ -215,7 +215,7 @@
+         expression,
+         awaitPromise,
+         serializationOptions: Realm.#getSerializationOptions(
+-          Protocol.Runtime.SerializationOptionsSerialization.Deep,
++          'deep' as any,
+           serializationOptions,
+         ),
+         userGesture: userActivation,
+@@ -279,7 +279,7 @@
+         arguments: [argument],
+         serializationOptions: {
+           serialization:
+-            Protocol.Runtime.SerializationOptionsSerialization.Deep,
++            'deep',
+         },
+         executionContextId: this.executionContextId,
+       });
+@@ -419,7 +419,7 @@
+           awaitPromise,
+           arguments: thisAndArgumentsList,
+           serializationOptions: Realm.#getSerializationOptions(
+-            Protocol.Runtime.SerializationOptionsSerialization.Deep,
++            'deep' as any,
+             serializationOptions,
+           ),
+           executionContextId: this.executionContextId,
Risk 0/5 · Safe chromium-156-remove-private_verification_tokens.patch
Result #5359

Comment

This patch removes all Chromium private_verification_tokens integration points from the ungoogled-chromium build, including browser services, DevTools storage handlers, browsing-data deletion hooks, component updater registration, and related test/build dependencies. The change is effectively a feature excision, not an addition of new executable behavior. I do not see any new network fetches, privilege changes, persistence mechanisms, or suspicious code paths introduced by this diff. The main security impact is that token-related storage/cleanup APIs become no-ops, which is a functional regression but not a security vulnerability in the package itself.

@@ -0,0 +1,592 @@
+--- a/chrome/browser/BUILD.gn
++++ b/chrome/browser/BUILD.gn
+@@ -1016,7 +1016,6 @@ source_set("core") {
+     "//chrome/browser/preloading/search_preload:feature",
+     "//chrome/browser/privacy_sandbox:headers",
+     "//chrome/browser/private_ai",
+-    "//chrome/browser/private_verification_tokens",
+     "//chrome/browser/profiles:misc",
+     "//chrome/browser/profiles:profile_io_data",
+     "//chrome/browser/profiles:profiles_extra_parts",
+@@ -2248,7 +2247,6 @@ source_set("browser") {
+     "//chrome/browser/preloading/search_preload",
+     "//chrome/browser/privacy",
+     "//chrome/browser/privacy_sandbox:impl",
+-    "//chrome/browser/private_verification_tokens",
+     "//chrome/browser/profiles:misc",
+     "//chrome/browser/profiles:profile_util_impl",
+     "//chrome/browser/profiles:profiles_extra_parts_impl",
+--- a/chrome/browser/browsing_data/BUILD.gn
++++ b/chrome/browser/browsing_data/BUILD.gn
+@@ -125,7 +125,6 @@ source_set("impl") {
+     "//chrome/browser/preloading/prefetch/no_state_prefetch",
+     "//chrome/browser/preloading/prefetch/search_prefetch",
+     "//chrome/browser/privacy_sandbox:headers",
+-    "//chrome/browser/private_verification_tokens",
+     "//chrome/browser/profiles/keep_alive",
+     "//chrome/browser/reading_list",
+     "//chrome/browser/safe_browsing",
+@@ -269,7 +268,6 @@ source_set("unit_tests") {
+     "//chrome/browser/payments/browser_binding:browser_bound_key_deleter",
+     "//chrome/browser/payments/browser_binding:test_support",
+     "//chrome/browser/permissions",
+-    "//chrome/browser/private_verification_tokens",
+     "//chrome/browser/reading_list",
+     "//chrome/browser/safe_browsing:verdict_cache_manager_factory",
+     "//chrome/browser/segmentation_platform",
+@@ -298,7 +296,6 @@ source_set("unit_tests") {
+     "//components/privacy_sandbox:privacy_sandbox_settings_headers",
+     "//components/privacy_sandbox/privacy_sandbox_attestations",
+     "//components/privacy_sandbox/privacy_sandbox_attestations:test_support",
+-    "//components/private_verification_tokens/common:private_verification_tokens_database",
+     "//components/reading_list/core:test_support",
+     "//components/safe_browsing/core/browser:suspicious_site_warning_allowlist",
+     "//components/safe_browsing/core/browser:verdict_cache_manager",
+--- a/chrome/browser/browsing_data/chrome_browsing_data_model_delegate.cc
++++ b/chrome/browser/browsing_data/chrome_browsing_data_model_delegate.cc
+@@ -127,15 +127,6 @@ void ChromeBrowsingDataModelDelegate::Ge
+ 
+   GetAllMediaDeviceSaltDataKeys(concurrent.CreateCallback(), {});
+ 
+-  if (base::FeatureList::IsEnabled(
+-          net::features::kEnablePrivateVerificationTokens)) {
+-    if (auto* pvt_service =
+-            PrivateVerificationTokensServiceFactory::GetForProfile(profile_)) {
+-      pvt_service->GetTokenIssuers(
+-          base::BindOnce(&PrivateVerificationTokenBrowsingDataToDelegateEntries)
+-              .Then(concurrent.CreateCallback()));
+-    }
+-  }
+ 
+   // TODO(crbug.com/40205603): Implement data retrieval for remaining data
+   // types.
+@@ -180,20 +171,6 @@ void ChromeBrowsingDataModelDelegate::Re
+   }
+ #endif  // !BUILDFLAG(IS_ANDROID)
+ 
+-  if (base::FeatureList::IsEnabled(
+-          net::features::kEnablePrivateVerificationTokens) &&
+-      storage_types.Has(static_cast<BrowsingDataModel::StorageType>(
+-          StorageType::kPrivateVerificationTokens))) {
+-    if (const url::Origin* origin = std::get_if<url::Origin>(&data_key)) {
+-      if (auto* pvt_service =
+-              PrivateVerificationTokensServiceFactory::GetForProfile(
+-                  profile_)) {
+-        pvt_service->DeleteTokens(base::Time(), base::Time::Max(),
+-                                  concurrent.CreateClosure(),
+-                                  std::vector<url::Origin>{*origin});
+-      }
+-    }
+-  }
+ 
+   std::move(concurrent).Done(std::move(callback));
+ }
+--- a/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc
++++ b/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc
+@@ -726,29 +726,6 @@ void ChromeBrowsingDataRemoverDelegate::
+ #endif  // BUILDFLAG(IS_CHROMEOS)
+   }
+ 
+-  //////////////////////////////////////////////////////////////////////////////
+-  // DATA_TYPE_PRIVATE_VERIFICATION_TOKENS
+-  if (remove_mask & constants::DATA_TYPE_PRIVATE_VERIFICATION_TOKENS) {
+-    if (base::FeatureList::IsEnabled(
+-            net::features::kEnablePrivateVerificationTokens)) {
+-      if (auto* pvt_service =
+-              PrivateVerificationTokensServiceFactory::GetForProfile(
+-                  profile_)) {
+-        auto done_closure = CreateTaskCompletionClosure(
+-            TracingDataType::kPrivateVerificationTokens);
+-
+-        if (filter_builder->MatchesAllOriginsAndDomains()) {
+-          pvt_service->DeleteTokens(delete_begin_, delete_end_,
+-                                    std::move(done_closure),
+-                                    /*issuers=*/std::nullopt);
+-        } else {
+-          pvt_service->DeleteTokensByFilter(
+-              delete_begin_, delete_end_,
+-              filter_builder->BuildStorageKeyFilter(), std::move(done_closure));
+-        }
+-      }
+-    }
+-  }
+ 
+   //////////////////////////////////////////////////////////////////////////////
+   // DATA_TYPE_CONTENT_SETTINGS
+--- a/chrome/browser/chrome_content_browser_client.cc
++++ b/chrome/browser/chrome_content_browser_client.cc
+@@ -6193,21 +6193,6 @@ ChromeContentBrowserClient::CreateURLLoa
+     result.push_back(std::move(signin_throttle));
+   }
+ 
+-  if (base::FeatureList::IsEnabled(
+-          net::features::kEnablePrivateVerificationTokens) &&
+-      request.is_outermost_main_frame) {
+-    if (auto* pvt_service =
+-            PrivateVerificationTokensServiceFactory::GetForProfile(profile)) {
+-      auto url_loader_factory = profile->GetDefaultStoragePartition()
+-                                    ->GetURLLoaderFactoryForBrowserProcess();
+-      if (auto pvt_throttle =
+-              PrivateVerificationTokensURLLoaderThrottle::Create(
+-                  pvt_service, profile->GetWeakPtr(),
+-                  std::move(url_loader_factory))) {
+-        result.push_back(std::move(pvt_throttle));
+-      }
+-    }
+-  }
+ 
+   if (auto contextual_tasks_throttle =
+           contextual_tasks::ContextualTasksURLLoaderThrottle::MaybeCreate(
+--- a/chrome/browser/component_updater/BUILD.gn
++++ b/chrome/browser/component_updater/BUILD.gn
+@@ -151,7 +151,6 @@ source_set("impl") {
+     "//chrome/browser/net",
+     "//chrome/browser/page_load_metrics",
+     "//chrome/browser/permissions",
+-    "//chrome/browser/private_verification_tokens",
+     "//chrome/browser/profiles:profile",
+     "//chrome/browser/update_client",
+     "//chrome/common",
+@@ -167,7 +166,6 @@ source_set("impl") {
+     "//components/permissions",
+     "//components/privacy_sandbox:features",
+     "//components/privacy_sandbox/privacy_sandbox_attestations",
+-    "//components/private_verification_tokens/common:private_verification_tokens_issuer_config",
+     "//components/safe_browsing/core/common:features",
+     "//components/search",
+     "//components/security_interstitials/content:security_interstitial_page",
+--- a/chrome/browser/component_updater/private_verification_tokens_installer.cc
++++ b/chrome/browser/component_updater/private_verification_tokens_installer.cc
+@@ -25,32 +25,6 @@ namespace component_updater {
+ 
+ void RegisterPrivateVerificationTokensComponentIfEnabled(
+     ComponentUpdateService* cus) {
+-  if (!base::FeatureList::IsEnabled(
+-          net::features::kEnablePrivateVerificationTokens)) {
+-    return;
+-  }
+-
+-  auto installer = base::MakeRefCounted<ComponentInstaller>(
+-      std::make_unique<PrivateVerificationTokensInstallerPolicy>(
+-          base::BindRepeating(
+-              [](scoped_refptr<private_verification_tokens::
+-                                   PrivateVerificationTokensIssuerConfig>
+-                     issuer_config) {
+-                PrivateVerificationTokensServiceFactory::SetGlobalIssuerConfig(
+-                    issuer_config);
+-                if (g_browser_process && g_browser_process->profile_manager()) {
+-                  for (Profile* profile : g_browser_process->profile_manager()
+-                                              ->GetLoadedProfiles()) {
+-                    if (PrivateVerificationTokensService* service =
+-                            PrivateVerificationTokensServiceFactory::
+-                                GetForProfileIfExists(profile)) {
+-                      service->SetIssuerConfig(issuer_config);
+-                    }
+-                  }
+-                }
+-              })));
+-
+-  installer->Register(cus, base::OnceClosure());
+ }
+ 
+ }  // namespace component_updater
+--- a/chrome/browser/devtools/BUILD.gn
++++ b/chrome/browser/devtools/BUILD.gn
+@@ -433,7 +433,6 @@ static_library("devtools") {
+       "//chrome/app:command_ids",
+       "//chrome/browser/badging",
+       "//chrome/browser/custom_handlers",
+-      "//chrome/browser/private_verification_tokens",
+       "//chrome/browser/ui:browser_window_header",
+       "//chrome/browser/ui/media_router",
+       "//chrome/browser/ui/startup",
+@@ -446,7 +445,6 @@ static_library("devtools") {
+       "//components/origin_gating/core",
+       "//components/payments/content",
+       "//components/privacy_sandbox/privacy_sandbox_attestations",
+-      "//components/private_verification_tokens/common:private_verification_tokens_database",
+       "//components/security_state/content",
+       "//components/subresource_filter/content/browser",
+       "//components/web_package",
+@@ -672,7 +670,6 @@ if (enable_devtools_frontend) {
+       "//chrome/browser/prefs:util",
+       "//chrome/browser/preloading:prefs",
+       "//chrome/browser/preloading:test_support",
+-      "//chrome/browser/private_verification_tokens",
+       "//chrome/browser/search_engines",
+       "//chrome/browser/sync/test/integration:sync_integration_test_support",
+       "//chrome/browser/ui/autofill",
+@@ -683,7 +680,6 @@ if (enable_devtools_frontend) {
+       "//components/infobars/content",
+       "//components/javascript_dialogs",
+       "//components/language/core/browser",
+-      "//components/private_verification_tokens/common:private_verification_tokens_token",
+       "//components/ukm:test_support",
+       "//content/test:test_support",
+       "//testing/gtest",
+--- a/chrome/browser/devtools/protocol/storage_handler.cc
++++ b/chrome/browser/devtools/protocol/storage_handler.cc
+@@ -9,38 +9,11 @@
+ #include <utility>
+ #include <vector>
+ 
+-#include "base/base64.h"
+ #include "base/check.h"
+-#include "base/strings/string_number_conversions.h"
+-#include "chrome/browser/browser_process.h"
+ #include "chrome/browser/devtools/protocol/protocol.h"
+ #include "chrome/browser/devtools/protocol/storage.h"
+-#include "chrome/browser/private_verification_tokens/private_verification_tokens_service.h"
+-#include "chrome/browser/private_verification_tokens/private_verification_tokens_service_factory.h"
+-#include "chrome/browser/profiles/profile.h"
+-#include "chrome/browser/profiles/profile_manager.h"
+-#include "components/private_verification_tokens/common/private_verification_tokens_database.h"
+ #include "content/public/browser/btm_service.h"
+ #include "content/public/browser/web_contents.h"
+-#include "url/gurl.h"
+-#include "url/origin.h"
+-
+-namespace {
+-
+-PrivateVerificationTokensService* GetPrivateVerificationTokensService(
+-    content::WebContents* web_contents) {
+-  if (!web_contents) {
+-    return nullptr;
+-  }
+-  Profile* profile =
+-      Profile::FromBrowserContext(web_contents->GetBrowserContext());
+-  if (!profile) {
+-    return nullptr;
+-  }
+-  return PrivateVerificationTokensServiceFactory::GetForProfile(profile);
+-}
+-
+-}  // namespace
+ 
+ StorageHandler::StorageHandler(content::WebContents* web_contents,
+                                protocol::UberDispatcher* dispatcher)
+@@ -53,7 +26,6 @@
+ StorageHandler::~StorageHandler() = default;
+ 
+ protocol::Response StorageHandler::Disable() {
+-  pvt_observation_.Reset();
+   return protocol::Response::FallThrough();
+ }
+ 
+@@ -85,149 +57,32 @@
+ 
+ void StorageHandler::GetPrivateVerificationTokens(
+     std::unique_ptr<GetPrivateVerificationTokensCallback> callback) {
+-  PrivateVerificationTokensService* pvt_service =
+-      GetPrivateVerificationTokensService(web_contents_.get());
+-  if (!pvt_service) {
+-    callback->sendFailure(protocol::Response::ServerError(
+-        "Private Verification Tokens service is not available"));
+-    return;
+-  }
+-
+-  pvt_service->GetAllTokens(base::BindOnce(
+-      [](std::unique_ptr<GetPrivateVerificationTokensCallback> callback,
+-         std::vector<private_verification_tokens::TokenWithId> tokens) {
+-        auto result = std::make_unique<
+-            protocol::Array<protocol::Storage::PrivateVerificationToken>>();
+-        for (const auto& item : tokens) {
+-          result->push_back(
+-              protocol::Storage::PrivateVerificationToken::Create()
+-                  .SetId(base::NumberToString(item.id))
+-                  .SetIssuerOrigin(item.token.issuer().Serialize())
+-                  .SetKeyId(static_cast<int>(item.token.key_id()))
+-                  .SetExpiration(
+-                      item.token.expiration().InSecondsFSinceUnixEpoch())
+-                  .SetCreationTime(
+-                      item.token.creation_time().InSecondsFSinceUnixEpoch())
+-                  .SetVersion(static_cast<int>(item.token.version()))
+-                  .SetToken(base::Base64Encode(item.token.token()))
+-                  .Build());
+-        }
+-        callback->sendSuccess(std::move(result));
+-      },
+-      std::move(callback)));
++  callback->sendSuccess(
++      std::make_unique<protocol::Array<protocol::Storage::PrivateVerificationToken>>());
+ }
+ 
+ protocol::Response StorageHandler::GetPrivateVerificationTokensIssuerConfigs(
+     std::unique_ptr<protocol::Array<
+         protocol::Storage::PrivateVerificationTokensIssuerConfig>>*
+         out_configs) {
+-  PrivateVerificationTokensService* pvt_service =
+-      GetPrivateVerificationTokensService(web_contents_.get());
+-  if (!pvt_service) {
+-    return protocol::Response::ServerError(
+-        "Private Verification Tokens service is not available");
+-  }
+-
+-  auto configs = std::make_unique<protocol::Array<
+-      protocol::Storage::PrivateVerificationTokensIssuerConfig>>();
+-  scoped_refptr<
+-      const private_verification_tokens::PrivateVerificationTokensIssuerConfig>
+-      issuer_config = pvt_service->issuer_config();
+-  if (issuer_config) {
+-    for (const auto& [issuer_origin, config] : issuer_config->config()) {
+-      auto redeemer_origins =
+-          std::make_unique<protocol::Array<protocol::String>>();
+-      for (const url::Origin& redeemer : config.redeemers) {
+-        redeemer_origins->push_back(redeemer.Serialize());
+-      }
+-      configs->push_back(
+-          protocol::Storage::PrivateVerificationTokensIssuerConfig::Create()
+-              .SetIssuerOrigin(issuer_origin.Serialize())
+-              .SetRedeemerOrigins(std::move(redeemer_origins))
+-              .Build());
+-    }
+-  }
+-
+-  *out_configs = std::move(configs);
+-  return protocol::Response::Success();
++  *out_configs = std::make_unique<
++      protocol::Array<protocol::Storage::PrivateVerificationTokensIssuerConfig>>();
++  return protocol::Response::Success();
+ }
+ 
+ void StorageHandler::ClearPrivateVerificationTokens(
+     const std::string& in_issuerOrigin,
+     std::unique_ptr<ClearPrivateVerificationTokensCallback> callback) {
+-  PrivateVerificationTokensService* pvt_service =
+-      GetPrivateVerificationTokensService(web_contents_.get());
+-  if (!pvt_service) {
+-    callback->sendFailure(protocol::Response::ServerError(
+-        "Private Verification Tokens service is not available"));
+-    return;
+-  }
+-
+-  url::Origin issuer_origin = url::Origin::Create(GURL(in_issuerOrigin));
+-  if (issuer_origin.opaque()) {
+-    callback->sendFailure(
+-        protocol::Response::InvalidParams("Invalid issuer origin"));
+-    return;
+-  }
+-
+-  pvt_service->DeleteTokens(
+-      base::Time::Min(), base::Time::Max(),
+-      base::BindOnce(&ClearPrivateVerificationTokensCallback::sendSuccess,
+-                     std::move(callback)),
+-      std::vector<url::Origin>{issuer_origin});
++  callback->sendSuccess();
+ }
+ 
+ void StorageHandler::DeletePrivateVerificationToken(
+     const std::string& in_tokenId,
+     std::unique_ptr<DeletePrivateVerificationTokenCallback> callback) {
+-  PrivateVerificationTokensService* pvt_service =
+-      GetPrivateVerificationTokensService(web_contents_.get());
+-  if (!pvt_service) {
+-    callback->sendFailure(protocol::Response::ServerError(
+-        "Private Verification Tokens service is not available"));
+-    return;
+-  }
+-
+-  int64_t token_id = 0;
+-  if (!base::StringToInt64(in_tokenId, &token_id)) {
+-    callback->sendFailure(
+-        protocol::Response::InvalidParams("Invalid token ID"));
+-    return;
+-  }
+-
+-  pvt_service->DeleteToken(
+-      token_id,
+-      base::BindOnce(&DeletePrivateVerificationTokenCallback::sendSuccess,
+-                     std::move(callback)));
++  callback->sendSuccess();
+ }
+ 
+ protocol::Response StorageHandler::SetPrivateVerificationTokensTracking(
+     bool enable) {
+-  PrivateVerificationTokensService* pvt_service =
+-      GetPrivateVerificationTokensService(web_contents_.get());
+-  if (!pvt_service) {
+-    return protocol::Response::ServerError(
+-        "Private Verification Tokens service is not available");
+-  }
+-
+-  if (enable) {
+-    if (!pvt_observation_.IsObserving()) {
+-      pvt_observation_.Observe(pvt_service);
+-    }
+-  } else {
+-    pvt_observation_.Reset();
+-  }
+   return protocol::Response::Success();
+ }
+-
+-void StorageHandler::OnTokensStored() {
+-  frontend_->PrivateVerificationTokensUpdated();
+-}
+-
+-void StorageHandler::OnTokensDeleted() {
+-  frontend_->PrivateVerificationTokensUpdated();
+-}
+-
+-void StorageHandler::OnShutdown() {
+-  pvt_observation_.Reset();
+-}
+--- a/chrome/browser/devtools/protocol/storage_handler.h
++++ b/chrome/browser/devtools/protocol/storage_handler.h
+@@ -10,17 +10,14 @@
+ #include <vector>
+ 
+ #include "base/memory/weak_ptr.h"
+-#include "base/scoped_observation.h"
+ #include "chrome/browser/devtools/protocol/protocol.h"
+ #include "chrome/browser/devtools/protocol/storage.h"
+-#include "chrome/browser/private_verification_tokens/private_verification_tokens_service.h"
+ 
+ namespace content {
+ class WebContents;
+ }  // namespace content
+ 
+-class StorageHandler : public protocol::Storage::Backend,
+-                       public PrivateVerificationTokensService::Observer {
++class StorageHandler : public protocol::Storage::Backend {
+  public:
+   StorageHandler(content::WebContents* web_contents,
+                  protocol::UberDispatcher* dispatcher);
+@@ -52,20 +49,12 @@
+       override;
+   protocol::Response SetPrivateVerificationTokensTracking(bool enable) override;
+ 
+-  // PrivateVerificationTokensService::Observer:
+-  void OnTokensStored() override;
+-  void OnTokensDeleted() override;
+-  void OnShutdown() override;
+-
+   static void GotDeletedSites(
+       std::unique_ptr<RunBounceTrackingMitigationsCallback> callback,
+       const std::vector<std::string>& sites);
+ 
+   base::WeakPtr<content::WebContents> web_contents_;
+   std::unique_ptr<protocol::Storage::Frontend> frontend_;
+-  base::ScopedObservation<PrivateVerificationTokensService,
+-                          PrivateVerificationTokensService::Observer>
+-      pvt_observation_{this};
+ };
+ 
+ #endif  // CHROME_BROWSER_DEVTOOLS_PROTOCOL_STORAGE_HANDLER_H_
+--- a/chrome/browser/private_verification_tokens/BUILD.gn
++++ b/chrome/browser/private_verification_tokens/BUILD.gn
+@@ -8,9 +8,7 @@ static_library("private_verification_tok
+     "//chrome/browser:*",
+     "//chrome/browser/browsing_data:*",
+     "//chrome/browser/component_updater:*",
+-    "//chrome/browser/devtools:*",
+     "//chrome/browser/profiles:profiles_extra_parts_impl",
+-    "//chrome/test:*",
+   ]
+ 
+   sources = [
+@@ -28,12 +26,6 @@ static_library("private_verification_tok
+     "//chrome/browser/profiles:profile",
+     "//components/content_settings/core/browser",
+     "//components/keyed_service/core",
+-    "//components/private_verification_tokens/common:privacy_pass_athm_batch_request",
+-    "//components/private_verification_tokens/common:private_verification_tokens_fetcher",
+-    "//components/private_verification_tokens/common:private_verification_tokens_issuer_config",
+-    "//components/private_verification_tokens/common:private_verification_tokens_metrics",
+-    "//components/private_verification_tokens/common:private_verification_tokens_parameters",
+-    "//components/private_verification_tokens/common:private_verification_tokens_store",
+     "//content/public/browser",
+     "//net",
+     "//services/network/public/cpp",
+@@ -53,10 +45,6 @@ source_set("browser_tests") {
+     "//chrome/test:test_support",
+     "//chrome/test/base:chrome_test_utils",
+     "//components/content_settings/core/common",
+-    "//components/private_verification_tokens/common:private_verification_tokens_database",
+-    "//components/private_verification_tokens/common:private_verification_tokens_issuer_config",
+-    "//components/private_verification_tokens/common:test_support",
+-    "//components/private_verification_tokens/common/athm_ffi:athm_ffi_bindings",
+     "//net:test_support",
+     "//services/network:test_support",
+     "//url",
+@@ -77,13 +65,6 @@ source_set("unit_tests") {
+     "//chrome/test:test_support",
+     "//components/content_settings/core/browser",
+     "//components/content_settings/core/common",
+-    "//components/private_verification_tokens/common:privacy_pass_athm_batch_request",
+-    "//components/private_verification_tokens/common:private_verification_tokens_database",
+-    "//components/private_verification_tokens/common:private_verification_tokens_issuer_config",
+-    "//components/private_verification_tokens/common:private_verification_tokens_metrics",
+-    "//components/private_verification_tokens/common:private_verification_tokens_parameters",
+-    "//components/private_verification_tokens/common:test_support",
+-    "//components/private_verification_tokens/common/athm_ffi:athm_ffi_bindings",
+     "//content/test:test_support",
+     "//net",
+     "//services/network:test_support",
+--- a/chrome/browser/profiles/BUILD.gn
++++ b/chrome/browser/profiles/BUILD.gn
+@@ -811,7 +811,6 @@ source_set("profiles_extra_parts_impl")
+     "//chrome/browser/privacy_sandbox:headers",
+     "//chrome/browser/private_ai",
+     "//chrome/browser/private_insights",
+-    "//chrome/browser/private_verification_tokens",
+     "//chrome/browser/push_messaging",
+     "//chrome/browser/reading_list",
+     "//chrome/browser/reduce_accept_language",
+--- a/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc
++++ b/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc
+@@ -1360,7 +1360,6 @@ void ChromeBrowserMainExtraPartsProfiles
+   PrivacyMetricsServiceFactory::GetInstance();
+   PrivacySandboxServiceFactory::GetInstance();
+   PrivacySandboxSettingsFactory::GetInstance();
+-  PrivateVerificationTokensServiceFactory::GetInstance();
+   private_ai::PrivateAiServiceFactory::GetInstance();
+   ProfileNetworkContextServiceFactory::GetInstance();
+   ProfilePasswordStoreFactory::GetInstance();
+--- a/chrome/test/BUILD.gn
++++ b/chrome/test/BUILD.gn
+@@ -1869,8 +1869,6 @@ if (!is_android) {
+       "//chrome/browser/privacy_sandbox:headers",
+       "//chrome/browser/privacy_sandbox:test_support",
+       "//chrome/browser/private_ai",
+-      "//chrome/browser/private_verification_tokens",
+-      "//chrome/browser/private_verification_tokens:browser_tests",
+       "//chrome/browser/profile_resetter",
+       "//chrome/browser/profile_resetter:browser_tests",
+       "//chrome/browser/profiles",
+@@ -5043,7 +5041,6 @@ test("unit_tests") {
+     "//chrome/browser/preloading/prerender:unit_tests",
+     "//chrome/browser/privacy_sandbox:unit_tests",
+     "//chrome/browser/private_ai:unit_tests",
+-    "//chrome/browser/private_verification_tokens:unit_tests",
+     "//chrome/browser/profiles",
+     "//chrome/browser/profiles:misc",
+     "//chrome/browser/profiles:profile_downloader",
+--- a/components/BUILD.gn
++++ b/components/BUILD.gn
+@@ -313,7 +313,6 @@ test("components_unittests") {
+     "//components/power_metrics:unit_tests",
+     "//components/prefs:unit_tests",
+     "//components/privacy_sandbox:unit_tests",
+-    "//components/private_verification_tokens:unit_tests",
+     "//components/profile_metrics:unit_tests",
+     "//components/proto_extras:unit_tests",
+     "//components/proxy_config:unit_tests",
+--- a/components/component_updater/installer_policies/BUILD.gn
++++ b/components/component_updater/installer_policies/BUILD.gn
+@@ -38,7 +38,6 @@ static_library("installer_policies_no_co
+     "//components/lookalikes/core:proto",
+     "//components/lookalikes/core:safety_tips",
+     "//components/prefs",
+-    "//components/private_verification_tokens/common:private_verification_tokens_issuer_config",
+     "//components/update_client",
+     "//mojo/public/cpp/base:protobuf_support",
+     "//services/network/public/cpp",
+@@ -106,8 +105,6 @@ source_set("unit_tests") {
+     "//components/history_embeddings/core",
+     "//components/optimization_guide/core",
+     "//components/optimization_guide/proto:optimization_guide_proto",
+-    "//components/private_verification_tokens/common:private_verification_tokens_issuer_config",
+-    "//components/private_verification_tokens/common:test_support",
+     "//mojo/public/cpp/base:protobuf_support",
+     "//services/network/public/cpp",
+     "//testing/gmock",
Risk 1/5 · Low chromium-156-revert-gn-check-includes.patch
Result #5360

Comment

This patch is a large revert of GN include-strictness checks across many Chromium targets, plus removal of the supporting constant from build/strict_deps_failures.gni. It does not introduce executable code, network access, privilege escalation, or packaging-time persistence mechanisms. The main effect is weakening build-time include hygiene/strict-deps enforcement, which can hide dependency mistakes and reduce defense against accidental header coupling, but that is a build-quality regression rather than a direct security issue in the package artifacts themselves. I did not see any suspicious sources, scripts, or install-time behavior in the provided diff.

@@ -0,0 +1,610 @@
+--- a/.gn
++++ b/.gn
+@@ -469,10 +469,3 @@ expand_directory_allowlist =
+       "//components/policy/BUILD.gn",
+     ]
+ 
+-# Entries in the allowlist should have a justification for why we need them. New
+-# entries should in this list should be reviewed by a member of the chrome build
+-# team.
+-# entries in this list should be reviewed by a member of the chrome build team.
+-allow_circular_includes_from_allowlist =
+-    allow_circular_includes_from_untriaged + project_bedrock_circular_includes +
+-    []
+--- a/base/allocator/partition_allocator/src/partition_alloc/BUILD.gn
++++ b/base/allocator/partition_allocator/src/partition_alloc/BUILD.gn
+@@ -289,7 +289,6 @@ component("raw_ptr") {
+   configs -= partition_alloc_remove_configs
+   configs += partition_alloc_add_configs
+   configs += [ ":dependants_extra_warnings" ]
+-  check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+ }
+ 
+ if (is_clang_or_gcc) {
+--- a/base/numerics/BUILD.gn
++++ b/base/numerics/BUILD.gn
+@@ -30,7 +30,6 @@ source_set("numerics") {
+     "safe_math.h",
+     "wrapping_math.h",
+   ]
+-  check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+ }
+ 
+ source_set("unittests") {
+--- a/build/rust/rust_bindgen_generator.gni
++++ b/build/rust/rust_bindgen_generator.gni
+@@ -101,7 +101,6 @@ template("rust_bindgen_generator") {
+     # script's args and are populated using deps and configs.
+     forward_variables_from(invoker,
+                            TESTONLY_AND_VISIBILITY + [
+-                                 "check_includes_strict",
+                                  "configs",
+                                  "deps",
+                                  "public_configs",
+--- a/build/strict_deps_failures.gni
++++ b/build/strict_deps_failures.gni
+@@ -10,16 +10,8 @@
+ 
+ # TODO(crbug.com/555455099): Remove this once we've finished the migration and
+ # have no remaining usages.
+-# Set this flag when check_includes_strict is failing for a reason that hasn't
+-# been triaged yet.
+ CHECK_INCLUDES_STRICT_UNTRIAGED = false
+ 
+-# TODO(crbug.com/555455099): Remove this once we've finished the migration and
+-# have no remaining usages.
+-# Set this when check_includes_strict is failing due to public headers including
+-# private headers.
+-CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE = false
+-
+ # A list of directories for which strict_deps is enabled.
+ CHECK_INCLUDES_STRICT_ALLOWLIST = [
+   # keep-sorted: start
+--- a/chrome/browser/default_browser/BUILD.gn
++++ b/chrome/browser/default_browser/BUILD.gn
+@@ -70,7 +70,6 @@ source_set("default_browser") {
+   } else {
+     sources += [ "default_browser_monitor_stub.cc" ]
+   }
+-  check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+ }
+ 
+ source_set("test_support") {
+--- a/chrome/browser/media/prefs/BUILD.gn
++++ b/chrome/browser/media/prefs/BUILD.gn
+@@ -33,7 +33,6 @@ source_set("prefs") {
+     "//base",
+     "//chrome/common:constants",
+   ]
+-  check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+ }
+ 
+ source_set("unit_tests") {
+--- a/chrome/browser/preloading/search_preload/BUILD.gn
++++ b/chrome/browser/preloading/search_preload/BUILD.gn
+@@ -35,7 +35,6 @@ source_set("search_preload") {
+     "//components/pref_registry",
+     "//components/search_engines",
+   ]
+-  check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+ }
+ 
+ source_set("feature") {
+--- a/chrome/browser/shortcuts/BUILD.gn
++++ b/chrome/browser/shortcuts/BUILD.gn
+@@ -86,7 +86,6 @@ source_set("shortcuts") {
+     ]
+     deps += [ "//chrome/browser:shell_integration_linux" ]
+   }
+-  check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+ }
+ 
+ source_set("test_support") {
+--- a/chrome/browser/sync_file_system/BUILD.gn
++++ b/chrome/browser/sync_file_system/BUILD.gn
+@@ -158,7 +158,6 @@ source_set("sync_file_system") {
+     "//third_party/leveldatabase",
+     "//url",
+   ]
+-  check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+ }
+ 
+ source_set("test_support") {
+--- a/chrome/browser/ui/lens/BUILD.gn
++++ b/chrome/browser/ui/lens/BUILD.gn
+@@ -183,7 +183,6 @@ if (!is_android) {
+         "//pdf/mojom",
+       ]
+     }
+-    check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+   }
+ 
+   source_set("impl") {
+--- a/chrome/browser/ui/page_action/BUILD.gn
++++ b/chrome/browser/ui/page_action/BUILD.gn
+@@ -50,7 +50,6 @@ if (!is_android) {
+       "//ui/actions:actions_headers",
+       "//ui/base",
+     ]
+-    check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+   }
+ 
+   source_set("page_action_impl") {
+--- a/chrome/browser/ui/startup/default_browser_prompt/BUILD.gn
++++ b/chrome/browser/ui/startup/default_browser_prompt/BUILD.gn
+@@ -45,7 +45,6 @@ source_set("default_browser_prompt") {
+   ]
+ 
+   deps = [ "//chrome/browser/default_browser" ]
+-  check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+ }
+ 
+ source_set("impl") {
+--- a/chrome/browser/web_applications/locks/BUILD.gn
++++ b/chrome/browser/web_applications/locks/BUILD.gn
+@@ -16,7 +16,6 @@ source_set("partitioned_lock_manager") {
+     "partitioned_lock_manager.cc",
+   ]
+   public_deps = [ "//base" ]
+-  check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+ }
+ 
+ source_set("partitioned_lock_manager_unit_tests") {
+--- a/chrome/services/system_signals/BUILD.gn
++++ b/chrome/services/system_signals/BUILD.gn
+@@ -52,7 +52,6 @@ source_set("system_signals") {
+ 
+     deps += [ "//components/device_signals/core/system_signals/posix" ]
+   }
+-  check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+ }
+ 
+ source_set("unit_tests") {
+--- a/components/bookmarks/browser/BUILD.gn
++++ b/components/bookmarks/browser/BUILD.gn
+@@ -109,7 +109,6 @@ static_library("browser") {
+   if (is_ios) {
+     sources += [ "bookmark_node_data_ios.cc" ]
+   }
+-  check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+ }
+ 
+ static_library("test_support") {
+--- a/components/feed/core/v2/BUILD.gn
++++ b/components/feed/core/v2/BUILD.gn
+@@ -148,7 +148,6 @@ if (use_blink) {
+       "//components/feed/core/proto:proto_ios_shared_v2",
+       "//components/feed/core/proto:proto_v2",
+     ]
+-    check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+   }
+ 
+   source_set("test_helpers") {
+--- a/components/global_media_controls/BUILD.gn
++++ b/components/global_media_controls/BUILD.gn
+@@ -92,7 +92,6 @@ component("global_media_controls") {
+   # TODO(crbug.com/40031409): Fix code that adds exit-time destructors and
+   # enable the diagnostic by removing this line.
+   configs += [ "//build/config/compiler:no_exit_time_destructors" ]
+-  check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+ }
+ 
+ source_set("unit_tests") {
+--- a/components/metrics/BUILD.gn
++++ b/components/metrics/BUILD.gn
+@@ -390,7 +390,6 @@ if (!is_cronet_build || is_ios) {
+         "motherboard_metrics_provider.h",
+       ]
+     }
+-    check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+   }
+ 
+   static_library("test_support") {
+--- a/components/persistent_cache/BUILD.gn
++++ b/components/persistent_cache/BUILD.gn
+@@ -62,7 +62,6 @@ component("persistent_cache") {
+     ":test_support",
+     ":unit_tests",
+   ]
+-  check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+ }
+ 
+ static_library("test_support") {
+--- a/components/sqlite_vfs/BUILD.gn
++++ b/components/sqlite_vfs/BUILD.gn
+@@ -58,7 +58,6 @@ component("sqlite_vfs") {
+   }
+ 
+   defines = [ "IS_SQLITE_VFS_IMPL" ]
+-  check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+ }
+ 
+ if (use_blink && !is_android) {
+--- a/content/browser/indexed_db/BUILD.gn
++++ b/content/browser/indexed_db/BUILD.gn
+@@ -125,7 +125,6 @@ source_set("indexed_db") {
+     ":*",
+     "//content/test/*",
+   ]
+-  check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+ }
+ 
+ source_set("indexed_db_fuzzer_support") {
+--- a/content/public/common/BUILD.gn
++++ b/content/public/common/BUILD.gn
+@@ -48,7 +48,6 @@ component("result_codes") {
+   deps = [ "//base" ]
+ 
+   configs += [ "//content:content_implementation" ]
+-  check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+ }
+ 
+ # This target allows other targets to depend on content_descriptors.h which is
+@@ -108,7 +107,6 @@ source_set("static_switches") {
+     "//media:media_buildflags",
+     "//tools/v8_context_snapshot:buildflags",
+   ]
+-  check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+ }
+ 
+ # This target allowing depending on content_switches without depending on the
+@@ -135,7 +133,6 @@ source_set("switches") {
+   if (enable_ipc_fuzzer) {
+     configs += [ "//tools/ipc_fuzzer:ipc_fuzzer_config" ]
+   }
+-  check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+ }
+ 
+ # This target allows you to use the content MainFunctionParams struct and
+@@ -151,7 +148,6 @@ source_set("static_main_function_params"
+   public_deps = [ "//base" ]
+ 
+   public_configs = [ ":static_switches_defines" ]
+-  check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+ }
+ 
+ # Target for depending on main_function_params.h. This can be included without
+@@ -168,7 +164,6 @@ component("main_function_params") {
+   deps = [ "//base" ]
+ 
+   configs += [ "//content:content_implementation" ]
+-  check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+ }
+ 
+ source_set("memory_consumer_update") {
+--- a/device/bluetooth/public/cpp/BUILD.gn
++++ b/device/bluetooth/public/cpp/BUILD.gn
+@@ -21,5 +21,4 @@ component("features") {
+   ]
+   deps = [ "//base" ]
+   defines = [ "BLUETOOTH_FEATURES_IMPLEMENTATION" ]
+-  check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+ }
+--- a/device/gamepad/public/cpp/BUILD.gn
++++ b/device/gamepad/public/cpp/BUILD.gn
+@@ -57,5 +57,4 @@ component("switches") {
+   ]
+   public_deps = [ "//base" ]
+   defines = [ "GAMEPAD_FEATURES_IMPLEMENTATION" ]
+-  check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+ }
+--- a/mojo/core/BUILD.gn
++++ b/mojo/core/BUILD.gn
+@@ -148,7 +148,6 @@ source_set("impl_for_embedder") {
+     configs -= [ "//build/config/compiler:default_optimization" ]
+     configs += [ "//build/config/compiler:optimize_max" ]
+   }
+-  check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+ }
+ 
+ source_set("driver_for_ipcz_tests") {
+--- a/pdf/BUILD.gn
++++ b/pdf/BUILD.gn
+@@ -460,7 +460,6 @@ if (enable_pdf) {
+       "//ui/gfx/range",
+       "//v8",
+     ]
+-    check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+   }
+ 
+   source_set("pdf_test_utils") {
+--- a/remoting/proto/BUILD.gn
++++ b/remoting/proto/BUILD.gn
+@@ -62,7 +62,6 @@ source_set("internal_structs") {
+   # TODO(crbug.com/40031409): Fix code that adds exit-time destructors and
+   # enable the diagnostic by removing this line.
+   configs += [ "//build/config/compiler:no_exit_time_destructors" ]
+-  check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+ }
+ 
+ source_set("internal_stubs") {
+--- a/services/device/public/cpp/BUILD.gn
++++ b/services/device/public/cpp/BUILD.gn
+@@ -29,7 +29,6 @@ component("device_features") {
+       "//services/device/public/java:device_feature_list_jni",
+     ]
+   }
+-  check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+ }
+ 
+ source_set("test_support") {
+--- a/skia/BUILD.gn
++++ b/skia/BUILD.gn
+@@ -632,7 +632,6 @@ component("skia") {
+   # TODO(crbug.com/40031409): Fix code that adds exit-time destructors and
+   # enable the diagnostic by removing this line.
+   configs += [ "//build/config/compiler:no_exit_time_destructors" ]
+-  check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+ }
+ 
+ component("skia_switches") {
+--- a/third_party/abseil-cpp/absl/container/BUILD.gn
++++ b/third_party/abseil-cpp/absl/container/BUILD.gn
+@@ -753,7 +753,6 @@ absl_source_set("btree") {
+     "//third_party/abseil-cpp/absl/strings:string_view",
+     "//third_party/abseil-cpp/absl/types:compare",
+   ]
+-  check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+ }
+ 
+ absl_source_set("btree_test_common") {
+@@ -864,7 +863,6 @@ absl_source_set("chunked_queue") {
+     "//third_party/abseil-cpp/absl/base:hardening",
+     "//third_party/abseil-cpp/absl/base:iterator_traits_internal",
+   ]
+-  check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+ }
+ 
+ absl_test("chunked_queue_test") {
+--- a/third_party/abseil-cpp/absl/crc/BUILD.gn
++++ b/third_party/abseil-cpp/absl/crc/BUILD.gn
+@@ -53,7 +53,6 @@ absl_source_set("crc32c") {
+     "//third_party/abseil-cpp/absl/strings:str_format",
+     "//third_party/abseil-cpp/absl/strings:string_view",
+   ]
+-  check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+ }
+ 
+ absl_test("crc32c_test") {
+--- a/third_party/abseil-cpp/absl/functional/BUILD.gn
++++ b/third_party/abseil-cpp/absl/functional/BUILD.gn
+@@ -16,7 +16,6 @@ absl_source_set("any_invocable") {
+     "//third_party/abseil-cpp/absl/meta:type_traits",
+     "//third_party/abseil-cpp/absl/utility",
+   ]
+-  check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+ }
+ 
+ absl_test("any_invocable_test") {
+@@ -46,7 +45,6 @@ absl_source_set("bind_back") {
+     "//third_party/abseil-cpp/absl/container:compressed_tuple",
+     "//third_party/abseil-cpp/absl/utility",
+   ]
+-  check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+ }
+ 
+ absl_test("bind_back_test") {
+@@ -66,7 +64,6 @@ absl_source_set("bind_front") {
+     "//third_party/abseil-cpp/absl/meta:type_traits",
+     "//third_party/abseil-cpp/absl/utility",
+   ]
+-  check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+ }
+ 
+ absl_test("bind_front_test") {
+@@ -87,7 +84,6 @@ absl_source_set("function_ref") {
+     "//third_party/abseil-cpp/absl/meta:type_traits",
+     "//third_party/abseil-cpp/absl/utility",
+   ]
+-  check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+ }
+ 
+ absl_test("function_ref_test") {
+--- a/third_party/abseil-cpp/absl/hash/BUILD.gn
++++ b/third_party/abseil-cpp/absl/hash/BUILD.gn
+@@ -29,7 +29,6 @@ absl_source_set("hash") {
+     "//third_party/abseil-cpp/absl/types:variant",
+     "//third_party/abseil-cpp/absl/utility",
+   ]
+-  check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+ }
+ 
+ absl_source_set("hash_testing") {
+--- a/third_party/abseil-cpp/absl/status/BUILD.gn
++++ b/third_party/abseil-cpp/absl/status/BUILD.gn
+@@ -41,7 +41,6 @@ absl_source_set("status") {
+     "//third_party/abseil-cpp/absl/types:source_location",
+     "//third_party/abseil-cpp/absl/types:span",
+   ]
+-  check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+ }
+ 
+ absl_test("status_test") {
+@@ -79,7 +78,6 @@ absl_source_set("statusor") {
+     "//third_party/abseil-cpp/absl/types:variant",
+     "//third_party/abseil-cpp/absl/utility",
+   ]
+-  check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+ }
+ 
+ absl_test("statusor_test") {
+@@ -174,7 +172,6 @@ absl_source_set("status_matchers") {
+     "//third_party/googletest:gmock",
+     "//third_party/googletest:gtest",
+   ]
+-  check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+ }
+ 
+ absl_test("status_matchers_test") {
+--- a/third_party/abseil-cpp/absl/strings/BUILD.gn
++++ b/third_party/abseil-cpp/absl/strings/BUILD.gn
+@@ -85,7 +85,6 @@ absl_source_set("strings") {
+     # :string_view.
+     ":string_view",
+   ]
+-  check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+ }
+ 
+ absl_source_set("internal") {
+@@ -434,7 +433,6 @@ absl_source_set("cord") {
+     "//third_party/abseil-cpp/absl/types:optional",
+     "//third_party/abseil-cpp/absl/types:span",
+   ]
+-  check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+ }
+ 
+ absl_source_set("cordz_handle") {
+@@ -1022,7 +1020,6 @@ absl_source_set("generic_printer") {
+     "//third_party/abseil-cpp/absl/log/internal:container",
+     "//third_party/abseil-cpp/absl/meta:requires",
+   ]
+-  check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+ }
+ 
+ absl_test("generic_printer_test") {
+--- a/third_party/abseil-cpp/absl/types/BUILD.gn
++++ b/third_party/abseil-cpp/absl/types/BUILD.gn
+@@ -47,7 +47,6 @@ absl_source_set("span") {
+     "//third_party/abseil-cpp/absl/hash:weakly_mixed_integer",
+     "//third_party/abseil-cpp/absl/meta:type_traits",
+   ]
+-  check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+ }
+ 
+ absl_test("span_test") {
+@@ -78,7 +77,6 @@ absl_source_set("any_span") {
+     "//third_party/abseil-cpp/absl/base:throw_delegate",
+     "//third_party/abseil-cpp/absl/meta:type_traits",
+   ]
+-  check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+ }
+ 
+ # any_span_test is not ported because relies on RTTI
+--- a/third_party/federated_compute/BUILD.gn
++++ b/third_party/federated_compute/BUILD.gn
+@@ -328,7 +328,6 @@ source_set("fl_runner") {
+     "//third_party/protobuf:timestamp_proto",
+     "//third_party/re2",
+   ]
+-  check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+ }
+ 
+ source_set("confidential_compute_crypto_test_util") {
+--- a/third_party/harfbuzz/BUILD.gn
++++ b/third_party/harfbuzz/BUILD.gn
+@@ -23,7 +23,6 @@ if (use_system_harfbuzz) {
+ 
+   component("harfbuzz") {
+     public_configs = [ ":harfbuzz_from_pkgconfig" ]
+-    check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+   }
+ } else {
+   import("//build/rust/cargo_crate.gni")
+@@ -39,7 +38,6 @@ if (use_system_harfbuzz) {
+       "no-doc-comments",
+     ]
+     configs = [ ":harfbuzz_config" ]
+-    check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+   }
+ 
+   cargo_crate("harfbuzz_rust") {
+@@ -576,7 +574,6 @@ if (use_system_harfbuzz) {
+       public += [ "src/src/hb-glib.h" ]
+       sources += [ "src/src/hb-glib.cc" ]
+     }
+-    check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+   }
+ }
+ 
+--- a/third_party/ipcz/src/BUILD.gn
++++ b/third_party/ipcz/src/BUILD.gn
+@@ -97,7 +97,6 @@ source_set("reference_drivers") {
+   if (is_fuchsia) {
+     public_deps += [ "//third_party/fuchsia-sdk/sdk/pkg/zx" ]
+   }
+-  check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+ }
+ 
+ source_set("util") {
+@@ -215,7 +214,6 @@ source_set("impl") {
+   ]
+   public_configs = [ ":ipcz_include_dir" ]
+   configs += [ ":ipcz_include_src_dir" ]
+-  check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+ }
+ 
+ source_set("ipcz_sources") {
+--- a/third_party/private-join-and-compute/src/BUILD.gn
++++ b/third_party/private-join-and-compute/src/BUILD.gn
+@@ -61,5 +61,4 @@ component("ec_commutative_cipher") {
+   ]
+ 
+   public_configs = [ ":private_join_and_compute_config" ]
+-  check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+ }
+--- a/third_party/sqlite/BUILD.gn
++++ b/third_party/sqlite/BUILD.gn
+@@ -260,7 +260,6 @@ component("chromium_sqlite3") {
+   }
+ 
+   deps = [ "//third_party/icu" ]
+-  check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+ }
+ 
+ # Similar to component("chromium_sqlite") above, but uses the developer tools
+@@ -340,7 +339,6 @@ source_set("dev_sqlite3") {
+   }
+ 
+   deps = [ "//third_party/icu" ]
+-  check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+ }
+ 
+ config("sqlite_export") {
+--- a/ui/aura/BUILD.gn
++++ b/ui/aura/BUILD.gn
+@@ -175,7 +175,6 @@ component("aura") {
+     public += [ "screen_ozone.h" ]
+     sources += [ "screen_ozone.cc" ]
+   }
+-  check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+ }
+ 
+ static_library("test_support") {
+--- a/ui/events/BUILD.gn
++++ b/ui/events/BUILD.gn
+@@ -37,7 +37,6 @@ static_library("dom_keycode_converter")
+   if (!is_ios) {
+     deps += [ "//ipc:param_traits" ]
+   }
+-  check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+ }
+ 
+ static_library("dom_keyboard_layout") {
+--- a/ui/gl/init/BUILD.gn
++++ b/ui/gl/init/BUILD.gn
+@@ -78,5 +78,4 @@ component("init") {
+       "gl_initializer_ios.cc",
+     ]
+   }
+-  check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+ }
+--- a/ui/views/BUILD.gn
++++ b/ui/views/BUILD.gn
+@@ -1042,7 +1042,6 @@ component("views") {
+   if (use_ozone) {
+     deps += [ "//ui/ozone" ]
+   }
+-  check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+ }
+ 
+ if (is_win || is_mac || is_linux || is_chromeos) {
+--- a/ui/wm/public/BUILD.gn
++++ b/ui/wm/public/BUILD.gn
+@@ -39,7 +39,6 @@ component("public") {
+     "//ui/aura",
+     "//ui/base",
+   ]
+-  check_includes_strict = CHECK_INCLUDES_STRICT_PUBLIC_INCLUDES_PRIVATE
+ }
+ 
+ static_library("test_support") {
Risk 2/5 · Moderate chromium-156-typescript.patch
Result #5361

Comment

The patch changes Chromium’s TypeScript build to prefer the system /usr/bin/tsc on Linux and disables the tsgo path by default. I do not see a direct supply-chain compromise in the patch itself: there are no new network fetches, privilege escalations, or persistence mechanisms. However, it does introduce a trust boundary change by invoking an unpinned host tool from the build environment instead of the vendored TypeScript compiler. That can make builds non-reproducible and allows a compromised or mismatched system tsc to influence generated artifacts. The rest of the changes are conditional plumbing to support either compiler path and do not appear malicious on their own. Overall this is a moderate integrity risk, but not a high-confidence backdoor.

@@ -0,0 +1,248 @@
+--- a/third_party/devtools-frontend/src/scripts/build/typescript/typescript_vars.gni
++++ b/third_party/devtools-frontend/src/scripts/build/typescript/typescript_vars.gni
+@@ -6,7 +6,7 @@ import("//build/toolchain/rbe.gni")
+ import("../ninja/vars.gni")
+ 
+ if (host_os == "linux") {
+-  tsc_binary = "//third_party/typescript/linux-amd64/src/lib/tsc"
++  tsc_binary = "/usr/bin/tsc"
+ } else if (host_os == "win") {
+   tsc_binary = "//third_party/typescript/windows-amd64/src/lib/tsc.exe"
+ } else if (host_os == "mac") {
+--- a/third_party/devtools-frontend/src/third_party/typescript/typescript.py
++++ b/third_party/devtools-frontend/src/third_party/typescript/typescript.py
+@@ -10,6 +10,7 @@ import os
+ 
+ 
+ def GetBinaryPath():
++    return "/usr/bin/tsc"
+     if platform.machine() == 'arm64':
+         darwin_path = 'mac-arm64'
+     else:
+--- a/ui/webui/webui_features.gni
++++ b/ui/webui/webui_features.gni
+@@ -33,7 +33,7 @@ declare_args() {
+ 
+   # Enable the native TypeScript compiler (tsgo) instead of the JS-based one.
+   # TODO(crbug.com/423789047): Remove this flag once fully committed to v7.
+-  use_typescript_go = true
++  use_typescript_go = false
+ }
+ 
+ if (enable_cast_receiver || is_cast_android || is_castos) {
+
+--- a/tools/typescript/ts_definitions.gni
++++ b/tools/typescript/ts_definitions.gni
+@@ -3,7 +3,11 @@
+ # found in the LICENSE file.
+ 
+ import("//third_party/node/node.gni")
+-import("//third_party/typescript/tsgo.gni")
++import("//ui/webui/webui_features.gni")
++
++if (use_typescript_go) {
++  import("//third_party/typescript/tsgo.gni")
++}
+ 
+ assert(is_chromeos)
+ 
+@@ -20,9 +24,12 @@ template("ts_definitions") {
+                            ])
+ 
+     inputs = [
+-               "//package.json",
+-               "//tools/typescript/tsconfig_definitions_base.json",
+-             ] + tsgo_inputs
++      "//package.json",
++      "//tools/typescript/tsconfig_definitions_base.json",
++    ]
++    if (use_typescript_go) {
++      inputs += tsgo_inputs
++    }
+     outputs = [ "$target_gen_dir/tsconfig_definitions.json" ]
+ 
+     root_dir = "."
+@@ -52,6 +59,10 @@ template("ts_definitions") {
+              "--js_files",
+            ] + js_files
+ 
++    if (use_typescript_go) {
++      args += [ "--use_typescript_go" ]
++    }
++
+     if (defined(deps)) {
+       args += [ "--deps" ]
+ 
+--- a/tools/typescript/ts_definitions.py
++++ b/tools/typescript/ts_definitions.py
+@@ -13,8 +13,9 @@ _CWD = os.getcwd()
+ _HERE_DIR = os.path.dirname(__file__)
+ _SRC_DIR = os.path.normpath(os.path.join(_HERE_DIR, '..', '..'))
+ 
+-sys.path.append(os.path.join(_SRC_DIR, 'third_party', 'typescript'))
+-import typescript
++sys.path.append(os.path.join(_SRC_DIR, 'third_party', 'node'))
++import node
++import node_modules
+ 
+ 
+ _TSCONFIG_BASE = 'tsconfig_definitions_base.json'
+@@ -40,6 +41,7 @@ def main(argv):
+   parser.add_argument('--root_dir', required=True)
+   parser.add_argument('--js_files', nargs='*', required=True)
+   parser.add_argument('--path_mappings', nargs='*')
++  parser.add_argument('--use_typescript_go', action='store_true')
+   args = parser.parse_args(argv)
+ 
+   with open(
+@@ -81,9 +83,22 @@ def main(argv):
+       if os.path.exists(to_delete):
+         os.remove(to_delete)
+ 
+-  stdout = typescript.RunTypeScript(
+-    ['--project', os.path.join(args.gen_dir, _TSCONFIG_GEN)]
+-  )
++  stdout = None
++  if args.use_typescript_go:
++    sys.path.append(os.path.join(_SRC_DIR, 'third_party', 'typescript'))
++    import typescript
++
++    stdout = typescript.RunTypeScript(
++      ['--project', os.path.join(args.gen_dir, _TSCONFIG_GEN)]
++    )
++  else:
++    stdout = node.RunNode(
++      [
++        node_modules.PathToTypescript(),
++        '--project',
++        os.path.join(args.gen_dir, _TSCONFIG_GEN),
++      ]
++    )
+ 
+   # Verify that that no unexpected .d.ts files were generated.
+   lines = stdout.splitlines()
+--- a/tools/typescript/ts_library.gni
++++ b/tools/typescript/ts_library.gni
+@@ -3,7 +3,11 @@
+ # found in the LICENSE file.
+ 
+ import("//third_party/node/node.gni")
+-import("//third_party/typescript/tsgo.gni")
++import("//ui/webui/webui_features.gni")
++
++if (use_typescript_go) {
++  import("//third_party/typescript/tsgo.gni")
++}
+ 
+ template("ts_library") {
+   node(target_name) {
+@@ -21,11 +25,14 @@ template("ts_library") {
+                            ])
+ 
+     inputs = [
+-               "//package.json",
+-               "//tools/typescript/path_utils.py",
+-               "//tools/typescript/tsconfig_base.json",
+-               "//tools/typescript/validate_tsconfig.py",
+-             ] + tsgo_inputs
++      "//package.json",
++      "//tools/typescript/path_utils.py",
++      "//tools/typescript/tsconfig_base.json",
++      "//tools/typescript/validate_tsconfig.py",
++    ]
++    if (use_typescript_go) {
++      inputs += tsgo_inputs
++    }
+ 
+     outputs = [ "$target_gen_dir/tsconfig_$target_name.json" ]
+ 
+@@ -77,6 +84,10 @@ template("ts_library") {
+       target_name,
+     ]
+ 
++    if (use_typescript_go) {
++      args += [ "--use_typescript_go" ]
++    }
++
+     if (defined(in_files)) {
+       args += [ "--in_files" ] + in_files
+     }
+--- a/tools/typescript/ts_library.py
++++ b/tools/typescript/ts_library.py
+@@ -15,8 +15,9 @@ _CWD = os.getcwd()
+ _HERE_DIR = os.path.dirname(__file__)
+ _SRC_DIR = os.path.normpath(os.path.join(_HERE_DIR, '..', '..'))
+ 
+-sys.path.append(os.path.join(_SRC_DIR, 'third_party', 'typescript'))
+-import typescript
++sys.path.append(os.path.join(_SRC_DIR, 'third_party', 'node'))
++import node
++import node_modules
+ 
+ from path_utils import isInAshFolder, getTargetPath
+ from validate_tsconfig import (
+@@ -70,6 +71,7 @@ def main(argv):
+   )
+   parser.add_argument('--enable_source_maps', action='store_true')
+   parser.add_argument('--output_suffix', required=True)
++  parser.add_argument('--use_typescript_go', action='store_true')
+   args = parser.parse_args(argv)
+ 
+   root_dir = os.path.relpath(args.root_dir, args.gen_dir)
+@@ -305,9 +307,21 @@ def main(argv):
+             os.remove(to_check)
+ 
+   try:
+-    typescript.RunTypeScript(
+-      ['--project', os.path.join(args.gen_dir, tsconfig_file)]
+-    )
++    if args.use_typescript_go:
++      sys.path.append(os.path.join(_SRC_DIR, 'third_party', 'typescript'))
++      import typescript
++
++      typescript.RunTypeScript(
++        ['--project', os.path.join(args.gen_dir, tsconfig_file)]
++      )
++    else:
++      node.RunNode(
++        [
++          node_modules.PathToTypescript(),
++          '--project',
++          os.path.join(args.gen_dir, tsconfig_file),
++        ]
++      )
+   finally:
+     if args.composite:
+       # `.tsbuildinfo` is generated by TypeScript for incremenetal compilation
+@@ -327,13 +341,24 @@ def main(argv):
+ 
+   # Invoke the TS compiler again, with the --listFilesOnly flag, to detect any
+   # files that are used by the build, but not properly declared as dependencies.
+-  out = typescript.RunTypeScript(
+-    [
+-      '--project',
+-      os.path.join(args.gen_dir, tsconfig_file),
+-      '--listFilesOnly',
+-    ]
+-  )
++  out = None
++  if args.use_typescript_go:
++    out = typescript.RunTypeScript(
++      [
++        '--project',
++        os.path.join(args.gen_dir, tsconfig_file),
++        '--listFilesOnly',
++      ]
++    )
++  else:
++    out = node.RunNode(
++      [
++        node_modules.PathToTypescript(),
++        '--project',
++        os.path.join(args.gen_dir, tsconfig_file),
++        '--listFilesOnly',
++      ]
++    )
+ 
+   files_list = out.split('\n')
+   definitions_files = list(filter(lambda f: f.endswith('.d.ts'), files_list))