snyk 1.966.0 → 1.969.0
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/cli/184.index.js +237 -75
- package/dist/cli/184.index.js.map +1 -1
- package/dist/cli/784.index.js +20 -6
- package/dist/cli/784.index.js.map +1 -1
- package/dist/cli/917.index.js +157 -665
- package/dist/cli/917.index.js.map +1 -1
- package/dist/cli/commands/test/iac/local-execution/measurable-methods.d.ts +2 -3
- package/dist/cli/commands/test/iac/local-execution/process-results/{v2/cli-share-results.d.ts → cli-share-results.d.ts} +3 -3
- package/dist/cli/commands/test/iac/local-execution/process-results/{v1/extract-line-number.d.ts → extract-line-number.d.ts} +0 -0
- package/dist/cli/commands/test/iac/local-execution/process-results/index.d.ts +0 -11
- package/dist/cli/commands/test/iac/local-execution/process-results/{v2/policy.d.ts → policy.d.ts} +2 -2
- package/dist/cli/commands/test/iac/local-execution/process-results/{v2/index.d.ts → process-results.d.ts} +3 -3
- package/dist/cli/commands/test/iac/local-execution/process-results/{v2/results-formatter.d.ts → results-formatter.d.ts} +3 -3
- package/dist/cli/commands/test/iac/local-execution/process-results/{v2/share-results-formatter.d.ts → share-results-formatter.d.ts} +1 -1
- package/dist/cli/commands/test/iac/local-execution/process-results/{v2/share-results.d.ts → share-results.d.ts} +3 -3
- package/dist/cli/commands/test/iac/output.d.ts +1 -2
- package/dist/cli/commands/test/iac/scan.d.ts +1 -1
- package/dist/cli/thirdPartyNotice.json +13 -4
- package/dist/lib/formatters/iac-output/v2/issues-list/index.d.ts +2 -1
- package/dist/lib/formatters/iac-output/v2/issues-list/issue.d.ts +2 -1
- package/dist/lib/formatters/iac-output/v2/issues-list/types.d.ts +3 -0
- package/package.json +1 -1
- package/dist/cli/commands/test/iac/local-execution/process-results/v1/index.d.ts +0 -7
- package/dist/cli/commands/test/iac/local-execution/process-results/v1/policy.d.ts +0 -6
- package/dist/cli/commands/test/iac/local-execution/process-results/v1/results-formatter.d.ts +0 -8
- package/dist/cli/commands/test/iac/local-execution/process-results/v1/share-results-formatter.d.ts +0 -2
- package/dist/cli/commands/test/iac/local-execution/process-results/v1/share-results.d.ts +0 -12
- package/dist/cli/commands/test/iac/local-execution/process-results/v2/extract-line-number.d.ts +0 -3
package/dist/cli/184.index.js
CHANGED
|
@@ -157417,29 +157417,31 @@ Object.defineProperty(exports, "phpFilesToScannedProjects", ({ enumerable: true,
|
|
|
157417
157417
|
"use strict";
|
|
157418
157418
|
|
|
157419
157419
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
157420
|
-
exports.parsePomProperties = exports.getCoordsFromPomProperties = exports.
|
|
157420
|
+
exports.parsePomProperties = exports.getCoordsFromPomProperties = exports.jarFilesToScannedResults = void 0;
|
|
157421
157421
|
const admzip = __webpack_require__(55285);
|
|
157422
157422
|
const path = __webpack_require__(85622);
|
|
157423
157423
|
const buffer_utils_1 = __webpack_require__(29098);
|
|
157424
|
-
|
|
157425
|
-
|
|
157426
|
-
|
|
157424
|
+
/**
|
|
157425
|
+
* @param {{[fileName: string]: Buffer}} fileNameToBuffer fileName
|
|
157426
|
+
* @returns {AggregatedJars}
|
|
157427
|
+
*/
|
|
157428
|
+
function groupJarFingerprintsByPath(fileNameToBuffer) {
|
|
157429
|
+
const resultAggregatedByPath = {};
|
|
157430
|
+
Object.keys(fileNameToBuffer).forEach((filePath) => {
|
|
157431
|
+
const location = path.dirname(filePath);
|
|
157432
|
+
const jarFingerprint = {
|
|
157427
157433
|
location: filePath,
|
|
157428
|
-
buffer,
|
|
157434
|
+
buffer: fileNameToBuffer[filePath],
|
|
157429
157435
|
coords: null,
|
|
157430
157436
|
dependencies: [],
|
|
157431
157437
|
nestedJars: [],
|
|
157432
157438
|
};
|
|
157439
|
+
resultAggregatedByPath[location] = resultAggregatedByPath[location] || [];
|
|
157440
|
+
resultAggregatedByPath[location].push(jarFingerprint);
|
|
157433
157441
|
});
|
|
157434
|
-
const resultAggregatedByPath = jarFingerprints.reduce((jarsAggregatedByPath, jarFingerprint) => {
|
|
157435
|
-
const location = path.dirname(jarFingerprint.location);
|
|
157436
|
-
jarsAggregatedByPath[location] = jarsAggregatedByPath[location] || [];
|
|
157437
|
-
jarsAggregatedByPath[location].push(jarFingerprint);
|
|
157438
|
-
return jarsAggregatedByPath;
|
|
157439
|
-
}, {});
|
|
157440
157442
|
return resultAggregatedByPath;
|
|
157441
157443
|
}
|
|
157442
|
-
async function
|
|
157444
|
+
async function jarFilesToScannedResults(filePathToContent, targetImage, desiredLevelsOfUnpacking) {
|
|
157443
157445
|
const mappedResult = groupJarFingerprintsByPath(filePathToContent);
|
|
157444
157446
|
const scanResults = [];
|
|
157445
157447
|
for (const path in mappedResult) {
|
|
@@ -157465,7 +157467,7 @@ async function jarFilesToScannedProjects(filePathToContent, targetImage, desired
|
|
|
157465
157467
|
}
|
|
157466
157468
|
return scanResults;
|
|
157467
157469
|
}
|
|
157468
|
-
exports.
|
|
157470
|
+
exports.jarFilesToScannedResults = jarFilesToScannedResults;
|
|
157469
157471
|
function getFingerprints(desiredLevelsOfUnpacking, jarBuffers) {
|
|
157470
157472
|
const fingerprints = new Set([
|
|
157471
157473
|
...unpackJars(jarBuffers, desiredLevelsOfUnpacking),
|
|
@@ -157596,7 +157598,7 @@ function unpackJars(jarBuffers, desiredLevelsOfUnpacking, unpackedLevels = 0) {
|
|
|
157596
157598
|
}
|
|
157597
157599
|
if (jarInfo.nestedJars.length > 0) {
|
|
157598
157600
|
// this is an uber/fat JAR so we need to unpack the nested JARs to
|
|
157599
|
-
//
|
|
157601
|
+
// analyze them for coords and further nested JARs (depth flag allowing)
|
|
157600
157602
|
fingerprints.push(...unpackJars(jarInfo.nestedJars, desiredLevelsOfUnpacking, unpackedLevels + 1));
|
|
157601
157603
|
}
|
|
157602
157604
|
}
|
|
@@ -157626,11 +157628,11 @@ function parsePomProperties(fileContent) {
|
|
|
157626
157628
|
const fileContentLines = fileContent
|
|
157627
157629
|
.split(/\n/)
|
|
157628
157630
|
.filter((line) => /^(groupId|artifactId|version)=/.test(line)); // These are the only properties we are interested in
|
|
157629
|
-
const coords =
|
|
157631
|
+
const coords = {};
|
|
157632
|
+
fileContentLines.forEach((line) => {
|
|
157630
157633
|
const [key, value] = line.split("=");
|
|
157631
157634
|
coords[key] = value.trim(); // Getting rid of EOL
|
|
157632
|
-
|
|
157633
|
-
}, {});
|
|
157635
|
+
});
|
|
157634
157636
|
return coords;
|
|
157635
157637
|
}
|
|
157636
157638
|
exports.parsePomProperties = parsePomProperties;
|
|
@@ -158535,7 +158537,7 @@ async function analyze(targetImage, dockerfileAnalysis, imageType, imagePath, gl
|
|
|
158535
158537
|
if (checkForGlobs) {
|
|
158536
158538
|
staticAnalysisActions.push(filePatternStatic.generateExtractAction(globsToFind.include, globsToFind.exclude));
|
|
158537
158539
|
}
|
|
158538
|
-
const appScan = (0, option_utils_1.isTrue)(options["app-vulns"]);
|
|
158540
|
+
const appScan = !(0, option_utils_1.isTrue)(options["exclude-app-vulns"]);
|
|
158539
158541
|
if (appScan) {
|
|
158540
158542
|
staticAnalysisActions.push(...[
|
|
158541
158543
|
static_6.getNodeAppFileContentAction,
|
|
@@ -158585,7 +158587,7 @@ async function analyze(targetImage, dockerfileAnalysis, imageType, imagePath, gl
|
|
|
158585
158587
|
const nodeDependenciesScanResults = await (0, applications_1.nodeFilesToScannedProjects)((0, inputs_1.getFileContent)(extractedLayers, static_6.getNodeAppFileContentAction.actionName));
|
|
158586
158588
|
const phpDependenciesScanResults = await (0, applications_1.phpFilesToScannedProjects)((0, inputs_1.getFileContent)(extractedLayers, static_8.getPhpAppFileContentAction.actionName));
|
|
158587
158589
|
const desiredLevelsOfUnpacking = getNestedJarsDesiredDepth(options);
|
|
158588
|
-
const jarFingerprintScanResults = await (0, java_1.
|
|
158590
|
+
const jarFingerprintScanResults = await (0, java_1.jarFilesToScannedResults)((0, inputs_1.getBufferContent)(extractedLayers, static_5.getJarFileContentAction.actionName), targetImage, desiredLevelsOfUnpacking);
|
|
158589
158591
|
const goModulesScanResult = await (0, go_parser_1.goModulesToScannedProjects)((0, inputs_1.getElfFileContent)(extractedLayers, go_parser_1.getGoModulesContentAction.actionName));
|
|
158590
158592
|
applicationDependenciesScanResults.push(...nodeDependenciesScanResults, ...phpDependenciesScanResults, ...jarFingerprintScanResults, ...goModulesScanResult);
|
|
158591
158593
|
}
|
|
@@ -160279,12 +160281,13 @@ exports.parserStrTab = parserStrTab;
|
|
|
160279
160281
|
/***/ }),
|
|
160280
160282
|
|
|
160281
160283
|
/***/ 12790:
|
|
160282
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
160284
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
160283
160285
|
|
|
160284
160286
|
"use strict";
|
|
160285
160287
|
|
|
160286
160288
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
160287
160289
|
exports.extractModulesFromBinary = void 0;
|
|
160290
|
+
const varint = __webpack_require__(94676);
|
|
160288
160291
|
/**
|
|
160289
160292
|
* Create same output as `go version -m binary-file` does
|
|
160290
160293
|
* @param binary
|
|
@@ -160305,90 +160308,132 @@ function prepareGoDependencies(mod) {
|
|
|
160305
160308
|
}
|
|
160306
160309
|
const [, mainModuleLine, ...versionsLines] = mod.split("\n");
|
|
160307
160310
|
const [, name] = mainModuleLine.split("\t");
|
|
160308
|
-
const modules =
|
|
160309
|
-
|
|
160310
|
-
if (!
|
|
160311
|
-
return
|
|
160311
|
+
const modules = {};
|
|
160312
|
+
versionsLines.forEach((versionLine) => {
|
|
160313
|
+
if (!versionLine) {
|
|
160314
|
+
return;
|
|
160315
|
+
}
|
|
160316
|
+
const [, name, ver] = versionLine.split("\t");
|
|
160317
|
+
if (!name || !ver) {
|
|
160318
|
+
return;
|
|
160312
160319
|
}
|
|
160313
|
-
|
|
160314
|
-
// Versions in Go have trailing 'v'
|
|
160320
|
+
// Versions in Go have leading 'v'
|
|
160315
160321
|
let version = ver.substring(1);
|
|
160316
160322
|
// In versions with hash, we only care about hash
|
|
160317
160323
|
// v0.0.0-20200905004654-be1d3432aa8f => #be1d3432aa8f
|
|
160318
160324
|
version = version.includes("-")
|
|
160319
160325
|
? `#${version.substring(version.lastIndexOf("-") + 1)}`
|
|
160320
160326
|
: version;
|
|
160321
|
-
|
|
160322
|
-
|
|
160323
|
-
}, {});
|
|
160327
|
+
modules[name] = version;
|
|
160328
|
+
});
|
|
160324
160329
|
return { name, modules };
|
|
160325
160330
|
}
|
|
160326
160331
|
// Source
|
|
160327
|
-
// https://github.com/golang/go/blob/
|
|
160332
|
+
// https://github.com/golang/go/blob/master/src/debug/buildinfo/buildinfo.go#L142
|
|
160328
160333
|
/**
|
|
160329
160334
|
* Function finds and returns the Go version and
|
|
160330
160335
|
* module version information in the executable binary
|
|
160331
160336
|
* @param binary
|
|
160332
160337
|
*/
|
|
160333
160338
|
function findVers(binary) {
|
|
160339
|
+
const buildInfoMagic = "\xff Go buildinf:";
|
|
160334
160340
|
const result = {
|
|
160335
160341
|
version: "",
|
|
160336
160342
|
mod: "",
|
|
160337
160343
|
};
|
|
160338
|
-
|
|
160339
|
-
|
|
160340
|
-
|
|
160341
|
-
|
|
160344
|
+
// Read the first 64kB of dataAddr to find the build info blob.
|
|
160345
|
+
// On some platforms, the blob will be in its own section, and DataStart
|
|
160346
|
+
// returns the address of that section. On others, it's somewhere in the
|
|
160347
|
+
// data segment; the linker puts it near the beginning.
|
|
160348
|
+
const dataAddr = dataStart(binary);
|
|
160349
|
+
let data = readData(binary.body.programs, dataAddr, 64 * 1024) || Buffer.from([]);
|
|
160350
|
+
const buildInfoAlign = 16;
|
|
160351
|
+
const buildInfoSize = 32;
|
|
160352
|
+
while (true) {
|
|
160353
|
+
const i = data.toString("binary").indexOf(buildInfoMagic);
|
|
160354
|
+
if (i < 0 || data.length - i < buildInfoSize) {
|
|
160342
160355
|
return result;
|
|
160343
160356
|
}
|
|
160344
|
-
|
|
160357
|
+
if (i % buildInfoAlign === 0 && data.length - i >= buildInfoSize) {
|
|
160358
|
+
data = data.subarray(i);
|
|
160359
|
+
break;
|
|
160360
|
+
}
|
|
160361
|
+
data = data.subarray((i + buildInfoAlign - 1) & ~buildInfoAlign);
|
|
160362
|
+
}
|
|
160363
|
+
// Decode the blob.
|
|
160364
|
+
// The first 14 bytes are buildInfoMagic.
|
|
160365
|
+
// The next two bytes indicate pointer size in bytes (4 or 8) and endianness
|
|
160366
|
+
// (0 for little, 1 for big).
|
|
160367
|
+
// Two virtual addresses to Go strings follow that: runtime.buildVersion,
|
|
160368
|
+
// and runtime.modinfo.
|
|
160369
|
+
// On 32-bit platforms, the last 8 bytes are unused.
|
|
160370
|
+
// If the endianness has the 2 bit set, then the pointers are zero
|
|
160371
|
+
// and the 32-byte header is followed by varint-prefixed string data
|
|
160372
|
+
// for the two string values we care about.
|
|
160345
160373
|
const ptrSize = data[14];
|
|
160346
|
-
|
|
160347
|
-
|
|
160348
|
-
|
|
160349
|
-
|
|
160350
|
-
|
|
160374
|
+
if ((data[15] & 2) !== 0) {
|
|
160375
|
+
data = data.subarray(32);
|
|
160376
|
+
[result.version, data] = decodeString(data);
|
|
160377
|
+
[result.mod, data] = decodeString(data);
|
|
160378
|
+
}
|
|
160379
|
+
else {
|
|
160380
|
+
const bigEndian = data[15] !== 0;
|
|
160381
|
+
let readPtr;
|
|
160382
|
+
if (ptrSize === 4) {
|
|
160383
|
+
if (bigEndian) {
|
|
160384
|
+
readPtr = (buffer) => buffer.readUInt32BE(0);
|
|
160385
|
+
}
|
|
160386
|
+
else {
|
|
160387
|
+
readPtr = (buffer) => buffer.readUInt32LE(0);
|
|
160388
|
+
}
|
|
160351
160389
|
}
|
|
160352
160390
|
else {
|
|
160353
|
-
|
|
160391
|
+
if (bigEndian) {
|
|
160392
|
+
readPtr = (buffer) => Number(buffer.readBigUInt64BE());
|
|
160393
|
+
}
|
|
160394
|
+
else {
|
|
160395
|
+
readPtr = (buffer) => Number(buffer.readBigUInt64LE());
|
|
160396
|
+
}
|
|
160397
|
+
}
|
|
160398
|
+
// The build info blob left by the linker is identified by
|
|
160399
|
+
// a 16-byte header, consisting of buildInfoMagic (14 bytes),
|
|
160400
|
+
// the binary's pointer size (1 byte),
|
|
160401
|
+
// and whether the binary is big endian (1 byte).
|
|
160402
|
+
// Now we attempt to read info after metadata.
|
|
160403
|
+
// From 16th byte to 16th + ptrSize there is a header that points
|
|
160404
|
+
// to go version
|
|
160405
|
+
const version = readString(binary, ptrSize, readPtr, readPtr(data.slice(16, 16 + ptrSize)));
|
|
160406
|
+
if (version === "") {
|
|
160407
|
+
return result;
|
|
160354
160408
|
}
|
|
160355
|
-
|
|
160356
|
-
|
|
160357
|
-
|
|
160358
|
-
|
|
160409
|
+
result.version = version;
|
|
160410
|
+
// Go version header was right after metadata.
|
|
160411
|
+
// Modules header right after go version
|
|
160412
|
+
// Read next `ptrSize` bytes, this point to the
|
|
160413
|
+
// place where modules info is stored
|
|
160414
|
+
const mod = readString(binary, ptrSize, readPtr, readPtr(data.slice(16 + ptrSize, 16 + 2 * ptrSize)));
|
|
160415
|
+
// This verifies that what we got are actually go modules
|
|
160416
|
+
// First 16 bytes are unicodes as last 16
|
|
160417
|
+
// Mirrors go version source code
|
|
160418
|
+
if (mod.length >= 33 && mod[mod.length - 17] === "\n") {
|
|
160419
|
+
result.mod = mod.slice(16, mod.length - 16);
|
|
160359
160420
|
}
|
|
160360
160421
|
else {
|
|
160361
|
-
|
|
160362
|
-
}
|
|
160363
|
-
}
|
|
160364
|
-
// The build info blob left by the linker is identified by
|
|
160365
|
-
// a 16-byte header, consisting of buildInfoMagic (14 bytes),
|
|
160366
|
-
// the binary's pointer size (1 byte),
|
|
160367
|
-
// and whether the binary is big endian (1 byte).
|
|
160368
|
-
// Now we attempt to read info after metadata.
|
|
160369
|
-
// From 16th byte to 16th + ptrSize there is a header that points
|
|
160370
|
-
// to go version
|
|
160371
|
-
const version = readString(binary, ptrSize, readPtr, readPtr(data.slice(16, 16 + ptrSize)));
|
|
160372
|
-
if (version === "") {
|
|
160373
|
-
return result;
|
|
160374
|
-
}
|
|
160375
|
-
result.version = version;
|
|
160376
|
-
// Go version header was right after metadata.
|
|
160377
|
-
// Modules header right after go version
|
|
160378
|
-
// Read next `ptrSize` bytes, this point to the
|
|
160379
|
-
// place where modules info is stored
|
|
160380
|
-
const mod = readString(binary, ptrSize, readPtr, readPtr(data.slice(16 + ptrSize, 16 + 2 * ptrSize)));
|
|
160381
|
-
// This verifies that what we got are actually go modules
|
|
160382
|
-
// First 16 bytes are unicodes as last 16
|
|
160383
|
-
// Mirrors go version source code
|
|
160384
|
-
if (mod.length >= 33 && mod[mod.length - 17] === "\n") {
|
|
160385
|
-
result.mod = mod.slice(16, mod.length - 16);
|
|
160386
|
-
}
|
|
160387
|
-
else {
|
|
160388
|
-
result.mod = "";
|
|
160422
|
+
result.mod = "";
|
|
160423
|
+
}
|
|
160389
160424
|
}
|
|
160390
160425
|
return result;
|
|
160391
160426
|
}
|
|
160427
|
+
function decodeString(data) {
|
|
160428
|
+
const num = varint.decode(data);
|
|
160429
|
+
const size = varint.decode.bytes;
|
|
160430
|
+
if (size <= 0 || num >= data.length - size) {
|
|
160431
|
+
return ["", Buffer.from([])];
|
|
160432
|
+
}
|
|
160433
|
+
const res = data.subarray(size, num + size);
|
|
160434
|
+
const rest = data.subarray(num + size);
|
|
160435
|
+
return [res.toString("binary"), rest];
|
|
160436
|
+
}
|
|
160392
160437
|
// Source
|
|
160393
160438
|
// https://github.com/golang/go/blob/46f99ce7ea97d11b0a1a079da8dda0f51df2a2d2/src/cmd/go/internal/version/exe.go#L105
|
|
160394
160439
|
/**
|
|
@@ -161341,8 +161386,8 @@ async function scan(options) {
|
|
|
161341
161386
|
}
|
|
161342
161387
|
const nestedJarsDepth = options["nested-jars-depth"] || options["shaded-jars-depth"];
|
|
161343
161388
|
if (((0, option_utils_1.isTrue)(nestedJarsDepth) || (0, option_utils_1.isNumber)(nestedJarsDepth)) &&
|
|
161344
|
-
|
|
161345
|
-
throw new Error("To use --nested-jars-depth, you must
|
|
161389
|
+
(0, option_utils_1.isTrue)(options["exclude-app-vulns"])) {
|
|
161390
|
+
throw new Error("To use --nested-jars-depth, you must not use --exclude-app-vulns");
|
|
161346
161391
|
}
|
|
161347
161392
|
if ((!(0, option_utils_1.isNumber)(nestedJarsDepth) &&
|
|
161348
161393
|
!(0, option_utils_1.isTrue)(nestedJarsDepth) &&
|
|
@@ -243482,6 +243527,123 @@ for (name in extraFunctions) {
|
|
|
243482
243527
|
|
|
243483
243528
|
;
|
|
243484
243529
|
|
|
243530
|
+
/***/ }),
|
|
243531
|
+
|
|
243532
|
+
/***/ 26988:
|
|
243533
|
+
/***/ ((module) => {
|
|
243534
|
+
|
|
243535
|
+
module.exports = read
|
|
243536
|
+
|
|
243537
|
+
var MSB = 0x80
|
|
243538
|
+
, REST = 0x7F
|
|
243539
|
+
|
|
243540
|
+
function read(buf, offset) {
|
|
243541
|
+
var res = 0
|
|
243542
|
+
, offset = offset || 0
|
|
243543
|
+
, shift = 0
|
|
243544
|
+
, counter = offset
|
|
243545
|
+
, b
|
|
243546
|
+
, l = buf.length
|
|
243547
|
+
|
|
243548
|
+
do {
|
|
243549
|
+
if (counter >= l || shift > 49) {
|
|
243550
|
+
read.bytes = 0
|
|
243551
|
+
throw new RangeError('Could not decode varint')
|
|
243552
|
+
}
|
|
243553
|
+
b = buf[counter++]
|
|
243554
|
+
res += shift < 28
|
|
243555
|
+
? (b & REST) << shift
|
|
243556
|
+
: (b & REST) * Math.pow(2, shift)
|
|
243557
|
+
shift += 7
|
|
243558
|
+
} while (b >= MSB)
|
|
243559
|
+
|
|
243560
|
+
read.bytes = counter - offset
|
|
243561
|
+
|
|
243562
|
+
return res
|
|
243563
|
+
}
|
|
243564
|
+
|
|
243565
|
+
|
|
243566
|
+
/***/ }),
|
|
243567
|
+
|
|
243568
|
+
/***/ 1312:
|
|
243569
|
+
/***/ ((module) => {
|
|
243570
|
+
|
|
243571
|
+
module.exports = encode
|
|
243572
|
+
|
|
243573
|
+
var MSB = 0x80
|
|
243574
|
+
, REST = 0x7F
|
|
243575
|
+
, MSBALL = ~REST
|
|
243576
|
+
, INT = Math.pow(2, 31)
|
|
243577
|
+
|
|
243578
|
+
function encode(num, out, offset) {
|
|
243579
|
+
if (Number.MAX_SAFE_INTEGER && num > Number.MAX_SAFE_INTEGER) {
|
|
243580
|
+
encode.bytes = 0
|
|
243581
|
+
throw new RangeError('Could not encode varint')
|
|
243582
|
+
}
|
|
243583
|
+
out = out || []
|
|
243584
|
+
offset = offset || 0
|
|
243585
|
+
var oldOffset = offset
|
|
243586
|
+
|
|
243587
|
+
while(num >= INT) {
|
|
243588
|
+
out[offset++] = (num & 0xFF) | MSB
|
|
243589
|
+
num /= 128
|
|
243590
|
+
}
|
|
243591
|
+
while(num & MSBALL) {
|
|
243592
|
+
out[offset++] = (num & 0xFF) | MSB
|
|
243593
|
+
num >>>= 7
|
|
243594
|
+
}
|
|
243595
|
+
out[offset] = num | 0
|
|
243596
|
+
|
|
243597
|
+
encode.bytes = offset - oldOffset + 1
|
|
243598
|
+
|
|
243599
|
+
return out
|
|
243600
|
+
}
|
|
243601
|
+
|
|
243602
|
+
|
|
243603
|
+
/***/ }),
|
|
243604
|
+
|
|
243605
|
+
/***/ 94676:
|
|
243606
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
243607
|
+
|
|
243608
|
+
module.exports = {
|
|
243609
|
+
encode: __webpack_require__(1312)
|
|
243610
|
+
, decode: __webpack_require__(26988)
|
|
243611
|
+
, encodingLength: __webpack_require__(10082)
|
|
243612
|
+
}
|
|
243613
|
+
|
|
243614
|
+
|
|
243615
|
+
/***/ }),
|
|
243616
|
+
|
|
243617
|
+
/***/ 10082:
|
|
243618
|
+
/***/ ((module) => {
|
|
243619
|
+
|
|
243620
|
+
|
|
243621
|
+
var N1 = Math.pow(2, 7)
|
|
243622
|
+
var N2 = Math.pow(2, 14)
|
|
243623
|
+
var N3 = Math.pow(2, 21)
|
|
243624
|
+
var N4 = Math.pow(2, 28)
|
|
243625
|
+
var N5 = Math.pow(2, 35)
|
|
243626
|
+
var N6 = Math.pow(2, 42)
|
|
243627
|
+
var N7 = Math.pow(2, 49)
|
|
243628
|
+
var N8 = Math.pow(2, 56)
|
|
243629
|
+
var N9 = Math.pow(2, 63)
|
|
243630
|
+
|
|
243631
|
+
module.exports = function (value) {
|
|
243632
|
+
return (
|
|
243633
|
+
value < N1 ? 1
|
|
243634
|
+
: value < N2 ? 2
|
|
243635
|
+
: value < N3 ? 3
|
|
243636
|
+
: value < N4 ? 4
|
|
243637
|
+
: value < N5 ? 5
|
|
243638
|
+
: value < N6 ? 6
|
|
243639
|
+
: value < N7 ? 7
|
|
243640
|
+
: value < N8 ? 8
|
|
243641
|
+
: value < N9 ? 9
|
|
243642
|
+
: 10
|
|
243643
|
+
)
|
|
243644
|
+
}
|
|
243645
|
+
|
|
243646
|
+
|
|
243485
243647
|
/***/ }),
|
|
243486
243648
|
|
|
243487
243649
|
/***/ 91674:
|