Harden PathExclusionsTrait::excludeInProjectRoot() for paths outside of project root.

Created on 29 December 2022, over 1 year ago
Updated 25 January 2023, over 1 year ago

Problem/Motivation

This method is designed for excluding files in the project root. Hence
every specified path must either be relative OR be absolute inside of
the project root.

So we want to harden it and make it less confusing.

Steps to reproduce

Proposed resolution

Absolute path outside of the project root should trigger an exception and update the Excluders which assumed otherwise.

      if (str_starts_with($path, '/') || str_starts_with($path, 'vfs:')) {
        if (!str_starts_with($path, $project_root)) {
          throw new \LogicException("$path is not inside the project root: $project_root.");
        }
      }
 

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Fixed

Version

2.0

Component

Code

Created by

🇮🇳India omkar.podey

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024