fix(settings): constrain plan path remapping (#1203)

Co-authored-by: Isaac Sanchez <isanchez-hawkins@arize.com>
This commit is contained in:
Isaac Sanchez-Hawkins
2026-05-12 11:12:17 +03:00
committed by GitHub
co-authored by Isaac Sanchez
parent 3228e7f45f
commit 89630af98d
2 changed files with 88 additions and 2 deletions
@@ -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,
};
});
};