piral-cli 1.10.0-beta.8476 → 1.10.0-beta.8484

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.
@@ -53742,6 +53742,7 @@ var SYMLINK2 = Symbol("symlink");
53742
53742
  var HARDLINK2 = Symbol("hardlink");
53743
53743
  var UNSUPPORTED = Symbol("unsupported");
53744
53744
  var CHECKPATH = Symbol("checkPath");
53745
+ var STRIPABSOLUTEPATH = Symbol("stripAbsolutePath");
53745
53746
  var MKDIR = Symbol("mkdir");
53746
53747
  var ONERROR = Symbol("onError");
53747
53748
  var PENDING = Symbol("pending");
@@ -53869,6 +53870,31 @@ var Unpack = class extends Parser {
53869
53870
  this.emit("end");
53870
53871
  }
53871
53872
  }
53873
+ // return false if we need to skip this file
53874
+ // return true if the field was successfully sanitized
53875
+ [STRIPABSOLUTEPATH](entry, field) {
53876
+ const path10 = entry[field];
53877
+ if (!path10 || this.preservePaths)
53878
+ return true;
53879
+ const parts = path10.split("/");
53880
+ if (parts.includes("..") || /* c8 ignore next */
53881
+ isWindows3 && /^[a-z]:\.\.$/i.test(parts[0] ?? "")) {
53882
+ this.warn("TAR_ENTRY_ERROR", `${field} contains '..'`, {
53883
+ entry,
53884
+ [field]: path10
53885
+ });
53886
+ return false;
53887
+ }
53888
+ const [root, stripped] = stripAbsolutePath(path10);
53889
+ if (root) {
53890
+ entry[field] = String(stripped);
53891
+ this.warn("TAR_ENTRY_INFO", `stripping ${root} from absolute ${field}`, {
53892
+ entry,
53893
+ [field]: path10
53894
+ });
53895
+ }
53896
+ return true;
53897
+ }
53872
53898
  [CHECKPATH](entry) {
53873
53899
  const p = normalizeWindowsPath(entry.path);
53874
53900
  const parts = p.split("/");
@@ -53896,23 +53922,8 @@ var Unpack = class extends Parser {
53896
53922
  });
53897
53923
  return false;
53898
53924
  }
53899
- if (!this.preservePaths) {
53900
- if (parts.includes("..") || /* c8 ignore next */
53901
- isWindows3 && /^[a-z]:\.\.$/i.test(parts[0] ?? "")) {
53902
- this.warn("TAR_ENTRY_ERROR", `path contains '..'`, {
53903
- entry,
53904
- path: p
53905
- });
53906
- return false;
53907
- }
53908
- const [root, stripped] = stripAbsolutePath(p);
53909
- if (root) {
53910
- entry.path = String(stripped);
53911
- this.warn("TAR_ENTRY_INFO", `stripping ${root} from absolute path`, {
53912
- entry,
53913
- path: p
53914
- });
53915
- }
53925
+ if (!this[STRIPABSOLUTEPATH](entry, "path") || !this[STRIPABSOLUTEPATH](entry, "linkpath")) {
53926
+ return false;
53916
53927
  }
53917
53928
  if (import_node_path8.default.isAbsolute(entry.path)) {
53918
53929
  entry.absolute = normalizeWindowsPath(import_node_path8.default.resolve(entry.path));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "piral-cli",
3
- "version": "1.10.0-beta.8476",
3
+ "version": "1.10.0-beta.8484",
4
4
  "description": "The standard CLI for creating and building a Piral instance or a Pilet.",
5
5
  "keywords": [
6
6
  "portal",
@@ -78,5 +78,5 @@
78
78
  "open": "^10",
79
79
  "typescript": "^5"
80
80
  },
81
- "gitHead": "3b6b976669e82114ce68347b9f34620fd38e5b23"
81
+ "gitHead": "935b02783f9d918bd79c93d1bcd6ad231cb9b62f"
82
82
  }