@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/cron.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, 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 { existsSync, readFileSync, realpathSync, mkdirSync, 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';
|
|
@@ -848,6 +848,11 @@ var init_atomic_write = __esm({
|
|
|
848
848
|
warnedNfsDirs = /* @__PURE__ */ new Set();
|
|
849
849
|
}
|
|
850
850
|
});
|
|
851
|
+
function isInside(target, base) {
|
|
852
|
+
if (target === base) return true;
|
|
853
|
+
const prefix = base.endsWith(sep) ? base : base + sep;
|
|
854
|
+
return target.startsWith(prefix);
|
|
855
|
+
}
|
|
851
856
|
function safePathJoin(base, ...parts) {
|
|
852
857
|
if (base === "") {
|
|
853
858
|
throw new Error("safePathJoin: base must be non-empty");
|
|
@@ -858,8 +863,7 @@ function safePathJoin(base, ...parts) {
|
|
|
858
863
|
}
|
|
859
864
|
const baseResolved = resolve(base);
|
|
860
865
|
const target = resolve(base, ...parts);
|
|
861
|
-
|
|
862
|
-
if (target !== baseResolved && !target.startsWith(prefix)) {
|
|
866
|
+
if (!isInside(target, baseResolved)) {
|
|
863
867
|
throw new PathTraversalError(parts.join("/"), target);
|
|
864
868
|
}
|
|
865
869
|
return target;
|
|
@@ -884,7 +888,7 @@ function assertNoSymlinkEscape(path, base) {
|
|
|
884
888
|
}
|
|
885
889
|
const resolved = realpathOfDeepestExisting(path);
|
|
886
890
|
if (resolved === void 0) return;
|
|
887
|
-
if (resolved
|
|
891
|
+
if (!isInside(resolved, baseResolved)) {
|
|
888
892
|
throw new PathTraversalError(`symlink ${path}`, resolved);
|
|
889
893
|
}
|
|
890
894
|
}
|