diff --git a/package_manager/src/PathExcluder/GitExcluder.php b/package_manager/src/PathExcluder/GitExcluder.php
index 42f473e74c1fe652c2e4985591301f8dff2ce55e..f8e2e77c38643382227dcb919440a49f1bb48771 100644
--- a/package_manager/src/PathExcluder/GitExcluder.php
+++ b/package_manager/src/PathExcluder/GitExcluder.php
@@ -7,6 +7,7 @@ namespace Drupal\package_manager\PathExcluder;
 use Drupal\package_manager\ComposerInspector;
 use Drupal\package_manager\Event\CollectPathsToExcludeEvent;
 use Drupal\package_manager\PathLocator;
+use PhpTuf\ComposerStager\Infrastructure\Factory\Path\PathFactoryInterface;
 use Symfony\Component\EventDispatcher\EventSubscriberInterface;
 
 /**
@@ -28,9 +29,12 @@ final class GitExcluder implements EventSubscriberInterface {
    *   The path locator service.
    * @param \Drupal\package_manager\ComposerInspector $composerInspector
    *   The Composer inspector service.
+   * @param \PhpTuf\ComposerStager\Infrastructure\Factory\Path\PathFactoryInterface $path_factory
+   *   The path factory service.
    */
-  public function __construct(PathLocator $path_locator, private readonly ComposerInspector $composerInspector) {
+  public function __construct(PathLocator $path_locator, private readonly ComposerInspector $composerInspector, PathFactoryInterface $path_factory) {
     $this->pathLocator = $path_locator;
+    $this->pathFactory = $path_factory;
   }
 
   /**
diff --git a/package_manager/src/PathExcluder/NodeModulesExcluder.php b/package_manager/src/PathExcluder/NodeModulesExcluder.php
index 21c127802491e991fa37a9fc05ed948a08719912..9f07bf205fd1da8debf9f083f6dbf8e3121d6406 100644
--- a/package_manager/src/PathExcluder/NodeModulesExcluder.php
+++ b/package_manager/src/PathExcluder/NodeModulesExcluder.php
@@ -6,6 +6,7 @@ namespace Drupal\package_manager\PathExcluder;
 
 use Drupal\package_manager\Event\CollectPathsToExcludeEvent;
 use Drupal\package_manager\PathLocator;
+use PhpTuf\ComposerStager\Infrastructure\Factory\Path\PathFactoryInterface;
 use Symfony\Component\EventDispatcher\EventSubscriberInterface;
 
 /**
@@ -25,9 +26,12 @@ class NodeModulesExcluder implements EventSubscriberInterface {
    *
    * @param \Drupal\package_manager\PathLocator $path_locator
    *   The path locator service.
+   * @param \PhpTuf\ComposerStager\Infrastructure\Factory\Path\PathFactoryInterface $path_factory
+   *   The path factory service.
    */
-  public function __construct(PathLocator $path_locator) {
+  public function __construct(PathLocator $path_locator, PathFactoryInterface $path_factory) {
     $this->pathLocator = $path_locator;
+    $this->pathFactory = $path_factory;
   }
 
   /**
diff --git a/package_manager/src/PathExcluder/PathExclusionsTrait.php b/package_manager/src/PathExcluder/PathExclusionsTrait.php
index 9f417a78f35930682086ecbe6e44eff49a1d7c97..5a3bb9183ef32b95b0b88841804971675b4ab7ae 100644
--- a/package_manager/src/PathExcluder/PathExclusionsTrait.php
+++ b/package_manager/src/PathExcluder/PathExclusionsTrait.php
@@ -18,6 +18,13 @@ trait PathExclusionsTrait {
    */
   protected $pathLocator;
 
+  /**
+   * The path factory service.
+   *
+   * @var \PhpTuf\ComposerStager\Infrastructure\Factory\Path\PathFactoryInterface
+   */
+  protected $pathFactory;
+
   /**
    * Flags paths to be excluded, relative to the web root.
    *
@@ -56,7 +63,7 @@ trait PathExclusionsTrait {
     $project_root = $this->pathLocator->getProjectRoot();
 
     foreach ($paths as $path) {
-      if (str_starts_with($path, '/')) {
+      if ($this->pathFactory->create($path)->isAbsolute()) {
         if (!str_starts_with($path, $project_root)) {
           throw new \LogicException("$path is not inside the project root: $project_root.");
         }
diff --git a/package_manager/src/PathExcluder/SiteConfigurationExcluder.php b/package_manager/src/PathExcluder/SiteConfigurationExcluder.php
index b692110cfaa20be14f9b0f502691609651327791..92b0b43004ca2a1b4d8896341cbf79cef984f901 100644
--- a/package_manager/src/PathExcluder/SiteConfigurationExcluder.php
+++ b/package_manager/src/PathExcluder/SiteConfigurationExcluder.php
@@ -6,6 +6,7 @@ namespace Drupal\package_manager\PathExcluder;
 
 use Drupal\package_manager\Event\CollectPathsToExcludeEvent;
 use Drupal\package_manager\PathLocator;
+use PhpTuf\ComposerStager\Infrastructure\Factory\Path\PathFactoryInterface;
 use Symfony\Component\EventDispatcher\EventSubscriberInterface;
 
 /**
@@ -27,9 +28,12 @@ class SiteConfigurationExcluder implements EventSubscriberInterface {
    *   The current site path, relative to the Drupal root.
    * @param \Drupal\package_manager\PathLocator $path_locator
    *   The path locator service.
+   * @param \PhpTuf\ComposerStager\Infrastructure\Factory\Path\PathFactoryInterface $path_factory
+   *   The path factory service.
    */
-  public function __construct(protected string $sitePath, PathLocator $path_locator) {
+  public function __construct(protected string $sitePath, PathLocator $path_locator, PathFactoryInterface $path_factory) {
     $this->pathLocator = $path_locator;
+    $this->pathFactory = $path_factory;
   }
 
   /**
diff --git a/package_manager/src/PathExcluder/SiteFilesExcluder.php b/package_manager/src/PathExcluder/SiteFilesExcluder.php
index 07bbdc757da2c26a01bae5ca2c8a06d0793ff530..ce23ee375681541cd5067eb63c7479429a45e284 100644
--- a/package_manager/src/PathExcluder/SiteFilesExcluder.php
+++ b/package_manager/src/PathExcluder/SiteFilesExcluder.php
@@ -8,6 +8,7 @@ use Drupal\Core\StreamWrapper\LocalStream;
 use Drupal\Core\StreamWrapper\StreamWrapperManagerInterface;
 use Drupal\package_manager\Event\CollectPathsToExcludeEvent;
 use Drupal\package_manager\PathLocator;
+use PhpTuf\ComposerStager\Infrastructure\Factory\Path\PathFactoryInterface;
 use Symfony\Component\EventDispatcher\EventSubscriberInterface;
 use Symfony\Component\Filesystem\Filesystem;
 
@@ -28,6 +29,8 @@ final class SiteFilesExcluder implements EventSubscriberInterface {
    *
    * @param \Drupal\package_manager\PathLocator $path_locator
    *   The path locator service.
+   * @param \PhpTuf\ComposerStager\Infrastructure\Factory\Path\PathFactoryInterface $path_factory
+   *   The path factory service.
    * @param \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface $streamWrapperManager
    *   The stream wrapper manager service.
    * @param \Symfony\Component\Filesystem\Filesystem $fileSystem
@@ -35,10 +38,12 @@ final class SiteFilesExcluder implements EventSubscriberInterface {
    */
   public function __construct(
     PathLocator $path_locator,
+    PathFactoryInterface $path_factory,
     private readonly StreamWrapperManagerInterface $streamWrapperManager,
     private readonly Filesystem $fileSystem
   ) {
     $this->pathLocator = $path_locator;
+    $this->pathFactory = $path_factory;
   }
 
   /**
diff --git a/package_manager/src/PathExcluder/SqliteDatabaseExcluder.php b/package_manager/src/PathExcluder/SqliteDatabaseExcluder.php
index 260b28ae1bc5ac45bfbce519b9b82b84f761df1f..42bb06551648f412bfc33d32f1af0c97d6a4aa47 100644
--- a/package_manager/src/PathExcluder/SqliteDatabaseExcluder.php
+++ b/package_manager/src/PathExcluder/SqliteDatabaseExcluder.php
@@ -7,6 +7,7 @@ namespace Drupal\package_manager\PathExcluder;
 use Drupal\Core\Database\Connection;
 use Drupal\package_manager\Event\CollectPathsToExcludeEvent;
 use Drupal\package_manager\PathLocator;
+use PhpTuf\ComposerStager\Infrastructure\Factory\Path\PathFactoryInterface;
 use Symfony\Component\EventDispatcher\EventSubscriberInterface;
 
 /**
@@ -28,9 +29,12 @@ class SqliteDatabaseExcluder implements EventSubscriberInterface {
    *   The path locator service.
    * @param \Drupal\Core\Database\Connection $database
    *   The database connection.
+   * @param \PhpTuf\ComposerStager\Infrastructure\Factory\Path\PathFactoryInterface $path_factory
+   *   The path factory service.
    */
-  public function __construct(PathLocator $path_locator, protected Connection $database) {
+  public function __construct(PathLocator $path_locator, protected Connection $database, PathFactoryInterface $path_factory) {
     $this->pathLocator = $path_locator;
+    $this->pathFactory = $path_factory;
   }
 
   /**
diff --git a/package_manager/src/PathExcluder/TestSiteExcluder.php b/package_manager/src/PathExcluder/TestSiteExcluder.php
index 7548d82ef68ffeb98c899ae043b3c157acc3722f..f3a5080f36c39f8a52503c352ed5fa37a99d8f1b 100644
--- a/package_manager/src/PathExcluder/TestSiteExcluder.php
+++ b/package_manager/src/PathExcluder/TestSiteExcluder.php
@@ -6,6 +6,7 @@ namespace Drupal\package_manager\PathExcluder;
 
 use Drupal\package_manager\Event\CollectPathsToExcludeEvent;
 use Drupal\package_manager\PathLocator;
+use PhpTuf\ComposerStager\Infrastructure\Factory\Path\PathFactoryInterface;
 use Symfony\Component\EventDispatcher\EventSubscriberInterface;
 
 /**
@@ -25,9 +26,12 @@ final class TestSiteExcluder implements EventSubscriberInterface {
    *
    * @param \Drupal\package_manager\PathLocator $path_locator
    *   The path locator service.
+   * @param \PhpTuf\ComposerStager\Infrastructure\Factory\Path\PathFactoryInterface $path_factory
+   *   The path factory service.
    */
-  public function __construct(PathLocator $path_locator) {
+  public function __construct(PathLocator $path_locator, PathFactoryInterface $path_factory) {
     $this->pathLocator = $path_locator;
+    $this->pathFactory = $path_factory;
   }
 
   /**
diff --git a/package_manager/src/PathExcluder/UnknownPathExcluder.php b/package_manager/src/PathExcluder/UnknownPathExcluder.php
index d9c3071c3bf8b6489bbe8cd88884961b1f25c9d1..9150bc3c0acefec49a7f1753b393ac52e8e98d5b 100644
--- a/package_manager/src/PathExcluder/UnknownPathExcluder.php
+++ b/package_manager/src/PathExcluder/UnknownPathExcluder.php
@@ -8,6 +8,7 @@ use Drupal\Component\Serialization\Json;
 use Drupal\package_manager\ComposerInspector;
 use Drupal\package_manager\Event\CollectPathsToExcludeEvent;
 use Drupal\package_manager\PathLocator;
+use PhpTuf\ComposerStager\Infrastructure\Factory\Path\PathFactoryInterface;
 use Symfony\Component\EventDispatcher\EventSubscriberInterface;
 
 /**
@@ -39,9 +40,12 @@ final class UnknownPathExcluder implements EventSubscriberInterface {
    *   The Composer inspector service.
    * @param \Drupal\package_manager\PathLocator $path_locator
    *   The path locator service.
+   * @param \PhpTuf\ComposerStager\Infrastructure\Factory\Path\PathFactoryInterface $path_factory
+   *   The path factory service.
    */
-  public function __construct(private readonly ComposerInspector $composerInspector, PathLocator $path_locator) {
+  public function __construct(private readonly ComposerInspector $composerInspector, PathLocator $path_locator, PathFactoryInterface $path_factory) {
     $this->pathLocator = $path_locator;
+    $this->pathFactory = $path_factory;
   }
 
   /**
diff --git a/package_manager/src/PathExcluder/VendorHardeningExcluder.php b/package_manager/src/PathExcluder/VendorHardeningExcluder.php
index a7bf69d7c90d47e47e7f8ded9c6ac834f8eccb4f..509516390a059c7518a528afb852f95376ea6e8a 100644
--- a/package_manager/src/PathExcluder/VendorHardeningExcluder.php
+++ b/package_manager/src/PathExcluder/VendorHardeningExcluder.php
@@ -6,6 +6,7 @@ namespace Drupal\package_manager\PathExcluder;
 
 use Drupal\package_manager\Event\CollectPathsToExcludeEvent;
 use Drupal\package_manager\PathLocator;
+use PhpTuf\ComposerStager\Infrastructure\Factory\Path\PathFactoryInterface;
 use Symfony\Component\EventDispatcher\EventSubscriberInterface;
 
 /**
@@ -25,9 +26,12 @@ final class VendorHardeningExcluder implements EventSubscriberInterface {
    *
    * @param \Drupal\package_manager\PathLocator $path_locator
    *   The path locator service.
+   * @param \PhpTuf\ComposerStager\Infrastructure\Factory\Path\PathFactoryInterface $path_factory
+   *   The path factory service.
    */
-  public function __construct(PathLocator $path_locator) {
+  public function __construct(PathLocator $path_locator, PathFactoryInterface $path_factory) {
     $this->pathLocator = $path_locator;
+    $this->pathFactory = $path_factory;
   }
 
   /**