Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(pluginHandlers): properly check if path is inside another #1014

Merged
merged 1 commit into from
Jul 8, 2020

Conversation

raphinesse
Copy link
Contributor

@raphinesse raphinesse commented Jul 2, 2020

Motivation and Context

The current check for "Is path A inside path B?" relies solely on prefix checking. In general, that is not robust enough.

A real-world example where it fails, is when Api.createPlatform is called with a destination that is outside of process.cwd(). For example a temp dir during a test. This occurred when refactoring E2E tests.

This relies on proper test cleanup as implemented in #1013.

Description

Use is-path-inside library.

Testing

  • Api.createPlatform now works as expected
  • added regression test
    The new test calls copyFile with the same arguments as Test#006 and Test#007 with the sole difference that the project dir is relative to the current dir.

@raphinesse raphinesse added the bug label Jul 2, 2020
@raphinesse raphinesse requested review from erisu and breautek July 2, 2020 21:46
@raphinesse raphinesse added this to the 9.0.1 milestone Jul 3, 2020
@raphinesse raphinesse requested a review from timbru31 July 8, 2020 13:38
@raphinesse raphinesse merged commit 8ef8d99 into apache:master Jul 8, 2020
@raphinesse raphinesse deleted the is-path-inside branch July 8, 2020 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants