@intlayer/config 8.9.5 → 8.9.6-canary.0
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/cjs/utils/index.cjs +2 -0
- package/dist/cjs/utils/pathSecurity.cjs +20 -0
- package/dist/cjs/utils/pathSecurity.cjs.map +1 -0
- package/dist/esm/utils/index.mjs +2 -1
- package/dist/esm/utils/pathSecurity.mjs +18 -0
- package/dist/esm/utils/pathSecurity.mjs.map +1 -0
- package/dist/types/configFile/configurationSchema.d.ts +2 -2
- package/dist/types/utils/index.d.ts +2 -1
- package/dist/types/utils/pathSecurity.d.ts +11 -0
- package/dist/types/utils/pathSecurity.d.ts.map +1 -0
- package/package.json +3 -3
package/dist/cjs/utils/index.cjs
CHANGED
|
@@ -13,6 +13,7 @@ const require_utils_getStorageAttributes = require('./getStorageAttributes.cjs')
|
|
|
13
13
|
const require_utils_getUsedNodeTypes = require('./getUsedNodeTypes.cjs');
|
|
14
14
|
const require_utils_logStack = require('./logStack.cjs');
|
|
15
15
|
const require_utils_parseFilePathPattern = require('./parseFilePathPattern.cjs');
|
|
16
|
+
const require_utils_pathSecurity = require('./pathSecurity.cjs');
|
|
16
17
|
const require_utils_retryManager = require('./retryManager.cjs');
|
|
17
18
|
const require_utils_setIntlayerIdentifier = require('./setIntlayerIdentifier.cjs');
|
|
18
19
|
const require_utils_stringFormatter_camelCaseToKebabCase = require('./stringFormatter/camelCaseToKebabCase.cjs');
|
|
@@ -20,6 +21,7 @@ const require_utils_stringFormatter_camelCaseToSentence = require('./stringForma
|
|
|
20
21
|
const require_utils_stringFormatter_kebabCaseToCamelCase = require('./stringFormatter/kebabCaseToCamelCase.cjs');
|
|
21
22
|
const require_utils_stringFormatter_toLowerCamelCase = require('./stringFormatter/toLowerCamelCase.cjs');
|
|
22
23
|
|
|
24
|
+
exports.assertPathWithin = require_utils_pathSecurity.assertPathWithin;
|
|
23
25
|
exports.cacheDisk = require_utils_cacheDisk.cacheDisk;
|
|
24
26
|
exports.cacheMemory = require_utils_cacheMemory.cacheMemory;
|
|
25
27
|
exports.camelCaseToKebabCase = require_utils_stringFormatter_camelCaseToKebabCase.camelCaseToKebabCase;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
let node_path = require("node:path");
|
|
4
|
+
|
|
5
|
+
//#region src/utils/pathSecurity.ts
|
|
6
|
+
/**
|
|
7
|
+
* Throws if `resolvedPath` escapes `baseDir`.
|
|
8
|
+
* Use this before any file operation whose path is derived from user-controlled
|
|
9
|
+
* input (e.g. dictionary keys, filePath fields from dictionary data) to prevent
|
|
10
|
+
* path-traversal attacks.
|
|
11
|
+
*/
|
|
12
|
+
const assertPathWithin = (resolvedPath, baseDir) => {
|
|
13
|
+
const normalizedBase = (0, node_path.resolve)(baseDir);
|
|
14
|
+
const normalizedPath = (0, node_path.resolve)(resolvedPath);
|
|
15
|
+
if (normalizedPath !== normalizedBase && !normalizedPath.startsWith(normalizedBase + node_path.sep)) throw new Error(`Path traversal detected: "${resolvedPath}" escapes the base directory "${baseDir}"`);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
exports.assertPathWithin = assertPathWithin;
|
|
20
|
+
//# sourceMappingURL=pathSecurity.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pathSecurity.cjs","names":["sep"],"sources":["../../../src/utils/pathSecurity.ts"],"sourcesContent":["import { resolve, sep } from 'node:path';\n\n/**\n * Throws if `resolvedPath` escapes `baseDir`.\n * Use this before any file operation whose path is derived from user-controlled\n * input (e.g. dictionary keys, filePath fields from dictionary data) to prevent\n * path-traversal attacks.\n */\nexport const assertPathWithin = (\n resolvedPath: string,\n baseDir: string\n): void => {\n const normalizedBase = resolve(baseDir);\n const normalizedPath = resolve(resolvedPath);\n if (\n normalizedPath !== normalizedBase &&\n !normalizedPath.startsWith(normalizedBase + sep)\n ) {\n throw new Error(\n `Path traversal detected: \"${resolvedPath}\" escapes the base directory \"${baseDir}\"`\n );\n }\n};\n"],"mappings":";;;;;;;;;;;AAQA,MAAa,oBACX,cACA,YACS;CACT,MAAM,wCAAyB,QAAQ;CACvC,MAAM,wCAAyB,aAAa;CAC5C,IACE,mBAAmB,kBACnB,CAAC,eAAe,WAAW,iBAAiBA,cAAI,EAEhD,MAAM,IAAI,MACR,6BAA6B,aAAa,gCAAgC,QAAQ,GACnF"}
|
package/dist/esm/utils/index.mjs
CHANGED
|
@@ -12,6 +12,7 @@ import { getStorageAttributes } from "./getStorageAttributes.mjs";
|
|
|
12
12
|
import { getUnusedNodeTypes, getUnusedNodeTypesAsync, getUsedNodeTypes, getUsedNodeTypesAsync } from "./getUsedNodeTypes.mjs";
|
|
13
13
|
import { logStack } from "./logStack.mjs";
|
|
14
14
|
import { parseFilePathPattern, parseStringPattern } from "./parseFilePathPattern.mjs";
|
|
15
|
+
import { assertPathWithin } from "./pathSecurity.mjs";
|
|
15
16
|
import { retryManager } from "./retryManager.mjs";
|
|
16
17
|
import { setIntlayerIdentifier } from "./setIntlayerIdentifier.mjs";
|
|
17
18
|
import { camelCaseToKebabCase } from "./stringFormatter/camelCaseToKebabCase.mjs";
|
|
@@ -19,4 +20,4 @@ import { camelCaseToSentence } from "./stringFormatter/camelCaseToSentence.mjs";
|
|
|
19
20
|
import { kebabCaseToCamelCase } from "./stringFormatter/kebabCaseToCamelCase.mjs";
|
|
20
21
|
import { toLowerCamelCase } from "./stringFormatter/toLowerCamelCase.mjs";
|
|
21
22
|
|
|
22
|
-
export { cacheDisk, cacheMemory, camelCaseToKebabCase, camelCaseToSentence, clearAllCache, clearCache, clearDiskCacheMemory, clearModuleCache, compareVersions, computeKeyId, configESMxCJSRequire, extractErrorMessage, getAlias, getCache, getExtension, getPackageJsonPath, getProjectRequire, getStorageAttributes, getUnusedNodeTypes, getUnusedNodeTypesAsync, getUsedNodeTypes, getUsedNodeTypesAsync, isESModule, kebabCaseToCamelCase, logStack, normalizePath, parseFilePathPattern, parseStringPattern, retryManager, setCache, setIntlayerIdentifier, stableStringify, toLowerCamelCase };
|
|
23
|
+
export { assertPathWithin, cacheDisk, cacheMemory, camelCaseToKebabCase, camelCaseToSentence, clearAllCache, clearCache, clearDiskCacheMemory, clearModuleCache, compareVersions, computeKeyId, configESMxCJSRequire, extractErrorMessage, getAlias, getCache, getExtension, getPackageJsonPath, getProjectRequire, getStorageAttributes, getUnusedNodeTypes, getUnusedNodeTypesAsync, getUsedNodeTypes, getUsedNodeTypesAsync, isESModule, kebabCaseToCamelCase, logStack, normalizePath, parseFilePathPattern, parseStringPattern, retryManager, setCache, setIntlayerIdentifier, stableStringify, toLowerCamelCase };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { resolve, sep } from "node:path";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/pathSecurity.ts
|
|
4
|
+
/**
|
|
5
|
+
* Throws if `resolvedPath` escapes `baseDir`.
|
|
6
|
+
* Use this before any file operation whose path is derived from user-controlled
|
|
7
|
+
* input (e.g. dictionary keys, filePath fields from dictionary data) to prevent
|
|
8
|
+
* path-traversal attacks.
|
|
9
|
+
*/
|
|
10
|
+
const assertPathWithin = (resolvedPath, baseDir) => {
|
|
11
|
+
const normalizedBase = resolve(baseDir);
|
|
12
|
+
const normalizedPath = resolve(resolvedPath);
|
|
13
|
+
if (normalizedPath !== normalizedBase && !normalizedPath.startsWith(normalizedBase + sep)) throw new Error(`Path traversal detected: "${resolvedPath}" escapes the base directory "${baseDir}"`);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
export { assertPathWithin };
|
|
18
|
+
//# sourceMappingURL=pathSecurity.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pathSecurity.mjs","names":[],"sources":["../../../src/utils/pathSecurity.ts"],"sourcesContent":["import { resolve, sep } from 'node:path';\n\n/**\n * Throws if `resolvedPath` escapes `baseDir`.\n * Use this before any file operation whose path is derived from user-controlled\n * input (e.g. dictionary keys, filePath fields from dictionary data) to prevent\n * path-traversal attacks.\n */\nexport const assertPathWithin = (\n resolvedPath: string,\n baseDir: string\n): void => {\n const normalizedBase = resolve(baseDir);\n const normalizedPath = resolve(resolvedPath);\n if (\n normalizedPath !== normalizedBase &&\n !normalizedPath.startsWith(normalizedBase + sep)\n ) {\n throw new Error(\n `Path traversal detected: \"${resolvedPath}\" escapes the base directory \"${baseDir}\"`\n );\n }\n};\n"],"mappings":";;;;;;;;;AAQA,MAAa,oBACX,cACA,YACS;CACT,MAAM,iBAAiB,QAAQ,QAAQ;CACvC,MAAM,iBAAiB,QAAQ,aAAa;CAC5C,IACE,mBAAmB,kBACnB,CAAC,eAAe,WAAW,iBAAiB,IAAI,EAEhD,MAAM,IAAI,MACR,6BAA6B,aAAa,gCAAgC,QAAQ,GACnF"}
|
|
@@ -272,8 +272,8 @@ declare const buildSchema: z.ZodObject<{
|
|
|
272
272
|
}>>;
|
|
273
273
|
traversePattern: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
274
274
|
outputFormat: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
275
|
-
esm: "esm";
|
|
276
275
|
cjs: "cjs";
|
|
276
|
+
esm: "esm";
|
|
277
277
|
}>>>;
|
|
278
278
|
cache: z.ZodOptional<z.ZodBoolean>;
|
|
279
279
|
require: z.ZodOptional<z.ZodUnknown>;
|
|
@@ -467,8 +467,8 @@ declare const intlayerConfigSchema: z.ZodObject<{
|
|
|
467
467
|
}>>;
|
|
468
468
|
traversePattern: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
469
469
|
outputFormat: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
470
|
-
esm: "esm";
|
|
471
470
|
cjs: "cjs";
|
|
471
|
+
esm: "esm";
|
|
472
472
|
}>>>;
|
|
473
473
|
cache: z.ZodOptional<z.ZodBoolean>;
|
|
474
474
|
require: z.ZodOptional<z.ZodUnknown>;
|
|
@@ -17,5 +17,6 @@ import { getPackageJsonPath } from "./getPackageJsonPath.js";
|
|
|
17
17
|
import { getStorageAttributes } from "./getStorageAttributes.js";
|
|
18
18
|
import { PluginNodeType, getUnusedNodeTypes, getUnusedNodeTypesAsync, getUsedNodeTypes, getUsedNodeTypesAsync } from "./getUsedNodeTypes.js";
|
|
19
19
|
import { parseFilePathPattern, parseStringPattern } from "./parseFilePathPattern.js";
|
|
20
|
+
import { assertPathWithin } from "./pathSecurity.js";
|
|
20
21
|
import { RetryManagerOptions, retryManager } from "./retryManager.js";
|
|
21
|
-
export { CacheKey, GetAliasOptions, PluginNodeType, RetryManagerOptions, WindowsWithIntlayer, cacheDisk, cacheMemory, camelCaseToKebabCase, camelCaseToSentence, clearAllCache, clearCache, clearDiskCacheMemory, clearModuleCache, compareVersions, computeKeyId, configESMxCJSRequire, extractErrorMessage, getAlias, getCache, getExtension, getPackageJsonPath, getProjectRequire, getStorageAttributes, getUnusedNodeTypes, getUnusedNodeTypesAsync, getUsedNodeTypes, getUsedNodeTypesAsync, isESModule, kebabCaseToCamelCase, logStack, normalizePath, parseFilePathPattern, parseStringPattern, retryManager, setCache, setIntlayerIdentifier, stableStringify, toLowerCamelCase };
|
|
22
|
+
export { CacheKey, GetAliasOptions, PluginNodeType, RetryManagerOptions, WindowsWithIntlayer, assertPathWithin, cacheDisk, cacheMemory, camelCaseToKebabCase, camelCaseToSentence, clearAllCache, clearCache, clearDiskCacheMemory, clearModuleCache, compareVersions, computeKeyId, configESMxCJSRequire, extractErrorMessage, getAlias, getCache, getExtension, getPackageJsonPath, getProjectRequire, getStorageAttributes, getUnusedNodeTypes, getUnusedNodeTypesAsync, getUsedNodeTypes, getUsedNodeTypesAsync, isESModule, kebabCaseToCamelCase, logStack, normalizePath, parseFilePathPattern, parseStringPattern, retryManager, setCache, setIntlayerIdentifier, stableStringify, toLowerCamelCase };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/utils/pathSecurity.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Throws if `resolvedPath` escapes `baseDir`.
|
|
4
|
+
* Use this before any file operation whose path is derived from user-controlled
|
|
5
|
+
* input (e.g. dictionary keys, filePath fields from dictionary data) to prevent
|
|
6
|
+
* path-traversal attacks.
|
|
7
|
+
*/
|
|
8
|
+
declare const assertPathWithin: (resolvedPath: string, baseDir: string) => void;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { assertPathWithin };
|
|
11
|
+
//# sourceMappingURL=pathSecurity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pathSecurity.d.ts","names":[],"sources":["../../../src/utils/pathSecurity.ts"],"mappings":";;AAQA;;;;;cAAa,gBAAA,GACX,YAAA,UACA,OAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/config",
|
|
3
|
-
"version": "8.9.
|
|
3
|
+
"version": "8.9.6-canary.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Retrieve Intlayer configurations and manage environment variables for both server-side and client-side environments.",
|
|
6
6
|
"keywords": [
|
|
@@ -160,7 +160,7 @@
|
|
|
160
160
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
161
161
|
},
|
|
162
162
|
"dependencies": {
|
|
163
|
-
"@intlayer/types": "8.9.
|
|
163
|
+
"@intlayer/types": "8.9.6-canary.0",
|
|
164
164
|
"defu": "6.1.7",
|
|
165
165
|
"dotenv": "17.4.2",
|
|
166
166
|
"esbuild": "0.28.0",
|
|
@@ -168,7 +168,7 @@
|
|
|
168
168
|
"zod": "4.4.3"
|
|
169
169
|
},
|
|
170
170
|
"devDependencies": {
|
|
171
|
-
"@types/node": "25.
|
|
171
|
+
"@types/node": "25.8.0",
|
|
172
172
|
"@utils/ts-config": "1.0.4",
|
|
173
173
|
"@utils/ts-config-types": "1.0.4",
|
|
174
174
|
"@utils/tsdown-config": "1.0.4",
|