fix(settings): constrain plan path remapping (#1203)
Co-authored-by: Isaac Sanchez <isanchez-hawkins@arize.com>
This commit is contained in:
committed by
GitHub
co-authored by
Isaac Sanchez
parent
3228e7f45f
commit
89630af98d
@@ -105,12 +105,13 @@ export const createSettingsRuntime = (deps) => {
|
||||
return entry;
|
||||
}
|
||||
const trimmedPath = entry.path.trim();
|
||||
if (!trimmedPath.startsWith(fromDir)) {
|
||||
const relativePath = path.relative(fromDir, trimmedPath);
|
||||
if (relativePath && (relativePath.startsWith('..') || path.isAbsolute(relativePath))) {
|
||||
return entry;
|
||||
}
|
||||
return {
|
||||
...entry,
|
||||
path: `${toDir}${trimmedPath.slice(fromDir.length)}`,
|
||||
path: relativePath ? path.join(toDir, relativePath) : toDir,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user