[6.x] [uiBundles/resetBundleDir] force del() if bundleDir is outside cwd (#22981) (#23002)

Backports the following commits to 6.x:
 - [uiBundles/resetBundleDir] force del() if bundleDir is outside cwd  (#22981)
This commit is contained in:
Spencer 2018-09-13 13:20:00 -07:00 committed by GitHub
parent 067e162aa8
commit a7abb848fd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -152,7 +152,12 @@ export class UiBundlesController {
await mkdirpAsync(this._workingDir);
} else {
// delete all children of the working directory
await del(this.resolvePath('*'));
await del(this.resolvePath('*'), {
// since we know that `this.resolvePath()` is going to return an absolute path based on the `optimize.bundleDir`
// and since we don't want to require that users specify a bundleDir that is within the cwd or limit the cwd
// directory used to run Kibana in any way we use force here
force: true
});
}
// write the entry/style files for each bundle