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