diff --git a/modules/webform_access/webform_access.module b/modules/webform_access/webform_access.module
index c161a5c9..577a1ae0 100644
--- a/modules/webform_access/webform_access.module
+++ b/modules/webform_access/webform_access.module
@@ -146,6 +146,13 @@ function webform_access_menu_local_tasks_alter(&$data, $route_name) {
  * Implements hook_ENTITY_TYPE_access().
  */
 function webform_access_webform_access(WebformInterface $webform, $operation, AccountInterface $account) {
+  // Prevent recursion when a webform is being passed as the source entity
+  // via the URL.
+  // @see \Drupal\webform\Plugin\WebformSourceEntity\QueryStringWebformSourceEntity::getSourceEntity
+  if (\Drupal::request()->query->get('source_entity_type') === 'webform') {
+    return AccessResult::neutral();
+  }
+
   /** @var \Drupal\webform\WebformRequestInterface $request_handler */
   $request_handler = \Drupal::service('webform.request');
   $source_entity = $request_handler->getCurrentSourceEntity();
diff --git a/src/Plugin/WebformSourceEntity/QueryStringWebformSourceEntity.php b/src/Plugin/WebformSourceEntity/QueryStringWebformSourceEntity.php
index d84b38eb..7f219db3 100644
--- a/src/Plugin/WebformSourceEntity/QueryStringWebformSourceEntity.php
+++ b/src/Plugin/WebformSourceEntity/QueryStringWebformSourceEntity.php
@@ -9,7 +9,6 @@ use Drupal\Core\Plugin\PluginBase;
 use Drupal\Core\Routing\RouteMatchInterface;
 use Drupal\Core\TypedData\TranslatableInterface;
 use Drupal\webform\Plugin\WebformSourceEntityInterface;
-use Drupal\webform\Plugin\WebformSourceEntityManager;
 use Drupal\webform\WebformEntityReferenceManagerInterface;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 use Symfony\Component\HttpFoundation\RequestStack;
@@ -135,7 +134,6 @@ class QueryStringWebformSourceEntity extends PluginBase implements WebformSource
       return NULL;
     }
 
-    // Get translated source entity.
     if ($source_entity instanceof TranslatableInterface && $source_entity->hasTranslation($this->languageManager->getCurrentLanguage()->getId())) {
       $source_entity = $source_entity->getTranslation($this->languageManager->getCurrentLanguage()->getId());
     }
@@ -162,18 +160,14 @@ class QueryStringWebformSourceEntity extends PluginBase implements WebformSource
         return NULL;
       }
 
-      // Check that source entity's reference webform is the
-      // current webform.
-      foreach ($source_entity->$webform_field_name as $item) {
-        if ($item->target_id === $webform->id()) {
-          return WebformSourceEntityManager::getMainSourceEntity($source_entity);
-        }
+      // Check that source entity's reference webform is the current YAML
+      // webform.
+      if ($source_entity->$webform_field_name->target_id != $webform->id()) {
+        return NULL;
       }
-
-      return NULL;
     }
 
-    return WebformSourceEntityManager::getMainSourceEntity($source_entity);
+    return $source_entity;
   }
 
 }
