diff --git a/core/modules/filter/src/Entity/FilterFormat.php b/core/modules/filter/src/Entity/FilterFormat.php
index abd9b6aae8..2fa619bb85 100644
--- a/core/modules/filter/src/Entity/FilterFormat.php
+++ b/core/modules/filter/src/Entity/FilterFormat.php
@@ -439,4 +439,26 @@ protected function calculatePluginDependencies(PluginInspectionInterface $instan
     }
   }
 
+  /**
+   * Triggers deprecations when getting deprecated properties.
+   */
+  public function get($property_name) {
+    if ($property_name === 'roles') {
+      $class_name = static::class;
+      @trigger_error("The property $property_name is deprecated in $class_name and will be removed before Drupal 10.0.0.", E_USER_DEPRECATED);
+    }
+    return parent::get($property_name);
+  }
+
+  /**
+   * Triggers deprecations when setting deprecated properties.
+   */
+  public function set($property_name, $value) {
+    if ($property_name === 'roles') {
+      $class_name = static::class;
+      @trigger_error("The property $property_name is deprecated in $class_name and will be removed before Drupal 10.0.0.", E_USER_DEPRECATED);
+    }
+    parent::set($property_name, $value);
+  }
+
 }
diff --git a/core/modules/filter/tests/filter_test_legacy/config/install/filter.format.filter_test_legacy.yml b/core/modules/filter/tests/filter_test_legacy/config/install/filter.format.filter_test_legacy.yml
new file mode 100644
index 0000000000..e2d4df7c98
--- /dev/null
+++ b/core/modules/filter/tests/filter_test_legacy/config/install/filter.format.filter_test_legacy.yml
@@ -0,0 +1,28 @@
+format: filter_test_legacy
+name: 'Test format'
+weight: 2
+roles:
+  - anonymous
+  - authenticated
+status: true
+langcode: en
+filters:
+  filter_html_escape:
+    id: filter_html_escape
+    provider: filter
+    status: true
+    weight: -10
+    settings: {  }
+  filter_autop:
+    id: filter_autop
+    provider: filter
+    status: true
+    weight: 0
+    settings: {  }
+  filter_url:
+    id: filter_url
+    provider: filter
+    status: true
+    weight: 0
+    settings:
+      filter_url_length: 72
diff --git a/core/modules/filter/tests/filter_test_legacy/filter_test_legacy.info.yml b/core/modules/filter/tests/filter_test_legacy/filter_test_legacy.info.yml
new file mode 100644
index 0000000000..12278360a1
--- /dev/null
+++ b/core/modules/filter/tests/filter_test_legacy/filter_test_legacy.info.yml
@@ -0,0 +1,7 @@
+name: 'Filter legacy test module'
+type: module
+description: 'Tests legacy filter behavior.'
+package: Testing
+version: VERSION
+dependencies:
+  - drupal:filter
diff --git a/core/modules/filter/tests/src/Kernel/FilterDefaultConfigTest.php b/core/modules/filter/tests/src/Kernel/FilterDefaultConfigTest.php
index 2fa3511d9c..b0d10ba0a8 100644
--- a/core/modules/filter/tests/src/Kernel/FilterDefaultConfigTest.php
+++ b/core/modules/filter/tests/src/Kernel/FilterDefaultConfigTest.php
@@ -41,14 +41,6 @@ public function testInstallation() {
     // Verify that format default property values have been added/injected.
     $this->assertNotEmpty($format->uuid());
 
-    // Verify that the loaded format does not contain any roles.
-    $this->assertEqual($format->get('roles'), NULL);
-    // Verify that the defined roles in the default config have been processed.
-    $this->assertEqual(array_keys(filter_get_roles_by_format($format)), [
-      RoleInterface::ANONYMOUS_ID,
-      RoleInterface::AUTHENTICATED_ID,
-    ]);
-
     // Verify enabled filters.
     $filters = $format->get('filters');
     $this->assertEqual($filters['filter_html_escape']['status'], 1);
@@ -67,29 +59,4 @@ public function testInstallation() {
     ]);
   }
 
-  /**
-   * Tests that changes to FilterFormat::$roles do not have an effect.
-   */
-  public function testUpdateRoles() {
-    // Verify role permissions declared in default config.
-    $format = FilterFormat::load('filter_test');
-    $this->assertEqual(array_keys(filter_get_roles_by_format($format)), [
-      RoleInterface::ANONYMOUS_ID,
-      RoleInterface::AUTHENTICATED_ID,
-    ]);
-
-    // Attempt to change roles.
-    $format->set('roles', [
-      RoleInterface::AUTHENTICATED_ID,
-    ]);
-    $format->save();
-
-    // Verify that roles have not been updated.
-    $format = FilterFormat::load('filter_test');
-    $this->assertEqual(array_keys(filter_get_roles_by_format($format)), [
-      RoleInterface::ANONYMOUS_ID,
-      RoleInterface::AUTHENTICATED_ID,
-    ]);
-  }
-
 }
diff --git a/core/modules/filter/tests/src/Kernel/FilterLegacyTest.php b/core/modules/filter/tests/src/Kernel/FilterLegacyTest.php
new file mode 100644
index 0000000000..ed646e5768
--- /dev/null
+++ b/core/modules/filter/tests/src/Kernel/FilterLegacyTest.php
@@ -0,0 +1,74 @@
+<?php
+
+namespace Drupal\Tests\filter\Kernel;
+
+use Drupal\filter\Entity\FilterFormat;
+use Drupal\KernelTests\KernelTestBase;
+use Drupal\user\RoleInterface;
+
+/**
+ * Tests legacy filter behaviors.
+ *
+ * @group legacy
+ * @group filter
+ */
+class FilterLegacyTest extends KernelTestBase {
+
+  protected static $modules = ['system', 'user', 'filter', 'filter_test_legacy'];
+
+  protected function setUp(): void {
+    parent::setUp();
+
+    // Drupal\filter\FilterPermissions::permissions() builds a URL to output
+    // a link in the description.
+
+    $this->installEntitySchema('user');
+
+    // Install filter_test module, which ships with custom default format.
+    $this->installConfig(['user', 'filter_test_legacy']);
+  }
+
+  /**
+   * Tests update of roles during installation of default formats.
+   *
+   * @expectedDeprecation The property roles is deprecated in \Drupal\filter\Entity\FilterFormat and will be removed before Drupal 10.0.0.
+   */
+  public function testInstallRoles() {
+    $format = FilterFormat::load('filter_test_legacy');
+    // Verify that the loaded format does not contain any roles.
+    $this->assertNull($format->get('roles'));
+    // Verify that the defined roles in the default config have been processed.
+    $this->assertEquals([
+      RoleInterface::ANONYMOUS_ID,
+      RoleInterface::AUTHENTICATED_ID,
+    ], array_keys(filter_get_roles_by_format($format)));
+  }
+
+  /**
+   * Tests that changes to FilterFormat::$roles do not have an effect.
+   *
+   * @expectedDeprecation The property roles is deprecated in \Drupal\filter\Entity\FilterFormat and will be removed before Drupal 10.0.0.
+   */
+  public function testUpdateRoles() {
+    // Verify role permissions declared in default config.
+    $format = FilterFormat::load('filter_test_legacy');
+    $this->assertEquals([
+      RoleInterface::ANONYMOUS_ID,
+      RoleInterface::AUTHENTICATED_ID,
+    ], array_keys(filter_get_roles_by_format($format)));
+
+    // Attempt to change roles.
+    $format->set('roles', [
+      RoleInterface::AUTHENTICATED_ID,
+    ]);
+    $format->save();
+
+    // Verify that roles have not been updated.
+    $format = FilterFormat::load('filter_test_legacy');
+    $this->assertEquals([
+      RoleInterface::ANONYMOUS_ID,
+      RoleInterface::AUTHENTICATED_ID,
+    ], array_keys(filter_get_roles_by_format($format)));
+  }
+
+}
diff --git a/core/profiles/demo_umami/config/install/filter.format.restricted_html.yml b/core/profiles/demo_umami/config/install/filter.format.restricted_html.yml
index 6b51f37035..5656b14514 100644
--- a/core/profiles/demo_umami/config/install/filter.format.restricted_html.yml
+++ b/core/profiles/demo_umami/config/install/filter.format.restricted_html.yml
@@ -4,8 +4,6 @@ dependencies: {  }
 name: 'Restricted HTML'
 format: restricted_html
 weight: 1
-roles:
-  - anonymous
 filters:
   filter_html:
     id: filter_html
diff --git a/core/profiles/standard/config/install/filter.format.basic_html.yml b/core/profiles/standard/config/install/filter.format.basic_html.yml
index 92224c23cf..4d681f6ec6 100644
--- a/core/profiles/standard/config/install/filter.format.basic_html.yml
+++ b/core/profiles/standard/config/install/filter.format.basic_html.yml
@@ -6,8 +6,6 @@ dependencies:
 name: 'Basic HTML'
 format: basic_html
 weight: 0
-roles:
-  - authenticated
 filters:
   filter_html:
     id: filter_html
diff --git a/core/profiles/standard/config/install/filter.format.full_html.yml b/core/profiles/standard/config/install/filter.format.full_html.yml
index 8aca83e0d9..f63662d767 100644
--- a/core/profiles/standard/config/install/filter.format.full_html.yml
+++ b/core/profiles/standard/config/install/filter.format.full_html.yml
@@ -6,8 +6,6 @@ dependencies:
 name: 'Full HTML'
 format: full_html
 weight: 2
-roles:
-  - administrator
 filters:
   filter_align:
     id: filter_align
diff --git a/core/profiles/standard/config/install/filter.format.restricted_html.yml b/core/profiles/standard/config/install/filter.format.restricted_html.yml
index 6b51f37035..5656b14514 100644
--- a/core/profiles/standard/config/install/filter.format.restricted_html.yml
+++ b/core/profiles/standard/config/install/filter.format.restricted_html.yml
@@ -4,8 +4,6 @@ dependencies: {  }
 name: 'Restricted HTML'
 format: restricted_html
 weight: 1
-roles:
-  - anonymous
 filters:
   filter_html:
     id: filter_html
