@@ -18,9 +18,19 @@ "use strict"; | ||
| }); | ||
| var __importStar = (this && this.__importStar) || function (mod) { | ||
| if (mod && mod.__esModule) return mod; | ||
| var result = {}; | ||
| if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
| __setModuleDefault(result, mod); | ||
| return result; | ||
| }; | ||
| var __importStar = (this && this.__importStar) || (function () { | ||
| var ownKeys = function(o) { | ||
| ownKeys = Object.getOwnPropertyNames || function (o) { | ||
| var ar = []; | ||
| for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; | ||
| return ar; | ||
| }; | ||
| return ownKeys(o); | ||
| }; | ||
| return function (mod) { | ||
| if (mod && mod.__esModule) return mod; | ||
| var result = {}; | ||
| if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); | ||
| __setModuleDefault(result, mod); | ||
| return result; | ||
| }; | ||
| })(); | ||
| var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -27,0 +37,0 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; |
@@ -1,3 +0,1 @@ | ||
| /// <reference types="node" /> | ||
| /// <reference types="node" /> | ||
| import type { EntryTypeCode, EntryTypeName } from './types.js'; | ||
@@ -4,0 +2,0 @@ export type HeaderData = { |
@@ -22,9 +22,19 @@ "use strict"; | ||
| }); | ||
| var __importStar = (this && this.__importStar) || function (mod) { | ||
| if (mod && mod.__esModule) return mod; | ||
| var result = {}; | ||
| if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
| __setModuleDefault(result, mod); | ||
| return result; | ||
| }; | ||
| var __importStar = (this && this.__importStar) || (function () { | ||
| var ownKeys = function(o) { | ||
| ownKeys = Object.getOwnPropertyNames || function (o) { | ||
| var ar = []; | ||
| for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; | ||
| return ar; | ||
| }; | ||
| return ownKeys(o); | ||
| }; | ||
| return function (mod) { | ||
| if (mod && mod.__esModule) return mod; | ||
| var result = {}; | ||
| if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); | ||
| __setModuleDefault(result, mod); | ||
| return result; | ||
| }; | ||
| })(); | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -31,0 +41,0 @@ exports.Header = void 0; |
@@ -21,9 +21,19 @@ "use strict"; | ||
| }; | ||
| var __importStar = (this && this.__importStar) || function (mod) { | ||
| if (mod && mod.__esModule) return mod; | ||
| var result = {}; | ||
| if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
| __setModuleDefault(result, mod); | ||
| return result; | ||
| }; | ||
| var __importStar = (this && this.__importStar) || (function () { | ||
| var ownKeys = function(o) { | ||
| ownKeys = Object.getOwnPropertyNames || function (o) { | ||
| var ar = []; | ||
| for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; | ||
| return ar; | ||
| }; | ||
| return ownKeys(o); | ||
| }; | ||
| return function (mod) { | ||
| if (mod && mod.__esModule) return mod; | ||
| var result = {}; | ||
| if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); | ||
| __setModuleDefault(result, mod); | ||
| return result; | ||
| }; | ||
| })(); | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -30,0 +40,0 @@ exports.u = exports.types = exports.r = exports.t = exports.x = exports.c = void 0; |
@@ -1,5 +0,3 @@ | ||
| /// <reference types="node" /> | ||
| /// <reference types="node" /> | ||
| export declare const encode: (num: number, buf: Buffer) => Buffer; | ||
| export declare const encode: (num: number, buf: Buffer) => Buffer<ArrayBufferLike>; | ||
| export declare const parse: (buf: Buffer) => number; | ||
| //# sourceMappingURL=large-numbers.d.ts.map |
@@ -18,9 +18,19 @@ "use strict"; | ||
| }); | ||
| var __importStar = (this && this.__importStar) || function (mod) { | ||
| if (mod && mod.__esModule) return mod; | ||
| var result = {}; | ||
| if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
| __setModuleDefault(result, mod); | ||
| return result; | ||
| }; | ||
| var __importStar = (this && this.__importStar) || (function () { | ||
| var ownKeys = function(o) { | ||
| ownKeys = Object.getOwnPropertyNames || function (o) { | ||
| var ar = []; | ||
| for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; | ||
| return ar; | ||
| }; | ||
| return ownKeys(o); | ||
| }; | ||
| return function (mod) { | ||
| if (mod && mod.__esModule) return mod; | ||
| var result = {}; | ||
| if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); | ||
| __setModuleDefault(result, mod); | ||
| return result; | ||
| }; | ||
| })(); | ||
| var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -27,0 +37,0 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; |
@@ -1,2 +0,1 @@ | ||
| /// <reference types="node" /> | ||
| import { CwdError } from './cwd-error.js'; | ||
@@ -3,0 +2,0 @@ import { SymlinkError } from './symlink-error.js'; |
@@ -1,2 +0,1 @@ | ||
| /// <reference types="node" /> | ||
| import { type GzipOptions, type ZlibOptions } from 'minizlib'; | ||
@@ -588,35 +587,11 @@ import { type Stats } from 'node:fs'; | ||
| export type TarOptionsWithAliasesAsyncNoFile = TarOptionsWithAliasesAsync & TarOptionsWithAliasesNoFile; | ||
| export declare const isSyncFile: <O extends TarOptions>(o: O) => o is O & TarOptions & { | ||
| sync: true; | ||
| } & { | ||
| file: string; | ||
| }; | ||
| export declare const isAsyncFile: <O extends TarOptions>(o: O) => o is O & TarOptions & { | ||
| sync?: false | undefined; | ||
| } & { | ||
| file: string; | ||
| }; | ||
| export declare const isSyncNoFile: <O extends TarOptions>(o: O) => o is O & TarOptions & { | ||
| sync: true; | ||
| } & { | ||
| file?: undefined; | ||
| }; | ||
| export declare const isAsyncNoFile: <O extends TarOptions>(o: O) => o is O & TarOptions & { | ||
| sync?: false | undefined; | ||
| } & { | ||
| file?: undefined; | ||
| }; | ||
| export declare const isSync: <O extends TarOptions>(o: O) => o is O & TarOptions & { | ||
| sync: true; | ||
| }; | ||
| export declare const isAsync: <O extends TarOptions>(o: O) => o is O & TarOptions & { | ||
| sync?: false | undefined; | ||
| }; | ||
| export declare const isFile: <O extends TarOptions>(o: O) => o is O & TarOptions & { | ||
| file: string; | ||
| }; | ||
| export declare const isNoFile: <O extends TarOptions>(o: O) => o is O & TarOptions & { | ||
| file?: undefined; | ||
| }; | ||
| export declare const isSyncFile: <O extends TarOptions>(o: O) => o is O & TarOptionsSyncFile; | ||
| export declare const isAsyncFile: <O extends TarOptions>(o: O) => o is O & TarOptionsAsyncFile; | ||
| export declare const isSyncNoFile: <O extends TarOptions>(o: O) => o is O & TarOptionsSyncNoFile; | ||
| export declare const isAsyncNoFile: <O extends TarOptions>(o: O) => o is O & TarOptionsAsyncNoFile; | ||
| export declare const isSync: <O extends TarOptions>(o: O) => o is O & TarOptionsSync; | ||
| export declare const isAsync: <O extends TarOptions>(o: O) => o is O & TarOptionsAsync; | ||
| export declare const isFile: <O extends TarOptions>(o: O) => o is O & TarOptionsFile; | ||
| export declare const isNoFile: <O extends TarOptions>(o: O) => o is O & TarOptionsNoFile; | ||
| export declare const dealias: (opt?: TarOptionsWithAliases) => TarOptions; | ||
| //# sourceMappingURL=options.d.ts.map |
@@ -1,4 +0,1 @@ | ||
| /// <reference types="node" /> | ||
| /// <reference types="node" /> | ||
| /// <reference types="node" /> | ||
| import { type Stats } from 'fs'; | ||
@@ -5,0 +2,0 @@ import { WriteEntry, WriteEntrySync, WriteEntryTar } from './write-entry.js'; |
@@ -26,9 +26,19 @@ "use strict"; | ||
| }); | ||
| var __importStar = (this && this.__importStar) || function (mod) { | ||
| if (mod && mod.__esModule) return mod; | ||
| var result = {}; | ||
| if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
| __setModuleDefault(result, mod); | ||
| return result; | ||
| }; | ||
| var __importStar = (this && this.__importStar) || (function () { | ||
| var ownKeys = function(o) { | ||
| ownKeys = Object.getOwnPropertyNames || function (o) { | ||
| var ar = []; | ||
| for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; | ||
| return ar; | ||
| }; | ||
| return ownKeys(o); | ||
| }; | ||
| return function (mod) { | ||
| if (mod && mod.__esModule) return mod; | ||
| var result = {}; | ||
| if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); | ||
| __setModuleDefault(result, mod); | ||
| return result; | ||
| }; | ||
| })(); | ||
| var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -35,0 +45,0 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; |
@@ -1,4 +0,1 @@ | ||
| /// <reference types="node" /> | ||
| /// <reference types="node" /> | ||
| /// <reference types="node" /> | ||
| import { EventEmitter as EE } from 'events'; | ||
@@ -5,0 +2,0 @@ import { BrotliDecompress, Unzip, ZstdDecompress } from 'minizlib'; |
@@ -1,3 +0,1 @@ | ||
| /// <reference types="node" /> | ||
| /// <reference types="node" /> | ||
| import { HeaderData } from './header.js'; | ||
@@ -23,3 +21,3 @@ export declare class Pax implements HeaderData { | ||
| constructor(obj: HeaderData, global?: boolean); | ||
| encode(): Buffer; | ||
| encode(): Buffer<ArrayBuffer>; | ||
| encodeBody(): string; | ||
@@ -26,0 +24,0 @@ encodeField(field: keyof Pax): string; |
@@ -1,3 +0,1 @@ | ||
| /// <reference types="node" /> | ||
| /// <reference types="node" /> | ||
| import { Minipass } from 'minipass'; | ||
@@ -4,0 +2,0 @@ import { Header } from './header.js'; |
@@ -1,2 +0,1 @@ | ||
| /// <reference types="node" /> | ||
| import { type Stats } from 'node:fs'; | ||
@@ -21,2 +20,3 @@ import { MkdirError } from './mkdir.js'; | ||
| declare const CHECKPATH: unique symbol; | ||
| declare const STRIPABSOLUTEPATH: unique symbol; | ||
| declare const MKDIR: unique symbol; | ||
@@ -66,2 +66,3 @@ declare const ONERROR: unique symbol; | ||
| [MAYBECLOSE](): void; | ||
| [STRIPABSOLUTEPATH](entry: ReadEntry, field: 'path' | 'linkpath'): boolean; | ||
| [CHECKPATH](entry: ReadEntry): boolean; | ||
@@ -68,0 +69,0 @@ [ONENTRY](entry: ReadEntry): void; |
+50
-26
@@ -23,9 +23,19 @@ "use strict"; | ||
| }); | ||
| var __importStar = (this && this.__importStar) || function (mod) { | ||
| if (mod && mod.__esModule) return mod; | ||
| var result = {}; | ||
| if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
| __setModuleDefault(result, mod); | ||
| return result; | ||
| }; | ||
| var __importStar = (this && this.__importStar) || (function () { | ||
| var ownKeys = function(o) { | ||
| ownKeys = Object.getOwnPropertyNames || function (o) { | ||
| var ar = []; | ||
| for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; | ||
| return ar; | ||
| }; | ||
| return ownKeys(o); | ||
| }; | ||
| return function (mod) { | ||
| if (mod && mod.__esModule) return mod; | ||
| var result = {}; | ||
| if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); | ||
| __setModuleDefault(result, mod); | ||
| return result; | ||
| }; | ||
| })(); | ||
| var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -60,2 +70,3 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
| const CHECKPATH = Symbol('checkPath'); | ||
| const STRIPABSOLUTEPATH = Symbol('stripAbsolutePath'); | ||
| const MKDIR = Symbol('mkdir'); | ||
@@ -244,2 +255,31 @@ const ONERROR = Symbol('onError'); | ||
| } | ||
| // return false if we need to skip this file | ||
| // return true if the field was successfully sanitized | ||
| [STRIPABSOLUTEPATH](entry, field) { | ||
| const path = entry[field]; | ||
| if (!path || this.preservePaths) | ||
| return true; | ||
| const parts = path.split('/'); | ||
| if (parts.includes('..') || | ||
| /* c8 ignore next */ | ||
| (isWindows && /^[a-z]:\.\.$/i.test(parts[0] ?? ''))) { | ||
| this.warn('TAR_ENTRY_ERROR', `${field} contains '..'`, { | ||
| entry, | ||
| [field]: path, | ||
| }); | ||
| // not ok! | ||
| return false; | ||
| } | ||
| // strip off the root | ||
| const [root, stripped] = (0, strip_absolute_path_js_1.stripAbsolutePath)(path); | ||
| if (root) { | ||
| // ok, but triggers warning about stripping root | ||
| entry[field] = String(stripped); | ||
| this.warn('TAR_ENTRY_INFO', `stripping ${root} from absolute ${field}`, { | ||
| entry, | ||
| [field]: path, | ||
| }); | ||
| } | ||
| return true; | ||
| } | ||
| [CHECKPATH](entry) { | ||
@@ -273,21 +313,5 @@ const p = (0, normalize_windows_path_js_1.normalizeWindowsPath)(entry.path); | ||
| } | ||
| if (!this.preservePaths) { | ||
| if (parts.includes('..') || | ||
| /* c8 ignore next */ | ||
| (isWindows && /^[a-z]:\.\.$/i.test(parts[0] ?? ''))) { | ||
| this.warn('TAR_ENTRY_ERROR', `path contains '..'`, { | ||
| entry, | ||
| path: p, | ||
| }); | ||
| return false; | ||
| } | ||
| // strip off the root | ||
| const [root, stripped] = (0, strip_absolute_path_js_1.stripAbsolutePath)(p); | ||
| if (root) { | ||
| entry.path = String(stripped); | ||
| this.warn('TAR_ENTRY_INFO', `stripping ${root} from absolute path`, { | ||
| entry, | ||
| path: p, | ||
| }); | ||
| } | ||
| if (!this[STRIPABSOLUTEPATH](entry, 'path') || | ||
| !this[STRIPABSOLUTEPATH](entry, 'linkpath')) { | ||
| return false; | ||
| } | ||
@@ -294,0 +318,0 @@ if (node_path_1.default.isAbsolute(entry.path)) { |
@@ -1,3 +0,1 @@ | ||
| /// <reference types="node" /> | ||
| /// <reference types="node" /> | ||
| import { type Minipass } from 'minipass'; | ||
@@ -4,0 +2,0 @@ /** has a warn method */ |
@@ -1,5 +0,1 @@ | ||
| /// <reference types="node" /> | ||
| /// <reference types="node" /> | ||
| /// <reference types="node" /> | ||
| /// <reference types="node" /> | ||
| import { type Stats } from 'fs'; | ||
@@ -6,0 +2,0 @@ import { Minipass } from 'minipass'; |
@@ -18,9 +18,19 @@ "use strict"; | ||
| }); | ||
| var __importStar = (this && this.__importStar) || function (mod) { | ||
| if (mod && mod.__esModule) return mod; | ||
| var result = {}; | ||
| if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
| __setModuleDefault(result, mod); | ||
| return result; | ||
| }; | ||
| var __importStar = (this && this.__importStar) || (function () { | ||
| var ownKeys = function(o) { | ||
| ownKeys = Object.getOwnPropertyNames || function (o) { | ||
| var ar = []; | ||
| for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; | ||
| return ar; | ||
| }; | ||
| return ownKeys(o); | ||
| }; | ||
| return function (mod) { | ||
| if (mod && mod.__esModule) return mod; | ||
| var result = {}; | ||
| if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); | ||
| __setModuleDefault(result, mod); | ||
| return result; | ||
| }; | ||
| })(); | ||
| var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -27,0 +37,0 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; |
@@ -1,3 +0,1 @@ | ||
| /// <reference types="node" resolution-mode="require"/> | ||
| /// <reference types="node" resolution-mode="require"/> | ||
| import type { EntryTypeCode, EntryTypeName } from './types.js'; | ||
@@ -4,0 +2,0 @@ export type HeaderData = { |
@@ -1,5 +0,3 @@ | ||
| /// <reference types="node" resolution-mode="require"/> | ||
| /// <reference types="node" resolution-mode="require"/> | ||
| export declare const encode: (num: number, buf: Buffer) => Buffer; | ||
| export declare const encode: (num: number, buf: Buffer) => Buffer<ArrayBufferLike>; | ||
| export declare const parse: (buf: Buffer) => number; | ||
| //# sourceMappingURL=large-numbers.d.ts.map |
@@ -1,2 +0,1 @@ | ||
| /// <reference types="node" resolution-mode="require"/> | ||
| import { CwdError } from './cwd-error.js'; | ||
@@ -3,0 +2,0 @@ import { SymlinkError } from './symlink-error.js'; |
@@ -1,2 +0,1 @@ | ||
| /// <reference types="node" resolution-mode="require"/> | ||
| import { type GzipOptions, type ZlibOptions } from 'minizlib'; | ||
@@ -588,35 +587,11 @@ import { type Stats } from 'node:fs'; | ||
| export type TarOptionsWithAliasesAsyncNoFile = TarOptionsWithAliasesAsync & TarOptionsWithAliasesNoFile; | ||
| export declare const isSyncFile: <O extends TarOptions>(o: O) => o is O & TarOptions & { | ||
| sync: true; | ||
| } & { | ||
| file: string; | ||
| }; | ||
| export declare const isAsyncFile: <O extends TarOptions>(o: O) => o is O & TarOptions & { | ||
| sync?: false | undefined; | ||
| } & { | ||
| file: string; | ||
| }; | ||
| export declare const isSyncNoFile: <O extends TarOptions>(o: O) => o is O & TarOptions & { | ||
| sync: true; | ||
| } & { | ||
| file?: undefined; | ||
| }; | ||
| export declare const isAsyncNoFile: <O extends TarOptions>(o: O) => o is O & TarOptions & { | ||
| sync?: false | undefined; | ||
| } & { | ||
| file?: undefined; | ||
| }; | ||
| export declare const isSync: <O extends TarOptions>(o: O) => o is O & TarOptions & { | ||
| sync: true; | ||
| }; | ||
| export declare const isAsync: <O extends TarOptions>(o: O) => o is O & TarOptions & { | ||
| sync?: false | undefined; | ||
| }; | ||
| export declare const isFile: <O extends TarOptions>(o: O) => o is O & TarOptions & { | ||
| file: string; | ||
| }; | ||
| export declare const isNoFile: <O extends TarOptions>(o: O) => o is O & TarOptions & { | ||
| file?: undefined; | ||
| }; | ||
| export declare const isSyncFile: <O extends TarOptions>(o: O) => o is O & TarOptionsSyncFile; | ||
| export declare const isAsyncFile: <O extends TarOptions>(o: O) => o is O & TarOptionsAsyncFile; | ||
| export declare const isSyncNoFile: <O extends TarOptions>(o: O) => o is O & TarOptionsSyncNoFile; | ||
| export declare const isAsyncNoFile: <O extends TarOptions>(o: O) => o is O & TarOptionsAsyncNoFile; | ||
| export declare const isSync: <O extends TarOptions>(o: O) => o is O & TarOptionsSync; | ||
| export declare const isAsync: <O extends TarOptions>(o: O) => o is O & TarOptionsAsync; | ||
| export declare const isFile: <O extends TarOptions>(o: O) => o is O & TarOptionsFile; | ||
| export declare const isNoFile: <O extends TarOptions>(o: O) => o is O & TarOptionsNoFile; | ||
| export declare const dealias: (opt?: TarOptionsWithAliases) => TarOptions; | ||
| //# sourceMappingURL=options.d.ts.map |
@@ -1,4 +0,1 @@ | ||
| /// <reference types="node" resolution-mode="require"/> | ||
| /// <reference types="node" resolution-mode="require"/> | ||
| /// <reference types="node" resolution-mode="require"/> | ||
| import { type Stats } from 'fs'; | ||
@@ -5,0 +2,0 @@ import { WriteEntry, WriteEntrySync, WriteEntryTar } from './write-entry.js'; |
@@ -1,4 +0,1 @@ | ||
| /// <reference types="node" resolution-mode="require"/> | ||
| /// <reference types="node" resolution-mode="require"/> | ||
| /// <reference types="node" resolution-mode="require"/> | ||
| import { EventEmitter as EE } from 'events'; | ||
@@ -5,0 +2,0 @@ import { BrotliDecompress, Unzip, ZstdDecompress } from 'minizlib'; |
@@ -1,3 +0,1 @@ | ||
| /// <reference types="node" resolution-mode="require"/> | ||
| /// <reference types="node" resolution-mode="require"/> | ||
| import { HeaderData } from './header.js'; | ||
@@ -23,3 +21,3 @@ export declare class Pax implements HeaderData { | ||
| constructor(obj: HeaderData, global?: boolean); | ||
| encode(): Buffer; | ||
| encode(): Buffer<ArrayBuffer>; | ||
| encodeBody(): string; | ||
@@ -26,0 +24,0 @@ encodeField(field: keyof Pax): string; |
@@ -1,3 +0,1 @@ | ||
| /// <reference types="node" resolution-mode="require"/> | ||
| /// <reference types="node" resolution-mode="require"/> | ||
| import { Minipass } from 'minipass'; | ||
@@ -4,0 +2,0 @@ import { Header } from './header.js'; |
@@ -1,2 +0,1 @@ | ||
| /// <reference types="node" resolution-mode="require"/> | ||
| import { type Stats } from 'node:fs'; | ||
@@ -21,2 +20,3 @@ import { MkdirError } from './mkdir.js'; | ||
| declare const CHECKPATH: unique symbol; | ||
| declare const STRIPABSOLUTEPATH: unique symbol; | ||
| declare const MKDIR: unique symbol; | ||
@@ -66,2 +66,3 @@ declare const ONERROR: unique symbol; | ||
| [MAYBECLOSE](): void; | ||
| [STRIPABSOLUTEPATH](entry: ReadEntry, field: 'path' | 'linkpath'): boolean; | ||
| [CHECKPATH](entry: ReadEntry): boolean; | ||
@@ -68,0 +69,0 @@ [ONENTRY](entry: ReadEntry): void; |
+33
-19
@@ -30,2 +30,3 @@ // the PEND/UNPEND stuff tracks whether we're ready to emit end/close yet. | ||
| const CHECKPATH = Symbol('checkPath'); | ||
| const STRIPABSOLUTEPATH = Symbol('stripAbsolutePath'); | ||
| const MKDIR = Symbol('mkdir'); | ||
@@ -214,2 +215,31 @@ const ONERROR = Symbol('onError'); | ||
| } | ||
| // return false if we need to skip this file | ||
| // return true if the field was successfully sanitized | ||
| [STRIPABSOLUTEPATH](entry, field) { | ||
| const path = entry[field]; | ||
| if (!path || this.preservePaths) | ||
| return true; | ||
| const parts = path.split('/'); | ||
| if (parts.includes('..') || | ||
| /* c8 ignore next */ | ||
| (isWindows && /^[a-z]:\.\.$/i.test(parts[0] ?? ''))) { | ||
| this.warn('TAR_ENTRY_ERROR', `${field} contains '..'`, { | ||
| entry, | ||
| [field]: path, | ||
| }); | ||
| // not ok! | ||
| return false; | ||
| } | ||
| // strip off the root | ||
| const [root, stripped] = stripAbsolutePath(path); | ||
| if (root) { | ||
| // ok, but triggers warning about stripping root | ||
| entry[field] = String(stripped); | ||
| this.warn('TAR_ENTRY_INFO', `stripping ${root} from absolute ${field}`, { | ||
| entry, | ||
| [field]: path, | ||
| }); | ||
| } | ||
| return true; | ||
| } | ||
| [CHECKPATH](entry) { | ||
@@ -243,21 +273,5 @@ const p = normalizeWindowsPath(entry.path); | ||
| } | ||
| if (!this.preservePaths) { | ||
| if (parts.includes('..') || | ||
| /* c8 ignore next */ | ||
| (isWindows && /^[a-z]:\.\.$/i.test(parts[0] ?? ''))) { | ||
| this.warn('TAR_ENTRY_ERROR', `path contains '..'`, { | ||
| entry, | ||
| path: p, | ||
| }); | ||
| return false; | ||
| } | ||
| // strip off the root | ||
| const [root, stripped] = stripAbsolutePath(p); | ||
| if (root) { | ||
| entry.path = String(stripped); | ||
| this.warn('TAR_ENTRY_INFO', `stripping ${root} from absolute path`, { | ||
| entry, | ||
| path: p, | ||
| }); | ||
| } | ||
| if (!this[STRIPABSOLUTEPATH](entry, 'path') || | ||
| !this[STRIPABSOLUTEPATH](entry, 'linkpath')) { | ||
| return false; | ||
| } | ||
@@ -264,0 +278,0 @@ if (path.isAbsolute(entry.path)) { |
@@ -1,3 +0,1 @@ | ||
| /// <reference types="node" resolution-mode="require"/> | ||
| /// <reference types="node" resolution-mode="require"/> | ||
| import { type Minipass } from 'minipass'; | ||
@@ -4,0 +2,0 @@ /** has a warn method */ |
@@ -1,5 +0,1 @@ | ||
| /// <reference types="node" resolution-mode="require"/> | ||
| /// <reference types="node" resolution-mode="require"/> | ||
| /// <reference types="node" resolution-mode="require"/> | ||
| /// <reference types="node" resolution-mode="require"/> | ||
| import { type Stats } from 'fs'; | ||
@@ -6,0 +2,0 @@ import { Minipass } from 'minipass'; |
+8
-63
@@ -5,3 +5,3 @@ { | ||
| "description": "tar for node", | ||
| "version": "7.5.2", | ||
| "version": "7.5.3", | ||
| "repository": { | ||
@@ -32,4 +32,4 @@ "type": "git", | ||
| "devDependencies": { | ||
| "@types/node": "^22.15.29", | ||
| "chmodr": "^1.2.0", | ||
| "@types/node": "^25.0.9", | ||
| "chmodr": "^2.0.2", | ||
| "end-of-stream": "^1.4.3", | ||
@@ -39,7 +39,7 @@ "events-to-array": "^2.0.3", | ||
| "nock": "^13.5.4", | ||
| "prettier": "^3.2.5", | ||
| "rimraf": "^5.0.5", | ||
| "tap": "^18.7.2", | ||
| "tshy": "^1.13.1", | ||
| "typedoc": "^0.25.13" | ||
| "prettier": "^3.8.0", | ||
| "rimraf": "^6.1.2", | ||
| "tap": "^21.5.0", | ||
| "tshy": "^3.1.0", | ||
| "typedoc": "^0.28.16" | ||
| }, | ||
@@ -53,19 +53,2 @@ "license": "BlueOak-1.0.0", | ||
| ], | ||
| "tap": { | ||
| "coverage-map": "map.js", | ||
| "timeout": 0, | ||
| "typecheck": true | ||
| }, | ||
| "prettier": { | ||
| "experimentalTernaries": true, | ||
| "semi": false, | ||
| "printWidth": 70, | ||
| "tabWidth": 2, | ||
| "useTabs": false, | ||
| "singleQuote": true, | ||
| "jsxSingleQuote": false, | ||
| "bracketSameLine": true, | ||
| "arrowParens": "avoid", | ||
| "endOfLine": "lf" | ||
| }, | ||
| "tshy": { | ||
@@ -99,3 +82,2 @@ "exports": { | ||
| "import": { | ||
| "source": "./src/index.ts", | ||
| "types": "./dist/esm/index.d.ts", | ||
@@ -105,3 +87,2 @@ "default": "./dist/esm/index.js" | ||
| "require": { | ||
| "source": "./src/index.ts", | ||
| "types": "./dist/commonjs/index.d.ts", | ||
@@ -113,3 +94,2 @@ "default": "./dist/commonjs/index.js" | ||
| "import": { | ||
| "source": "./src/create.ts", | ||
| "types": "./dist/esm/create.d.ts", | ||
@@ -119,3 +99,2 @@ "default": "./dist/esm/create.js" | ||
| "require": { | ||
| "source": "./src/create.ts", | ||
| "types": "./dist/commonjs/create.d.ts", | ||
@@ -127,3 +106,2 @@ "default": "./dist/commonjs/create.js" | ||
| "import": { | ||
| "source": "./src/create.ts", | ||
| "types": "./dist/esm/create.d.ts", | ||
@@ -133,3 +111,2 @@ "default": "./dist/esm/create.js" | ||
| "require": { | ||
| "source": "./src/create.ts", | ||
| "types": "./dist/commonjs/create.d.ts", | ||
@@ -141,3 +118,2 @@ "default": "./dist/commonjs/create.js" | ||
| "import": { | ||
| "source": "./src/create.ts", | ||
| "types": "./dist/esm/create.d.ts", | ||
@@ -147,3 +123,2 @@ "default": "./dist/esm/create.js" | ||
| "require": { | ||
| "source": "./src/create.ts", | ||
| "types": "./dist/commonjs/create.d.ts", | ||
@@ -155,3 +130,2 @@ "default": "./dist/commonjs/create.js" | ||
| "import": { | ||
| "source": "./src/create.ts", | ||
| "types": "./dist/esm/create.d.ts", | ||
@@ -161,3 +135,2 @@ "default": "./dist/esm/create.js" | ||
| "require": { | ||
| "source": "./src/create.ts", | ||
| "types": "./dist/commonjs/create.d.ts", | ||
@@ -169,3 +142,2 @@ "default": "./dist/commonjs/create.js" | ||
| "import": { | ||
| "source": "./src/list.ts", | ||
| "types": "./dist/esm/list.d.ts", | ||
@@ -175,3 +147,2 @@ "default": "./dist/esm/list.js" | ||
| "require": { | ||
| "source": "./src/list.ts", | ||
| "types": "./dist/commonjs/list.d.ts", | ||
@@ -183,3 +154,2 @@ "default": "./dist/commonjs/list.js" | ||
| "import": { | ||
| "source": "./src/list.ts", | ||
| "types": "./dist/esm/list.d.ts", | ||
@@ -189,3 +159,2 @@ "default": "./dist/esm/list.js" | ||
| "require": { | ||
| "source": "./src/list.ts", | ||
| "types": "./dist/commonjs/list.d.ts", | ||
@@ -197,3 +166,2 @@ "default": "./dist/commonjs/list.js" | ||
| "import": { | ||
| "source": "./src/update.ts", | ||
| "types": "./dist/esm/update.d.ts", | ||
@@ -203,3 +171,2 @@ "default": "./dist/esm/update.js" | ||
| "require": { | ||
| "source": "./src/update.ts", | ||
| "types": "./dist/commonjs/update.d.ts", | ||
@@ -211,3 +178,2 @@ "default": "./dist/commonjs/update.js" | ||
| "import": { | ||
| "source": "./src/update.ts", | ||
| "types": "./dist/esm/update.d.ts", | ||
@@ -217,3 +183,2 @@ "default": "./dist/esm/update.js" | ||
| "require": { | ||
| "source": "./src/update.ts", | ||
| "types": "./dist/commonjs/update.d.ts", | ||
@@ -225,3 +190,2 @@ "default": "./dist/commonjs/update.js" | ||
| "import": { | ||
| "source": "./src/extract.ts", | ||
| "types": "./dist/esm/extract.d.ts", | ||
@@ -231,3 +195,2 @@ "default": "./dist/esm/extract.js" | ||
| "require": { | ||
| "source": "./src/extract.ts", | ||
| "types": "./dist/commonjs/extract.d.ts", | ||
@@ -239,3 +202,2 @@ "default": "./dist/commonjs/extract.js" | ||
| "import": { | ||
| "source": "./src/extract.ts", | ||
| "types": "./dist/esm/extract.d.ts", | ||
@@ -245,3 +207,2 @@ "default": "./dist/esm/extract.js" | ||
| "require": { | ||
| "source": "./src/extract.ts", | ||
| "types": "./dist/commonjs/extract.d.ts", | ||
@@ -253,3 +214,2 @@ "default": "./dist/commonjs/extract.js" | ||
| "import": { | ||
| "source": "./src/pack.ts", | ||
| "types": "./dist/esm/pack.d.ts", | ||
@@ -259,3 +219,2 @@ "default": "./dist/esm/pack.js" | ||
| "require": { | ||
| "source": "./src/pack.ts", | ||
| "types": "./dist/commonjs/pack.d.ts", | ||
@@ -267,3 +226,2 @@ "default": "./dist/commonjs/pack.js" | ||
| "import": { | ||
| "source": "./src/unpack.ts", | ||
| "types": "./dist/esm/unpack.d.ts", | ||
@@ -273,3 +231,2 @@ "default": "./dist/esm/unpack.js" | ||
| "require": { | ||
| "source": "./src/unpack.ts", | ||
| "types": "./dist/commonjs/unpack.d.ts", | ||
@@ -281,3 +238,2 @@ "default": "./dist/commonjs/unpack.js" | ||
| "import": { | ||
| "source": "./src/parse.ts", | ||
| "types": "./dist/esm/parse.d.ts", | ||
@@ -287,3 +243,2 @@ "default": "./dist/esm/parse.js" | ||
| "require": { | ||
| "source": "./src/parse.ts", | ||
| "types": "./dist/commonjs/parse.d.ts", | ||
@@ -295,3 +250,2 @@ "default": "./dist/commonjs/parse.js" | ||
| "import": { | ||
| "source": "./src/read-entry.ts", | ||
| "types": "./dist/esm/read-entry.d.ts", | ||
@@ -301,3 +255,2 @@ "default": "./dist/esm/read-entry.js" | ||
| "require": { | ||
| "source": "./src/read-entry.ts", | ||
| "types": "./dist/commonjs/read-entry.d.ts", | ||
@@ -309,3 +262,2 @@ "default": "./dist/commonjs/read-entry.js" | ||
| "import": { | ||
| "source": "./src/write-entry.ts", | ||
| "types": "./dist/esm/write-entry.d.ts", | ||
@@ -315,3 +267,2 @@ "default": "./dist/esm/write-entry.js" | ||
| "require": { | ||
| "source": "./src/write-entry.ts", | ||
| "types": "./dist/commonjs/write-entry.d.ts", | ||
@@ -323,3 +274,2 @@ "default": "./dist/commonjs/write-entry.js" | ||
| "import": { | ||
| "source": "./src/header.ts", | ||
| "types": "./dist/esm/header.d.ts", | ||
@@ -329,3 +279,2 @@ "default": "./dist/esm/header.js" | ||
| "require": { | ||
| "source": "./src/header.ts", | ||
| "types": "./dist/commonjs/header.d.ts", | ||
@@ -337,3 +286,2 @@ "default": "./dist/commonjs/header.js" | ||
| "import": { | ||
| "source": "./src/pax.ts", | ||
| "types": "./dist/esm/pax.d.ts", | ||
@@ -343,3 +291,2 @@ "default": "./dist/esm/pax.js" | ||
| "require": { | ||
| "source": "./src/pax.ts", | ||
| "types": "./dist/commonjs/pax.d.ts", | ||
@@ -351,3 +298,2 @@ "default": "./dist/commonjs/pax.js" | ||
| "import": { | ||
| "source": "./src/types.ts", | ||
| "types": "./dist/esm/types.d.ts", | ||
@@ -357,3 +303,2 @@ "default": "./dist/esm/types.js" | ||
| "require": { | ||
| "source": "./src/types.ts", | ||
| "types": "./dist/commonjs/types.d.ts", | ||
@@ -360,0 +305,0 @@ "default": "./dist/commonjs/types.js" |
+3
-3
@@ -351,5 +351,5 @@ # node-tar | ||
| #### Using `onWriteMethod` to alter entries | ||
| #### Using `onWriteEntry` to alter entries | ||
| The `onWriteMethod` function, if provided, will get a reference | ||
| The `onWriteEntry` function, if provided, will get a reference | ||
| to each `entry` object on its way into the archive. | ||
@@ -360,3 +360,3 @@ | ||
| The return value of the method is ignored. All that matters is | ||
| The return value of the function is ignored. All that matters is | ||
| the final state of the entry object. This can also be used to | ||
@@ -363,0 +363,0 @@ track the files added to an archive, for example. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 4 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 4 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
1247141
0.22%11840
0.07%