@remnic/core 9.3.583 → 9.3.584
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +11 -1
- package/dist/index.js.map +1 -1
- package/dist/schemas.d.ts +22 -22
- package/dist/transfer/types.d.ts +12 -12
- package/package.json +1 -1
- package/src/projection/index.test.ts +28 -0
- package/src/projection/index.ts +12 -1
package/dist/index.js
CHANGED
|
@@ -1771,7 +1771,7 @@ async function generateContextTree(options) {
|
|
|
1771
1771
|
const resolvedMemoryDir = path5.resolve(memoryDir);
|
|
1772
1772
|
const resolvedOutputDir = path5.resolve(outputDir);
|
|
1773
1773
|
const requestedCategories = validateProjectionCategories(filterCategories);
|
|
1774
|
-
const realMemoryDir =
|
|
1774
|
+
const realMemoryDir = assertSafeMemoryRoot(resolvedMemoryDir);
|
|
1775
1775
|
assertNotSymlink(resolvedOutputDir, "context tree outputDir");
|
|
1776
1776
|
fs.mkdirSync(resolvedOutputDir, { recursive: true });
|
|
1777
1777
|
const realOutputDir = fs.realpathSync(resolvedOutputDir);
|
|
@@ -1885,6 +1885,16 @@ function assertNotSymlink(targetPath, label) {
|
|
|
1885
1885
|
throw err;
|
|
1886
1886
|
}
|
|
1887
1887
|
}
|
|
1888
|
+
function assertSafeMemoryRoot(targetPath) {
|
|
1889
|
+
const stat = fs.lstatSync(targetPath);
|
|
1890
|
+
if (stat.isSymbolicLink()) {
|
|
1891
|
+
throw new Error(`memoryDir must not be a symlink: ${targetPath}`);
|
|
1892
|
+
}
|
|
1893
|
+
if (!stat.isDirectory()) {
|
|
1894
|
+
throw new Error(`memoryDir must be a directory: ${targetPath}`);
|
|
1895
|
+
}
|
|
1896
|
+
return fs.realpathSync(targetPath);
|
|
1897
|
+
}
|
|
1888
1898
|
function assertSafeInputRoot(realMemoryDir, targetPath, label) {
|
|
1889
1899
|
const stat = fs.lstatSync(targetPath);
|
|
1890
1900
|
if (stat.isSymbolicLink()) {
|