fix(archive): validate stream file archive paths and throw on premature bzip2 stream termination

This commit is contained in:
2026-04-30 13:13:49 +00:00
parent c75c358dfd
commit 1553dc67ef
10 changed files with 4254 additions and 4627 deletions
+28
View File
@@ -0,0 +1,28 @@
{
"@git.zone/cli": {
"projectType": "npm",
"module": {
"githost": "code.foss.global",
"gitscope": "push.rocks",
"gitrepo": "smartarchive",
"description": "A library for working with archive files, providing utilities for compressing and decompressing data.",
"npmPackagename": "@push.rocks/smartarchive",
"license": "MIT",
"projectDomain": "push.rocks"
},
"release": {
"registries": [
"https://verdaccio.lossless.digital",
"https://registry.npmjs.org"
],
"accessLevel": "public"
}
},
"@git.zone/tsdoc": {
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
},
"@ship.zone/szci": {
"npmGlobalTools": [],
"npmRegistryUrl": "registry.npmjs.org"
}
}
+7
View File
@@ -1,5 +1,12 @@
# Changelog
## 2026-04-30 - 5.2.2 - fix(archive)
validate stream file archive paths and throw on premature bzip2 stream termination
- Require a valid archive path when adding StreamFile entries without a relative file path.
- Throw a Bzip2Error instead of emitting an error when compressed input ends prematurely.
- Align TypeScript and package dependencies with stricter Node.js typing and updated build tooling.
## 2026-01-01 - 5.2.0 - feat(tartools)
add streaming TAR support (tar-stream), Node.js streaming APIs for TarTools, and browser / web bundle docs
Generated
+2046 -2217
View File
File diff suppressed because it is too large Load Diff
+14 -11
View File
@@ -11,7 +11,7 @@
},
"scripts": {
"test": "(tstest test/ --verbose)",
"build": "tsbuild --web --allowimplicitany",
"build": "tsbuild --web",
"buildDocs": "tsdoc"
},
"repository": {
@@ -26,24 +26,25 @@
"homepage": "https://code.foss.global/push.rocks/smartarchive#readme",
"dependencies": {
"@push.rocks/smartdelay": "^3.0.5",
"@push.rocks/smartfile": "^13.1.2",
"@push.rocks/smartfile": "^13.1.3",
"@push.rocks/smartpath": "^6.0.0",
"@push.rocks/smartpromise": "^4.2.3",
"@push.rocks/smartrequest": "^5.0.1",
"@push.rocks/smartrx": "^3.0.10",
"@push.rocks/smartstream": "^3.2.5",
"@push.rocks/smartstream": "^3.4.2",
"@push.rocks/smartunique": "^3.0.9",
"@push.rocks/smarturl": "^3.1.0",
"fflate": "^0.8.2",
"file-type": "^21.3.0",
"modern-tar": "^0.7.3",
"tar-stream": "^3.1.7"
"file-type": "^22.0.1",
"modern-tar": "^0.7.6",
"tar-stream": "^3.2.0"
},
"devDependencies": {
"@git.zone/tsbuild": "^4.1.2",
"@git.zone/tsrun": "^2.0.1",
"@git.zone/tstest": "^3.1.4",
"@types/tar-stream": "^3.1.3"
"@git.zone/tsbuild": "^4.4.0",
"@git.zone/tsrun": "^2.0.3",
"@git.zone/tstest": "^3.6.3",
"@types/node": "^25.6.0",
"@types/tar-stream": "^3.1.4"
},
"private": false,
"files": [
@@ -57,6 +58,8 @@
"dist_ts_web/**/*",
"assets/**/*",
"cli.js",
".smartconfig.json",
"license",
"npmextra.json",
"readme.md"
],
@@ -76,7 +79,7 @@
"data analysis",
"file stream"
],
"packageManager": "pnpm@10.14.0+sha512.ad27a79641b49c3e481a16a805baa71817a04bbe06a38d17e60e2eaee83f6a146c6a688125f5792e48dd5ba30e7da52a5cda4c3992b9ccf333f9ce223af84748",
"packageManager": "pnpm@10.28.2",
"pnpm": {
"overrides": {}
}
+2149 -2393
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@push.rocks/smartarchive',
version: '5.2.0',
version: '5.2.2',
description: 'A library for working with archive files, providing utilities for compressing and decompressing data.'
}
+5 -1
View File
@@ -224,8 +224,12 @@ export class SmartArchive {
public addStreamFile(fileArg: plugins.smartfile.StreamFile, archivePath?: string): this {
this.ensureNotInExtractMode('addStreamFile');
if (!this._mode) this._mode = 'create';
const resolvedArchivePath = archivePath ?? fileArg.relativeFilePath;
if (!resolvedArchivePath) {
throw new Error('StreamFile requires an archivePath when no relativeFilePath is set');
}
this.pendingEntries.push({
archivePath: archivePath || fileArg.relativeFilePath,
archivePath: resolvedArchivePath,
content: fileArg,
});
return this;
+1 -1
View File
@@ -97,7 +97,7 @@ export function unbzip2Stream(): plugins.smartstream.SmartDuplex<Uint8Array, Uin
}
if (!broken && streamCRC !== null) {
this.emit('error', new Bzip2Error('Input stream ended prematurely', BZIP2_ERROR_CODES.PREMATURE_END));
throw new Bzip2Error('Input stream ended prematurely', BZIP2_ERROR_CODES.PREMATURE_END);
}
return null;
},
+1 -1
View File
@@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@push.rocks/smartarchive',
version: '5.2.0',
version: '5.2.2',
description: 'A library for working with archive files, providing utilities for compressing and decompressing data.'
}
+2 -2
View File
@@ -5,10 +5,10 @@
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"noImplicitAny": true,
"esModuleInterop": true,
"verbatimModuleSyntax": true,
"baseUrl": ".",
"paths": {}
"types": ["node"]
},
"exclude": ["dist_*/**/*.d.ts"]
}