Bump the npm group with 4 updates (#2419)
* Bump the npm group with 4 updates Bumps the npm group with 4 updates: [adm-zip](https://github.com/cthackers/adm-zip), [@eslint/js](https://github.com/eslint/eslint/tree/HEAD/packages/js), [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) and [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser). Updates `adm-zip` from 0.5.14 to 0.5.15 - [Release notes](https://github.com/cthackers/adm-zip/releases) - [Changelog](https://github.com/cthackers/adm-zip/blob/master/history.md) - [Commits](https://github.com/cthackers/adm-zip/compare/v0.5.14...v0.5.15) Updates `@eslint/js` from 9.8.0 to 9.9.0 - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md) - [Commits](https://github.com/eslint/eslint/commits/v9.9.0/packages/js) Updates `@typescript-eslint/eslint-plugin` from 8.0.1 to 8.1.0 - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.1.0/packages/eslint-plugin) Updates `@typescript-eslint/parser` from 8.0.1 to 8.1.0 - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.1.0/packages/parser) --- updated-dependencies: - dependency-name: adm-zip dependency-type: direct:production update-type: version-update:semver-patch dependency-group: npm - dependency-name: "@eslint/js" dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm - dependency-name: "@typescript-eslint/eslint-plugin" dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm - dependency-name: "@typescript-eslint/parser" dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm ... Signed-off-by: dependabot[bot] <support@github.com> * Update checked-in dependencies --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
parent
25ad3c8e40
commit
d620faa0b4
103 changed files with 1631 additions and 740 deletions
139
node_modules/adm-zip/zipEntry.js
generated
vendored
139
node_modules/adm-zip/zipEntry.js
generated
vendored
|
|
@ -3,33 +3,72 @@ var Utils = require("./util"),
|
|||
Constants = Utils.Constants,
|
||||
Methods = require("./methods");
|
||||
|
||||
module.exports = function (/*Buffer*/ input) {
|
||||
module.exports = function (/** object */ options, /*Buffer*/ input) {
|
||||
var _centralHeader = new Headers.EntryHeader(),
|
||||
_entryName = Buffer.alloc(0),
|
||||
_comment = Buffer.alloc(0),
|
||||
_isDirectory = false,
|
||||
uncompressedData = null,
|
||||
_extra = Buffer.alloc(0);
|
||||
_extra = Buffer.alloc(0),
|
||||
_extralocal = Buffer.alloc(0),
|
||||
_efs = true;
|
||||
|
||||
// assign options
|
||||
const opts = options;
|
||||
|
||||
const decoder = typeof opts.decoder === "object" ? opts.decoder : Utils.decoder;
|
||||
_efs = decoder.hasOwnProperty("efs") ? decoder.efs : false;
|
||||
|
||||
function getCompressedDataFromZip() {
|
||||
//if (!input || !Buffer.isBuffer(input)) {
|
||||
if (!input || !(input instanceof Uint8Array)) {
|
||||
return Buffer.alloc(0);
|
||||
}
|
||||
_centralHeader.loadLocalHeaderFromBinary(input);
|
||||
_extralocal = _centralHeader.loadLocalHeaderFromBinary(input);
|
||||
return input.slice(_centralHeader.realDataOffset, _centralHeader.realDataOffset + _centralHeader.compressedSize);
|
||||
}
|
||||
|
||||
function crc32OK(data) {
|
||||
// if bit 3 (0x08) of the general-purpose flags field is set, then the CRC-32 and file sizes are not known when the header is written
|
||||
if ((_centralHeader.flags & 0x8) !== 0x8) {
|
||||
// if bit 3 (0x08) of the general-purpose flags field is set, then the CRC-32 and file sizes are not known when the local header is written
|
||||
if (!_centralHeader.flags_desc) {
|
||||
if (Utils.crc32(data) !== _centralHeader.localHeader.crc) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
// @TODO: load and check data descriptor header
|
||||
// The fields in the local header are filled with zero, and the CRC-32 and size are appended in a 12-byte structure
|
||||
// (optionally preceded by a 4-byte signature) immediately after the compressed data:
|
||||
const descriptor = {};
|
||||
const dataEndOffset = _centralHeader.realDataOffset + _centralHeader.compressedSize;
|
||||
// no descriptor after compressed data, instead new local header
|
||||
if (input.readUInt32LE(dataEndOffset) == Constants.LOCSIG || input.readUInt32LE(dataEndOffset) == Constants.CENSIG) {
|
||||
throw Utils.Errors.DESCRIPTOR_NOT_EXIST();
|
||||
}
|
||||
|
||||
// get decriptor data
|
||||
if (input.readUInt32LE(dataEndOffset) == Constants.EXTSIG) {
|
||||
// descriptor with signature
|
||||
descriptor.crc = input.readUInt32LE(dataEndOffset + Constants.EXTCRC);
|
||||
descriptor.compressedSize = input.readUInt32LE(dataEndOffset + Constants.EXTSIZ);
|
||||
descriptor.size = input.readUInt32LE(dataEndOffset + Constants.EXTLEN);
|
||||
} else if (input.readUInt16LE(dataEndOffset + 12) === 0x4b50) {
|
||||
// descriptor without signature (we check is new header starting where we expect)
|
||||
descriptor.crc = input.readUInt32LE(dataEndOffset + Constants.EXTCRC - 4);
|
||||
descriptor.compressedSize = input.readUInt32LE(dataEndOffset + Constants.EXTSIZ - 4);
|
||||
descriptor.size = input.readUInt32LE(dataEndOffset + Constants.EXTLEN - 4);
|
||||
} else {
|
||||
throw Utils.Errors.DESCRIPTOR_UNKNOWN();
|
||||
}
|
||||
|
||||
// check data integrity
|
||||
if (descriptor.compressedSize !== _centralHeader.compressedSize || descriptor.size !== _centralHeader.size || descriptor.crc !== _centralHeader.crc) {
|
||||
throw Utils.Errors.DESCRIPTOR_FAULTY();
|
||||
}
|
||||
if (Utils.crc32(data) !== descriptor.crc) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// @TODO: zip64 bit descriptor fields
|
||||
// if bit 3 is set and any value in local header "zip64 Extended information" extra field are set 0 (place holder)
|
||||
// then 64-bit descriptor format is used instead of 32-bit
|
||||
// central header - "zip64 Extended information" extra field should store real values and not place holders
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
@ -41,7 +80,7 @@ module.exports = function (/*Buffer*/ input) {
|
|||
}
|
||||
if (_isDirectory) {
|
||||
if (async && callback) {
|
||||
callback(Buffer.alloc(0), Utils.Errors.DIRECTORY_CONTENT_ERROR); //si added error.
|
||||
callback(Buffer.alloc(0), Utils.Errors.DIRECTORY_CONTENT_ERROR()); //si added error.
|
||||
}
|
||||
return Buffer.alloc(0);
|
||||
}
|
||||
|
|
@ -56,7 +95,7 @@ module.exports = function (/*Buffer*/ input) {
|
|||
|
||||
if (_centralHeader.encrypted) {
|
||||
if ("string" !== typeof pass && !Buffer.isBuffer(pass)) {
|
||||
throw new Error("ADM-ZIP: Incompatible password parameter");
|
||||
throw Utils.Errors.INVALID_PASS_PARAM();
|
||||
}
|
||||
compressedData = Methods.ZipCrypto.decrypt(compressedData, _centralHeader, pass);
|
||||
}
|
||||
|
|
@ -67,8 +106,8 @@ module.exports = function (/*Buffer*/ input) {
|
|||
case Utils.Constants.STORED:
|
||||
compressedData.copy(data);
|
||||
if (!crc32OK(data)) {
|
||||
if (async && callback) callback(data, Utils.Errors.BAD_CRC); //si added error
|
||||
throw new Error(Utils.Errors.BAD_CRC);
|
||||
if (async && callback) callback(data, Utils.Errors.BAD_CRC()); //si added error
|
||||
throw Utils.Errors.BAD_CRC();
|
||||
} else {
|
||||
//si added otherwise did not seem to return data.
|
||||
if (async && callback) callback(data);
|
||||
|
|
@ -80,7 +119,7 @@ module.exports = function (/*Buffer*/ input) {
|
|||
const result = inflater.inflate(data);
|
||||
result.copy(data, 0);
|
||||
if (!crc32OK(data)) {
|
||||
throw new Error(Utils.Errors.BAD_CRC + " " + _entryName.toString());
|
||||
throw Utils.Errors.BAD_CRC(`"${decoder.decode(_entryName)}"`);
|
||||
}
|
||||
return data;
|
||||
} else {
|
||||
|
|
@ -88,7 +127,7 @@ module.exports = function (/*Buffer*/ input) {
|
|||
result.copy(result, 0);
|
||||
if (callback) {
|
||||
if (!crc32OK(result)) {
|
||||
callback(result, Utils.Errors.BAD_CRC); //si added error
|
||||
callback(result, Utils.Errors.BAD_CRC()); //si added error
|
||||
} else {
|
||||
callback(result);
|
||||
}
|
||||
|
|
@ -97,8 +136,8 @@ module.exports = function (/*Buffer*/ input) {
|
|||
}
|
||||
break;
|
||||
default:
|
||||
if (async && callback) callback(Buffer.alloc(0), Utils.Errors.UNKNOWN_METHOD);
|
||||
throw new Error(Utils.Errors.UNKNOWN_METHOD);
|
||||
if (async && callback) callback(Buffer.alloc(0), Utils.Errors.UNKNOWN_METHOD());
|
||||
throw Utils.Errors.UNKNOWN_METHOD();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -151,18 +190,22 @@ module.exports = function (/*Buffer*/ input) {
|
|||
}
|
||||
|
||||
function parseExtra(data) {
|
||||
var offset = 0;
|
||||
var signature, size, part;
|
||||
while (offset < data.length) {
|
||||
signature = data.readUInt16LE(offset);
|
||||
offset += 2;
|
||||
size = data.readUInt16LE(offset);
|
||||
offset += 2;
|
||||
part = data.slice(offset, offset + size);
|
||||
offset += size;
|
||||
if (Constants.ID_ZIP64 === signature) {
|
||||
parseZip64ExtendedInformation(part);
|
||||
try {
|
||||
var offset = 0;
|
||||
var signature, size, part;
|
||||
while (offset + 4 < data.length) {
|
||||
signature = data.readUInt16LE(offset);
|
||||
offset += 2;
|
||||
size = data.readUInt16LE(offset);
|
||||
offset += 2;
|
||||
part = data.slice(offset, offset + size);
|
||||
offset += size;
|
||||
if (Constants.ID_ZIP64 === signature) {
|
||||
parseZip64ExtendedInformation(part);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
throw Utils.Errors.EXTRA_FIELD_PARSE_ERROR();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -198,18 +241,26 @@ module.exports = function (/*Buffer*/ input) {
|
|||
|
||||
return {
|
||||
get entryName() {
|
||||
return _entryName.toString();
|
||||
return decoder.decode(_entryName);
|
||||
},
|
||||
get rawEntryName() {
|
||||
return _entryName;
|
||||
},
|
||||
set entryName(val) {
|
||||
_entryName = Utils.toBuffer(val);
|
||||
_entryName = Utils.toBuffer(val, decoder.encode);
|
||||
var lastChar = _entryName[_entryName.length - 1];
|
||||
_isDirectory = lastChar === 47 || lastChar === 92;
|
||||
_centralHeader.fileNameLength = _entryName.length;
|
||||
},
|
||||
|
||||
get efs() {
|
||||
if (typeof _efs === "function") {
|
||||
return _efs(this.entryName);
|
||||
} else {
|
||||
return _efs;
|
||||
}
|
||||
},
|
||||
|
||||
get extra() {
|
||||
return _extra;
|
||||
},
|
||||
|
|
@ -220,15 +271,16 @@ module.exports = function (/*Buffer*/ input) {
|
|||
},
|
||||
|
||||
get comment() {
|
||||
return _comment.toString();
|
||||
return decoder.decode(_comment);
|
||||
},
|
||||
set comment(val) {
|
||||
_comment = Utils.toBuffer(val);
|
||||
_comment = Utils.toBuffer(val, decoder.encode);
|
||||
_centralHeader.commentLength = _comment.length;
|
||||
if (_comment.length > 0xffff) throw Utils.Errors.COMMENT_TOO_LONG();
|
||||
},
|
||||
|
||||
get name() {
|
||||
var n = _entryName.toString();
|
||||
var n = decoder.decode(_entryName);
|
||||
return _isDirectory
|
||||
? n
|
||||
.substr(n.length - 1)
|
||||
|
|
@ -249,7 +301,7 @@ module.exports = function (/*Buffer*/ input) {
|
|||
},
|
||||
|
||||
setData: function (value) {
|
||||
uncompressedData = Utils.toBuffer(value);
|
||||
uncompressedData = Utils.toBuffer(value, Utils.decoder.encode);
|
||||
if (!_isDirectory && uncompressedData.length) {
|
||||
_centralHeader.size = uncompressedData.length;
|
||||
_centralHeader.method = Utils.Constants.DEFLATED;
|
||||
|
|
@ -293,6 +345,8 @@ module.exports = function (/*Buffer*/ input) {
|
|||
},
|
||||
|
||||
packCentralHeader: function () {
|
||||
_centralHeader.flags_efs = this.efs;
|
||||
_centralHeader.extraLength = _extra.length;
|
||||
// 1. create header (buffer)
|
||||
var header = _centralHeader.centralHeaderToBinary();
|
||||
var addpos = Utils.Constants.CENHDR;
|
||||
|
|
@ -300,24 +354,21 @@ module.exports = function (/*Buffer*/ input) {
|
|||
_entryName.copy(header, addpos);
|
||||
addpos += _entryName.length;
|
||||
// 3. add extra data
|
||||
if (_centralHeader.extraLength) {
|
||||
_extra.copy(header, addpos);
|
||||
addpos += _centralHeader.extraLength;
|
||||
}
|
||||
_extra.copy(header, addpos);
|
||||
addpos += _centralHeader.extraLength;
|
||||
// 4. add file comment
|
||||
if (_centralHeader.commentLength) {
|
||||
_comment.copy(header, addpos);
|
||||
}
|
||||
_comment.copy(header, addpos);
|
||||
return header;
|
||||
},
|
||||
|
||||
packLocalHeader: function () {
|
||||
let addpos = 0;
|
||||
|
||||
_centralHeader.flags_efs = this.efs;
|
||||
_centralHeader.extraLocalLength = _extralocal.length;
|
||||
// 1. construct local header Buffer
|
||||
const localHeaderBuf = _centralHeader.localHeaderToBinary();
|
||||
// 2. localHeader - crate header buffer
|
||||
const localHeader = Buffer.alloc(localHeaderBuf.length + _entryName.length + _extra.length);
|
||||
const localHeader = Buffer.alloc(localHeaderBuf.length + _entryName.length + _centralHeader.extraLocalLength);
|
||||
// 2.1 add localheader
|
||||
localHeaderBuf.copy(localHeader, addpos);
|
||||
addpos += localHeaderBuf.length;
|
||||
|
|
@ -325,8 +376,8 @@ module.exports = function (/*Buffer*/ input) {
|
|||
_entryName.copy(localHeader, addpos);
|
||||
addpos += _entryName.length;
|
||||
// 2.3 add extra field
|
||||
_extra.copy(localHeader, addpos);
|
||||
addpos += _extra.length;
|
||||
_extralocal.copy(localHeader, addpos);
|
||||
addpos += _extralocal.length;
|
||||
|
||||
return localHeader;
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue