Low chrome Logic Error 🔧 Commit mapped

Overview

Low
Severity
CVSS
No
Exploited ITW
Fixed
Fix Status
ImpactInappropriate implementation in AI
DescriptionInappropriate implementation in AI
ComponentAI
Bug ClassLogic Error
Tracker517381770
Fix commitcf14f155649c (chromium/src) +27/-0
CISA KEVNot listed
CreditedGoogle
Disclosed2026-06-30

Changed Functions

FunctionChangeNotes
AIClassifierTest
chrome/browser/ai/ai_classifier_unittest.cc
modified
AIClassifierTest
chrome/browser/ai/ai_classifier_unittest.cc
modified
TEST_F
chrome/browser/ai/ai_classifier_unittest.cc
modified
AIManagerTest
chrome/browser/ai/ai_manager_unittest.cc
modified
AIManagerTest
chrome/browser/ai/ai_manager_unittest.cc
modified

Files Changed

  • chrome/browser/ai/ai_classifier_unittest.cc
  • chrome/browser/ai/ai_manager.cc
  • chrome/browser/ai/ai_manager_unittest.cc
From cf14f155649cad2934705c4d6e42eb2a3dcbe389 Mon Sep 17 00:00:00 2001
From: Jingyun Liu <jingyun@google.com>
Date: Fri, 29 May 2026 12:36:48 -0700
Subject: [PATCH] Guard AIClassifier API methods with a feature flag in browser

BUG: 517381770
Change-Id: I324ba669ded582ba722cbe7de795acb43958abc8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7883638
Auto-Submit: Jingyun Liu <jingyun@google.com>
Reviewed-by: Mike Wasserman <msw@chromium.org>
Commit-Queue: Jingyun Liu <jingyun@google.com>
Cr-Commit-Position: refs/heads/main@{#1638665}
---

diff --git a/chrome/browser/ai/ai_classifier_unittest.cc b/chrome/browser/ai/ai_classifier_unittest.cc
index a241f799..1f06068 100644
--- a/chrome/browser/ai/ai_classifier_unittest.cc
+++ b/chrome/browser/ai/ai_classifier_unittest.cc
@@ -30,6 +30,7 @@
 #include "services/on_device_model/public/cpp/features.h"
 #include "testing/gmock/include/gmock/gmock.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/blink/public/common/features_generated.h"
 #include "third_party/blink/public/mojom/ai/ai_classifier.mojom.h"
 #include "third_party/blink/public/mojom/ai/ai_manager.mojom.h"
 #include "third_party/blink/public/mojom/ai/model_streaming_responder.mojom.h"
@@ -94,6 +95,12 @@
 }
 
 class AIClassifierTest : public AITestUtils::AITestBase {
+ public:
+  AIClassifierTest() {
+    scoped_feature_list_.InitAndEnableFeature(
+        blink::features::kAIClassifierAPI);
+  }
+
  protected:
   optimization_guide::proto::OnDeviceModelExecutionFeatureConfig CreateConfig()
       override {
@@ -144,6 +151,9 @@
     auto result = classifier_client.result().Take();
     EXPECT_TRUE(result.has_value());
   }
+
+ private:
+  base::test::ScopedFeatureList scoped_feature_list_;
 };
 
 TEST_F(AIClassifierTest, Classify) {
diff --git a/chrome/browser/ai/ai_manager.cc b/chrome/browser/ai/ai_manager.cc
index abf25e5..5e37e91 100644
--- a/chrome/browser/ai/ai_manager.cc
+++ b/chrome/browser/ai/ai_manager.cc
@@ -1383,6 +1383,10 @@
 void AIManager::CanCreateClassifier(
     blink::mojom::AIClassifierCreateOptionsPtr options,
     CanCreateClassifierCallback callback) {
+  if (!base::FeatureList::IsEnabled(blink::features::kAIClassifierAPI)) {
+    receivers_.ReportBadMessage("Feature not enabled");
+    return;
+  }
   // TODO(crbug.com/499365168): Enforce permissions policy and
   // CheckAndFixLanguages.
   if (auto pref_blocked_result = GetPrefBlockedResult()) {
@@ -1396,6 +1400,10 @@
 void AIManager::CreateClassifier(
     mojo::PendingRemote<blink::mojom::AIManagerCreateClassifierClient> client,
     blink::mojom::AIClassifierCreateOptionsPtr options) {
+  if (!base::FeatureList::IsEnabled(blink::features::kAIClassifierAPI)) {
+    receivers_.ReportBadMessage("Feature not enabled");
+    return;
+  }
   // TODO(crbug.com/499365168): Enforce permissions policy and
   // CheckAndFixLanguages.
   if (IsBlocked()) {
diff --git a/chrome/browser/ai/ai_manager_unittest.cc b/chrome/browser/ai/ai_manager_unittest.cc
index 87652eb0..571e471 100644
--- a/chrome/browser/ai/ai_manager_unittest.cc
+++ b/chrome/browser/ai/ai_manager_unittest.cc
@@ -57,6 +57,12 @@
 }
 
 class AIManagerTest : public AITestUtils::AITestBase {
+ public:
+  AIManagerTest() {
+    scoped_feature_list_.InitAndEnableFeature(
+        blink::features::kAIClassifierAPI);
+  }
+
  protected:
   optimization_guide::proto::OnDeviceModelExecutionFeatureConfig CreateConfig()
       override {
@@ -66,6 +72,9 @@
                            MODEL_EXECUTION_FEATURE_PROMPT_API);
     return config;
   }
+
+ private:
+  base::test::ScopedFeatureList scoped_feature_list_;
 };
 
 // Tests that involve invalid on-device model file paths should not crash when
Loading diff…

Regression Test / PoC

shipped with the fix
diff --git a/chrome/browser/ai/ai_classifier_unittest.cc b/chrome/browser/ai/ai_classifier_unittest.cc
index a241f799..1f06068 100644
--- a/chrome/browser/ai/ai_classifier_unittest.cc
+++ b/chrome/browser/ai/ai_classifier_unittest.cc
@@ -30,6 +30,7 @@
 #include "services/on_device_model/public/cpp/features.h"
 #include "testing/gmock/include/gmock/gmock.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/blink/public/common/features_generated.h"
 #include "third_party/blink/public/mojom/ai/ai_classifier.mojom.h"
 #include "third_party/blink/public/mojom/ai/ai_manager.mojom.h"
 #include "third_party/blink/public/mojom/ai/model_streaming_responder.mojom.h"
@@ -94,6 +95,12 @@
 }
 
 class AIClassifierTest : public AITestUtils::AITestBase {
+ public:
+  AIClassifierTest() {
+    scoped_feature_list_.InitAndEnableFeature(
+        blink::features::kAIClassifierAPI);
+  }
+
  protected:
   optimization_guide::proto::OnDeviceModelExecutionFeatureConfig CreateConfig()
       override {
@@ -144,6 +151,9 @@
     auto result = classifier_client.result().Take();
     EXPECT_TRUE(result.has_value());
   }
+
+ private:
+  base::test::ScopedFeatureList scoped_feature_list_;
 };
 
 TEST_F(AIClassifierTest, Classify) {
diff --git a/chrome/browser/ai/ai_manager_unittest.cc b/chrome/browser/ai/ai_manager_unittest.cc
index 87652eb0..571e471 100644
--- a/chrome/browser/ai/ai_manager_unittest.cc
+++ b/chrome/browser/ai/ai_manager_unittest.cc
@@ -57,6 +57,12 @@
 }
 
 class AIManagerTest : public AITestUtils::AITestBase {
+ public:
+  AIManagerTest() {
+    scoped_feature_list_.InitAndEnableFeature(
+        blink::features::kAIClassifierAPI);
+  }
+
  protected:
   optimization_guide::proto::OnDeviceModelExecutionFeatureConfig CreateConfig()
       override {
@@ -66,6 +72,9 @@
                            MODEL_EXECUTION_FEATURE_PROMPT_API);
     return config;
   }
+
+ private:
+  base::test::ScopedFeatureList scoped_feature_list_;
 };
 
 // Tests that involve invalid on-device model file paths should not crash when
Loading diff…

Original Bug Report

The reporter's bug is still restricted on the tracker. Chrome de-restricts security bugs ~30–90 days after the fix ships; a later run will backfill it here.