diff --git a/vendor/magento/module-catalog-permissions/Plugin/Sitemap/Model/ResourceModel/Catalog/CategoryPlugin.php b/vendor/magento/module-catalog-permissions/Plugin/Sitemap/Model/ResourceModel/Catalog/CategoryPlugin.php
new file mode 100644
index 00000000000..af1ccf507d7
--- /dev/null
+++ b/vendor/magento/module-catalog-permissions/Plugin/Sitemap/Model/ResourceModel/Catalog/CategoryPlugin.php
@@ -0,0 +1,75 @@
+<?php
+/**
+ * ADOBE CONFIDENTIAL
+ *
+ * Copyright 2023 Adobe
+ * All Rights Reserved.
+ *
+ * NOTICE: All information contained herein is, and remains
+ * the property of Adobe and its suppliers, if any. The intellectual
+ * and technical concepts contained herein are proprietary to Adobe
+ * and its suppliers and are protected by all applicable intellectual
+ * property laws, including trade secret and copyright laws.
+ * Dissemination of this information or reproduction of this material
+ * is strictly forbidden unless prior written permission is obtained
+ * from Adobe.
+ */
+declare(strict_types=1);
+
+namespace Magento\CatalogPermissions\Plugin\Sitemap\Model\ResourceModel\Catalog;
+
+use Magento\CatalogPermissions\App\Config;
+use Magento\CatalogPermissions\Model\Permission\Index;
+use Magento\Customer\Model\Group;
+use Magento\Framework\DB\Select;
+use Magento\Sitemap\Model\ResourceModel\Catalog\CategorySelectBuilder;
+use Magento\Store\Api\Data\StoreInterface;
+
+class CategoryPlugin
+{
+
+    /**
+     * @param Config $config
+     * @param Index $permissionIndex
+     */
+    public function __construct(
+        private readonly Config $config,
+        private readonly Index $permissionIndex
+    ) {
+    }
+
+    /**
+     * Allow only products from public shared catalog assigned to allowed categories
+     *
+     * @param CategorySelectBuilder $subject
+     * @param Select $select
+     * @param string $mainTableName
+     * @param string $idField
+     * @param StoreInterface $store
+     * @param string $path
+     * @return Select
+     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+     */
+    public function afterExecute(
+        CategorySelectBuilder $subject,
+        Select $select,
+        string $mainTableName,
+        string $idField,
+        StoreInterface $store,
+        string $path
+    ): Select {
+        if (!$this->config->isEnabled($store->getId())) {
+            return $select;
+        }
+
+        $restrictedCategoryIds = $this->permissionIndex->getRestrictedCategoryIds(
+            Group::NOT_LOGGED_IN_ID,
+            $store->getWebsiteId()
+        );
+        if (count($restrictedCategoryIds)) {
+            $select->where('e.entity_id NOT IN (?)', $restrictedCategoryIds);
+        }
+
+        return $select;
+    }
+}
diff --git a/vendor/magento/module-catalog-permissions/Plugin/Sitemap/Model/ResourceModel/Catalog/ProductPlugin.php b/vendor/magento/module-catalog-permissions/Plugin/Sitemap/Model/ResourceModel/Catalog/ProductPlugin.php
new file mode 100644
index 00000000000..f1df4e384ee
--- /dev/null
+++ b/vendor/magento/module-catalog-permissions/Plugin/Sitemap/Model/ResourceModel/Catalog/ProductPlugin.php
@@ -0,0 +1,92 @@
+<?php
+/**
+ * ADOBE CONFIDENTIAL
+ *
+ * Copyright 2023 Adobe
+ * All Rights Reserved.
+ *
+ * NOTICE: All information contained herein is, and remains
+ * the property of Adobe and its suppliers, if any. The intellectual
+ * and technical concepts contained herein are proprietary to Adobe
+ * and its suppliers and are protected by all applicable intellectual
+ * property laws, including trade secret and copyright laws.
+ * Dissemination of this information or reproduction of this material
+ * is strictly forbidden unless prior written permission is obtained
+ * from Adobe.
+ */
+declare(strict_types=1);
+
+namespace Magento\CatalogPermissions\Plugin\Sitemap\Model\ResourceModel\Catalog;
+
+use Magento\CatalogPermissions\App\Config;
+use Magento\CatalogPermissions\Model\Permission;
+use Magento\CatalogPermissions\Model\Permission\Index;
+use Magento\Customer\Model\Group;
+use Magento\Framework\DB\Select;
+use Magento\Sitemap\Model\ResourceModel\Catalog\ProductSelectBuilder;
+use Magento\Store\Api\Data\StoreInterface;
+
+class ProductPlugin
+{
+    /**
+     * @param Config $config
+     * @param Index $permissionIndex
+     */
+    public function __construct(
+        private Config $config,
+        private readonly Index $permissionIndex
+    ) {
+    }
+
+    /**
+     * Allow only products from public shared catalog assigned to allowed categories
+     *
+     * @param ProductSelectBuilder $subject
+     * @param Select $select
+     * @param string $mainTableName
+     * @param string $idField
+     * @param string $linkField
+     * @param StoreInterface $store
+     * @return Select
+     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+     */
+    public function afterExecute(
+        ProductSelectBuilder $subject,
+        Select  $select,
+        string $mainTableName,
+        string $idField,
+        string $linkField,
+        StoreInterface $store
+    ): Select {
+        if (!$this->config->isEnabled($store->getId())) {
+            return $select;
+        }
+
+        $restrictedCategoryIds = $this->permissionIndex->getRestrictedCategoryIds(
+            Group::NOT_LOGGED_IN_ID,
+            $store->getWebsiteId()
+        );
+        if (count($restrictedCategoryIds)) {
+            $select->joinLeft(
+                ['cp' => $select->getConnection()->getTableName('catalog_category_product')],
+                'cp.product_id = e.entity_id',
+                []
+            )->where(
+                'cp.category_id NOT IN (?)',
+                $restrictedCategoryIds
+            );
+            $select->joinLeft(
+                ['perm' => $select->getConnection()->getTableName('magento_catalogpermissions_index_product')],
+                'perm.product_id = e.entity_id',
+                []
+            )->where(
+                '((perm.grant_catalog_category_view != ' . Permission::PERMISSION_DENY . '
+            AND perm.customer_group_id = ' . Group::NOT_LOGGED_IN_ID . '
+            AND perm.store_id in (?)) OR perm.grant_catalog_category_view IS NULL)',
+                [$store->getId()]
+            );
+        }
+
+        return $select;
+    }
+}
diff --git a/vendor/magento/module-catalog-permissions/etc/di.xml b/vendor/magento/module-catalog-permissions/etc/di.xml
index f1a96cd977f..390b89b3380 100644
--- a/vendor/magento/module-catalog-permissions/etc/di.xml
+++ b/vendor/magento/module-catalog-permissions/etc/di.xml
@@ -99,4 +99,12 @@
         <plugin name="check_catalog_permission_after_get_section_data"
                 type="Magento\CatalogPermissions\Plugin\Sales\CustomerData\CheckCatalogPermissionAfterLastOrderedItemsPlugin" />
     </type>
+    <type name="Magento\Sitemap\Model\ResourceModel\Catalog\ProductSelectBuilder">
+        <plugin name="generate_sitemap_with_allowed_products_permissions"
+                type="Magento\CatalogPermissions\Plugin\Sitemap\Model\ResourceModel\Catalog\ProductPlugin" />
+    </type>
+    <type name="Magento\Sitemap\Model\ResourceModel\Catalog\CategorySelectBuilder">
+        <plugin name="generate_sitemap_with_allowed_categories_permissions"
+                type="Magento\CatalogPermissions\Plugin\Sitemap\Model\ResourceModel\Catalog\CategoryPlugin" />
+    </type>
 </config>
