Skip to content

Commit

Permalink
Add check to validate mount path before passing it as an arg in EE (a…
Browse files Browse the repository at this point in the history
  • Loading branch information
priyamsahoo authored Jun 7, 2022
1 parent b4bcd5a commit 19c3dc6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/changelog-fragments.d/345.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Added validation of mount path before passing it as an argument to wrap the
commands in execution environment -- by {user}`priyamsahoo`
8 changes: 8 additions & 0 deletions src/services/executionEnvironment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,14 @@ export class ExecutionEnvironment {
);

for (const mountPath of mountPaths || []) {
// push to array only if mount path is valid
if (mountPath === "" || !fs.existsSync(mountPath)) {
this.connection.console.error(
`Volume mount source path '${mountPath}' does not exist. Ignoring this volume mount entry.`
);
continue;
}

const volumeMountPath = `${mountPath}:${mountPath}`;
if (containerCommand.includes(volumeMountPath)) {
continue;
Expand Down

0 comments on commit 19c3dc6

Please sign in to comment.