@theokit/sdk 4.19.3 → 4.19.4
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/cron.cjs +7 -3
- package/dist/cron.cjs.map +1 -1
- package/dist/cron.js +8 -4
- package/dist/cron.js.map +1 -1
- package/dist/eval.cjs +7 -3
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +8 -4
- package/dist/eval.js.map +1 -1
- package/dist/filesystem/index.cjs +7 -3
- package/dist/filesystem/index.cjs.map +1 -1
- package/dist/filesystem/index.js +7 -3
- package/dist/filesystem/index.js.map +1 -1
- package/dist/index.cjs +7 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/dist/internal/security/index.cjs +7 -3
- package/dist/internal/security/index.cjs.map +1 -1
- package/dist/internal/security/index.js +8 -4
- package/dist/internal/security/index.js.map +1 -1
- package/dist/path-safety.cjs +7 -3
- package/dist/path-safety.cjs.map +1 -1
- package/dist/path-safety.js +8 -4
- package/dist/path-safety.js.map +1 -1
- package/dist/skills.cjs +7 -3
- package/dist/skills.cjs.map +1 -1
- package/dist/skills.js +7 -3
- package/dist/skills.js.map +1 -1
- package/dist/workflow.cjs.map +1 -1
- package/dist/workflow.js.map +1 -1
- package/package.json +1 -1
package/dist/eval.js
CHANGED
|
@@ -2,7 +2,7 @@ import { z, toJSONSchema } from 'zod';
|
|
|
2
2
|
import { createRequire } from 'module';
|
|
3
3
|
import { randomUUID, randomBytes, createHash } from 'crypto';
|
|
4
4
|
import { mkdir, readFile, open, rename, unlink, writeFile, statfs, readdir, stat, access } from 'fs/promises';
|
|
5
|
-
import { join, dirname, resolve,
|
|
5
|
+
import { join, dirname, resolve, relative, sep, isAbsolute } from 'path';
|
|
6
6
|
import { readFileSync, existsSync, mkdirSync, appendFileSync, realpathSync, lstatSync, readlinkSync, readdirSync, statSync, chmodSync, openSync, writeFileSync, fsyncSync, closeSync, renameSync, unlinkSync } from 'fs';
|
|
7
7
|
import { homedir } from 'os';
|
|
8
8
|
import { fileURLToPath, pathToFileURL } from 'url';
|
|
@@ -847,6 +847,11 @@ var init_atomic_write = __esm({
|
|
|
847
847
|
warnedNfsDirs = /* @__PURE__ */ new Set();
|
|
848
848
|
}
|
|
849
849
|
});
|
|
850
|
+
function isInside(target, base) {
|
|
851
|
+
if (target === base) return true;
|
|
852
|
+
const prefix = base.endsWith(sep) ? base : base + sep;
|
|
853
|
+
return target.startsWith(prefix);
|
|
854
|
+
}
|
|
850
855
|
function safePathJoin(base, ...parts) {
|
|
851
856
|
if (base === "") {
|
|
852
857
|
throw new Error("safePathJoin: base must be non-empty");
|
|
@@ -857,8 +862,7 @@ function safePathJoin(base, ...parts) {
|
|
|
857
862
|
}
|
|
858
863
|
const baseResolved = resolve(base);
|
|
859
864
|
const target = resolve(base, ...parts);
|
|
860
|
-
|
|
861
|
-
if (target !== baseResolved && !target.startsWith(prefix)) {
|
|
865
|
+
if (!isInside(target, baseResolved)) {
|
|
862
866
|
throw new PathTraversalError(parts.join("/"), target);
|
|
863
867
|
}
|
|
864
868
|
return target;
|
|
@@ -883,7 +887,7 @@ function assertNoSymlinkEscape(path, base) {
|
|
|
883
887
|
}
|
|
884
888
|
const resolved = realpathOfDeepestExisting(path);
|
|
885
889
|
if (resolved === void 0) return;
|
|
886
|
-
if (resolved
|
|
890
|
+
if (!isInside(resolved, baseResolved)) {
|
|
887
891
|
throw new PathTraversalError(`symlink ${path}`, resolved);
|
|
888
892
|
}
|
|
889
893
|
}
|