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: repository root directory validation #3598

Merged
merged 2 commits into from
Sep 9, 2021
Merged

Conversation

ehmicky
Copy link
Contributor

@ehmicky ehmicky commented Sep 8, 2021

Fixes #3431
Fixes netlify/zip-it-and-ship-it#609

This allows configuration file paths to target files outside of the base directory, providing they are inside the repository root directory.

@ehmicky ehmicky added the type: bug code to address defects in shipped code label Sep 8, 2021
@ehmicky ehmicky self-assigned this Sep 8, 2021
// However we allow file paths to be outside of the build directory, since this
// can be convenient in monorepo setups.
const validateInsideRoot = function (originalPath, path, repositoryRoot, propName) {
if (relative(repositoryRoot, path).startsWith('..') || getWindowsDrive(repositoryRoot) !== getWindowsDrive(path)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

path.relative() returns C:\\... instead of ..\... on Windows when the file paths are on different drives.

[functions]␊
directory = "functions_dir"`
Configuration property "functionsDirectory" "/external/path" must be inside the repository root directory.`
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The validation message changed.

@@ -1134,32 +1213,6 @@ Generated by [AVA](https://avajs.dev).
"directory-two/**/*.jpg"␊
]`

## functions.included_files: does not contain paths outside of the root directory
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This specific property is checked and handled by zip-it-and-ship-it instead.

@kodiakhq kodiakhq bot merged commit 57a45fd into main Sep 9, 2021
@kodiakhq kodiakhq bot deleted the fix/build-dir-check-2 branch September 9, 2021 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge type: bug code to address defects in shipped code
Projects
None yet
2 participants