fix: skip snapshotting ../imports outside config dir to prevent rollback overwriting unrelated files

Co-Authored-By: mantra <mantra@stack-auth.com>
This commit is contained in:
Devin AI 2026-06-03 19:37:58 +00:00
parent 57e01d5720
commit 1b036b6915

View File

@ -201,7 +201,9 @@ function snapshotConfigFiles(configFilePath: string, configContent: string): Con
const dir = path.dirname(configFilePath);
const snapshots: ConfigFileSnapshot[] = [{ path: path.resolve(configFilePath), content: configContent }];
for (const specifier of getRelativeImportSpecifiers(configContent)) {
captureSnapshotIfAbsent(snapshots, path.resolve(dir, specifier));
const resolved = path.resolve(dir, specifier);
if (!isPathInsideDir(dir, resolved)) continue;
captureSnapshotIfAbsent(snapshots, resolved);
}
return snapshots;
}