@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.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, sep, relative, isAbsolute } from 'path';
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
- const prefix = baseResolved.endsWith(sep) ? baseResolved : baseResolved + sep;
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 !== baseResolved && !resolved.startsWith(baseResolved + sep)) {
891
+ if (!isInside(resolved, baseResolved)) {
888
892
  throw new PathTraversalError(`symlink ${path}`, resolved);
889
893
  }
890
894
  }