snyk 1.725.0 → 1.726.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/64.index.js
CHANGED
|
@@ -6595,21 +6595,24 @@ exports.rootSpecName = rootSpecName;
|
|
|
6595
6595
|
|
|
6596
6596
|
"use strict";
|
|
6597
6597
|
|
|
6598
|
-
/* eslint-disable no-await-in-loop */
|
|
6599
6598
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
6600
6599
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
6601
6600
|
};
|
|
6602
6601
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
6603
6602
|
exports.extendAnalysis = exports.analyzeFolders = exports.analyzeBundle = void 0;
|
|
6603
|
+
/* eslint-disable no-await-in-loop */
|
|
6604
|
+
const lodash_omit_1 = __importDefault(__webpack_require__(76427));
|
|
6604
6605
|
const files_1 = __webpack_require__(32083);
|
|
6606
|
+
const constants_1 = __webpack_require__(65765);
|
|
6605
6607
|
const http_1 = __webpack_require__(60776);
|
|
6608
|
+
const utils_1 = __webpack_require__(24054);
|
|
6606
6609
|
const bundles_1 = __webpack_require__(86639);
|
|
6607
|
-
const emitter_1 =
|
|
6610
|
+
const emitter_1 = __webpack_require__(37544);
|
|
6608
6611
|
const sleep = (duration) => new Promise(resolve => setTimeout(resolve, duration));
|
|
6609
6612
|
async function pollAnalysis(options) {
|
|
6610
6613
|
let analysisResponse;
|
|
6611
6614
|
let analysisData;
|
|
6612
|
-
emitter_1.
|
|
6615
|
+
emitter_1.emitter.analyseProgress({
|
|
6613
6616
|
status: http_1.AnalysisStatus.waiting,
|
|
6614
6617
|
progress: 0,
|
|
6615
6618
|
});
|
|
@@ -6625,7 +6628,7 @@ async function pollAnalysis(options) {
|
|
|
6625
6628
|
analysisData.status === http_1.AnalysisStatus.analyzing ||
|
|
6626
6629
|
analysisData.status === http_1.AnalysisStatus.done) {
|
|
6627
6630
|
// Report progress of fetching
|
|
6628
|
-
emitter_1.
|
|
6631
|
+
emitter_1.emitter.analyseProgress(analysisData);
|
|
6629
6632
|
}
|
|
6630
6633
|
else if (analysisData.status === http_1.AnalysisStatus.complete) {
|
|
6631
6634
|
// Return data of analysis
|
|
@@ -6636,7 +6639,7 @@ async function pollAnalysis(options) {
|
|
|
6636
6639
|
// Report failure of analysing
|
|
6637
6640
|
return analysisResponse;
|
|
6638
6641
|
}
|
|
6639
|
-
await sleep(
|
|
6642
|
+
await sleep(constants_1.POLLING_INTERVAL);
|
|
6640
6643
|
}
|
|
6641
6644
|
}
|
|
6642
6645
|
async function analyzeBundle(options) {
|
|
@@ -6651,6 +6654,15 @@ async function analyzeBundle(options) {
|
|
|
6651
6654
|
return analysisData.value;
|
|
6652
6655
|
}
|
|
6653
6656
|
exports.analyzeBundle = analyzeBundle;
|
|
6657
|
+
function normalizeResultFiles(files, baseDir) {
|
|
6658
|
+
if (baseDir) {
|
|
6659
|
+
return (0, utils_1.fromEntries)(Object.entries(files).map(([path, positions]) => {
|
|
6660
|
+
const filePath = (0, files_1.resolveBundleFilePath)(baseDir, path);
|
|
6661
|
+
return [filePath, positions];
|
|
6662
|
+
}));
|
|
6663
|
+
}
|
|
6664
|
+
return files;
|
|
6665
|
+
}
|
|
6654
6666
|
async function analyzeFolders(options) {
|
|
6655
6667
|
const fileBundle = await (0, bundles_1.createBundleFromFolders)({
|
|
6656
6668
|
...options.connection,
|
|
@@ -6664,12 +6676,20 @@ async function analyzeFolders(options) {
|
|
|
6664
6676
|
...options.connection,
|
|
6665
6677
|
...options.analysisOptions,
|
|
6666
6678
|
});
|
|
6667
|
-
|
|
6668
|
-
|
|
6679
|
+
if (analysisResults.type === 'legacy') {
|
|
6680
|
+
// expand relative file names to absolute ones only for legacy results
|
|
6681
|
+
analysisResults.files = normalizeResultFiles(analysisResults.files, fileBundle.baseDir);
|
|
6682
|
+
}
|
|
6669
6683
|
return { fileBundle, analysisResults, ...options };
|
|
6670
6684
|
}
|
|
6671
6685
|
exports.analyzeFolders = analyzeFolders;
|
|
6672
|
-
function mergeBundleResults(oldAnalysisResults, newAnalysisResults, limitToFiles, removedFiles = []) {
|
|
6686
|
+
function mergeBundleResults(oldAnalysisResults, newAnalysisResults, limitToFiles, removedFiles = [], baseDir) {
|
|
6687
|
+
if (newAnalysisResults.type == 'sarif') {
|
|
6688
|
+
return mergeSarifResults(oldAnalysisResults, newAnalysisResults, limitToFiles, removedFiles);
|
|
6689
|
+
}
|
|
6690
|
+
return mergeLegacyResults(oldAnalysisResults, newAnalysisResults, limitToFiles, removedFiles, baseDir);
|
|
6691
|
+
}
|
|
6692
|
+
function mergeSarifResults(oldAnalysisResults, newAnalysisResults, limitToFiles, removedFiles = []) {
|
|
6673
6693
|
// Start from the new analysis results
|
|
6674
6694
|
// For each finding of the old analysis,
|
|
6675
6695
|
// if it's location is not part of the limitToFiles or removedFiles (removedFiles should also be checked against condeFlow),
|
|
@@ -6733,6 +6753,35 @@ function mergeBundleResults(oldAnalysisResults, newAnalysisResults, limitToFiles
|
|
|
6733
6753
|
newAnalysisResults.sarif.runs[0].tool.driver.rules = sarifRules;
|
|
6734
6754
|
return newAnalysisResults;
|
|
6735
6755
|
}
|
|
6756
|
+
const moveSuggestionIndexes = (suggestionIndex, suggestions) => {
|
|
6757
|
+
const entries = Object.entries(suggestions);
|
|
6758
|
+
return (0, utils_1.fromEntries)(entries.map(([i, s]) => {
|
|
6759
|
+
return [`${parseInt(i, 10) + suggestionIndex + 1}`, s];
|
|
6760
|
+
}));
|
|
6761
|
+
};
|
|
6762
|
+
function mergeLegacyResults(oldAnalysisResults, newAnalysisResults, limitToFiles, removedFiles = [], baseDir) {
|
|
6763
|
+
// expand relative file names to absolute ones only for legacy results
|
|
6764
|
+
newAnalysisResults.files = normalizeResultFiles(newAnalysisResults.files, baseDir);
|
|
6765
|
+
// Determine max suggestion index in our data
|
|
6766
|
+
const suggestionIndex = Math.max(...Object.keys(oldAnalysisResults.suggestions).map(i => parseInt(i, 10))) || -1;
|
|
6767
|
+
// Addup all new suggestions' indexes
|
|
6768
|
+
const newSuggestions = moveSuggestionIndexes(suggestionIndex, newAnalysisResults.suggestions);
|
|
6769
|
+
const suggestions = { ...oldAnalysisResults.suggestions, ...newSuggestions };
|
|
6770
|
+
const newFiles = (0, utils_1.fromEntries)(Object.entries(newAnalysisResults.files).map(([fn, s]) => {
|
|
6771
|
+
return [fn, moveSuggestionIndexes(suggestionIndex, s)];
|
|
6772
|
+
}));
|
|
6773
|
+
// expand relative file names to absolute ones only for legacy results
|
|
6774
|
+
const changedFiles = [...limitToFiles, ...removedFiles].map(path => (0, files_1.resolveBundleFilePath)(baseDir, path));
|
|
6775
|
+
const files = {
|
|
6776
|
+
...(0, lodash_omit_1.default)(oldAnalysisResults.files, changedFiles),
|
|
6777
|
+
...newFiles,
|
|
6778
|
+
};
|
|
6779
|
+
return {
|
|
6780
|
+
...newAnalysisResults,
|
|
6781
|
+
files,
|
|
6782
|
+
suggestions,
|
|
6783
|
+
};
|
|
6784
|
+
}
|
|
6736
6785
|
async function extendAnalysis(options) {
|
|
6737
6786
|
const { files, removedFiles } = await (0, files_1.prepareExtendingBundle)(options.fileBundle.baseDir, options.fileBundle.supportedFiles, options.fileBundle.fileIgnores, options.files, options.fileOptions.maxPayload, options.fileOptions.symlinksEnabled);
|
|
6738
6787
|
if (!files.length && !removedFiles.length) {
|
|
@@ -6760,9 +6809,7 @@ async function extendAnalysis(options) {
|
|
|
6760
6809
|
...options.analysisOptions,
|
|
6761
6810
|
limitToFiles,
|
|
6762
6811
|
});
|
|
6763
|
-
|
|
6764
|
-
// analysisData.analysisResults.files = normalizeResultFiles(analysisData.analysisResults.files, bundle.baseDir);
|
|
6765
|
-
analysisResults = mergeBundleResults(options.analysisResults, analysisResults, limitToFiles, removedFiles);
|
|
6812
|
+
analysisResults = mergeBundleResults(options.analysisResults, analysisResults, limitToFiles, removedFiles, options.fileBundle.baseDir);
|
|
6766
6813
|
return { ...options, fileBundle, analysisResults };
|
|
6767
6814
|
}
|
|
6768
6815
|
exports.extendAnalysis = extendAnalysis;
|
|
@@ -6787,12 +6834,12 @@ const p_map_1 = __importDefault(__webpack_require__(49503));
|
|
|
6787
6834
|
const files_1 = __webpack_require__(32083);
|
|
6788
6835
|
const http_1 = __webpack_require__(60776);
|
|
6789
6836
|
const constants_1 = __webpack_require__(65765);
|
|
6790
|
-
const emitter_1 =
|
|
6837
|
+
const emitter_1 = __webpack_require__(37544);
|
|
6791
6838
|
async function* prepareRemoteBundle({ maxPayload = constants_1.MAX_PAYLOAD, ...options }) {
|
|
6792
6839
|
let response;
|
|
6793
6840
|
let { bundleHash } = options;
|
|
6794
6841
|
let cumulativeProgress = 0;
|
|
6795
|
-
emitter_1.
|
|
6842
|
+
emitter_1.emitter.createBundleProgress(cumulativeProgress, options.files.length);
|
|
6796
6843
|
for (const chunkedFiles of (0, files_1.composeFilePayloads)(options.files, maxPayload)) {
|
|
6797
6844
|
const apiParams = {
|
|
6798
6845
|
...(0, lodash_pick_1.default)(options, ['baseURL', 'sessionToken', 'source', 'removedFiles']),
|
|
@@ -6807,7 +6854,7 @@ async function* prepareRemoteBundle({ maxPayload = constants_1.MAX_PAYLOAD, ...o
|
|
|
6807
6854
|
response = await (0, http_1.extendBundle)({ bundleHash, ...apiParams });
|
|
6808
6855
|
}
|
|
6809
6856
|
cumulativeProgress += chunkedFiles.length;
|
|
6810
|
-
emitter_1.
|
|
6857
|
+
emitter_1.emitter.createBundleProgress(cumulativeProgress, options.files.length);
|
|
6811
6858
|
if (response.type === 'error') {
|
|
6812
6859
|
// TODO: process Error
|
|
6813
6860
|
yield response;
|
|
@@ -6825,7 +6872,7 @@ async function* prepareRemoteBundle({ maxPayload = constants_1.MAX_PAYLOAD, ...o
|
|
|
6825
6872
|
*/
|
|
6826
6873
|
async function uploadRemoteBundle({ maxPayload = constants_1.MAX_PAYLOAD, ...options }) {
|
|
6827
6874
|
let uploadedFiles = 0;
|
|
6828
|
-
emitter_1.
|
|
6875
|
+
emitter_1.emitter.uploadBundleProgress(0, options.files.length);
|
|
6829
6876
|
const apiParams = (0, lodash_pick_1.default)(options, ['baseURL', 'sessionToken', 'source', 'bundleHash']);
|
|
6830
6877
|
const uploadFileChunks = async (bucketFiles) => {
|
|
6831
6878
|
const resp = await (0, http_1.extendBundle)({
|
|
@@ -6835,7 +6882,7 @@ async function uploadRemoteBundle({ maxPayload = constants_1.MAX_PAYLOAD, ...opt
|
|
|
6835
6882
|
// During upload process, we expect the bundleHash not to change (same file map)
|
|
6836
6883
|
if (resp.type !== 'error' && resp.value.bundleHash === apiParams.bundleHash) {
|
|
6837
6884
|
uploadedFiles += bucketFiles.length;
|
|
6838
|
-
emitter_1.
|
|
6885
|
+
emitter_1.emitter.uploadBundleProgress(uploadedFiles, options.files.length);
|
|
6839
6886
|
return true;
|
|
6840
6887
|
}
|
|
6841
6888
|
return false;
|
|
@@ -6901,13 +6948,13 @@ exports.remoteBundleFactory = remoteBundleFactory;
|
|
|
6901
6948
|
* @returns
|
|
6902
6949
|
*/
|
|
6903
6950
|
async function getSupportedFiles(baseURL, source) {
|
|
6904
|
-
emitter_1.
|
|
6951
|
+
emitter_1.emitter.supportedFilesLoaded(null);
|
|
6905
6952
|
const resp = await (0, http_1.getFilters)(baseURL, source);
|
|
6906
6953
|
if (resp.type === 'error') {
|
|
6907
6954
|
throw resp.error;
|
|
6908
6955
|
}
|
|
6909
6956
|
const supportedFiles = resp.value;
|
|
6910
|
-
emitter_1.
|
|
6957
|
+
emitter_1.emitter.supportedFilesLoaded(supportedFiles);
|
|
6911
6958
|
return supportedFiles;
|
|
6912
6959
|
}
|
|
6913
6960
|
/**
|
|
@@ -6924,7 +6971,7 @@ async function createBundleFromFolders(options) {
|
|
|
6924
6971
|
// Scan for custom ignore rules
|
|
6925
6972
|
(0, files_1.collectIgnoreRules)(options.paths, options.symlinksEnabled, options.defaultFileIgnores),
|
|
6926
6973
|
]);
|
|
6927
|
-
emitter_1.
|
|
6974
|
+
emitter_1.emitter.scanFilesProgress(0);
|
|
6928
6975
|
const bundleFiles = [];
|
|
6929
6976
|
let totalFiles = 0;
|
|
6930
6977
|
const bundleFileCollector = (0, files_1.collectBundleFiles)({
|
|
@@ -6936,7 +6983,7 @@ async function createBundleFromFolders(options) {
|
|
|
6936
6983
|
for await (const f of bundleFileCollector) {
|
|
6937
6984
|
bundleFiles.push(f);
|
|
6938
6985
|
totalFiles += 1;
|
|
6939
|
-
emitter_1.
|
|
6986
|
+
emitter_1.emitter.scanFilesProgress(totalFiles);
|
|
6940
6987
|
}
|
|
6941
6988
|
const bundleOptions = {
|
|
6942
6989
|
...(0, lodash_pick_1.default)(options, ['baseURL', 'sessionToken', 'source']),
|
|
@@ -7044,7 +7091,7 @@ exports.readJSON = readJSON;
|
|
|
7044
7091
|
"use strict";
|
|
7045
7092
|
|
|
7046
7093
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
7047
|
-
exports.DEFAULT_ERROR_MESSAGES = exports.ErrorCodes = exports.DCIGNORE_DRAFTS = exports.IGNORE_FILES_NAMES = exports.IGNORES_DEFAULT = exports.REQUEST_RETRY_DELAY = exports.MAX_RETRY_ATTEMPTS = exports.UPLOAD_CONCURRENCY = exports.MAX_UPLOAD_ATTEMPTS = exports.CACHE_KEY = exports.EXCLUDED_NAMES = exports.DOTSNYK_FILENAME = exports.DCIGNORE_FILENAME = exports.GITIGNORE_FILENAME = exports.GIT_FILENAME = exports.ENCODE_TYPE = exports.HASH_ALGORITHM = exports.defaultBaseURL = exports.MAX_PAYLOAD = void 0;
|
|
7094
|
+
exports.DEFAULT_ERROR_MESSAGES = exports.ErrorCodes = exports.DCIGNORE_DRAFTS = exports.IGNORE_FILES_NAMES = exports.IGNORES_DEFAULT = exports.REQUEST_RETRY_DELAY = exports.MAX_RETRY_ATTEMPTS = exports.POLLING_INTERVAL = exports.UPLOAD_CONCURRENCY = exports.MAX_UPLOAD_ATTEMPTS = exports.CACHE_KEY = exports.EXCLUDED_NAMES = exports.DOTSNYK_FILENAME = exports.DCIGNORE_FILENAME = exports.GITIGNORE_FILENAME = exports.GIT_FILENAME = exports.ENCODE_TYPE = exports.HASH_ALGORITHM = exports.defaultBaseURL = exports.MAX_PAYLOAD = void 0;
|
|
7048
7095
|
const dcignore_1 = __webpack_require__(55086);
|
|
7049
7096
|
exports.MAX_PAYLOAD = 4 * 1024 * 1024;
|
|
7050
7097
|
exports.defaultBaseURL = 'https://api.snyk.deepcode.ai';
|
|
@@ -7058,6 +7105,7 @@ exports.EXCLUDED_NAMES = [exports.GIT_FILENAME, exports.GITIGNORE_FILENAME, expo
|
|
|
7058
7105
|
exports.CACHE_KEY = '.dccache';
|
|
7059
7106
|
exports.MAX_UPLOAD_ATTEMPTS = 5;
|
|
7060
7107
|
exports.UPLOAD_CONCURRENCY = 5;
|
|
7108
|
+
exports.POLLING_INTERVAL = 500;
|
|
7061
7109
|
exports.MAX_RETRY_ATTEMPTS = 5; // Request retries on network errors
|
|
7062
7110
|
exports.REQUEST_RETRY_DELAY = 30 * 1000; // 30 seconds delay between retries
|
|
7063
7111
|
exports.IGNORES_DEFAULT = [`**/${exports.GIT_FILENAME}/**`];
|
|
@@ -7106,7 +7154,7 @@ exports.DEFAULT_ERROR_MESSAGES = {
|
|
|
7106
7154
|
"use strict";
|
|
7107
7155
|
|
|
7108
7156
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
7109
|
-
exports.EmitterDC = void 0;
|
|
7157
|
+
exports.emitter = exports.EmitterDC = void 0;
|
|
7110
7158
|
const events_1 = __webpack_require__(28614);
|
|
7111
7159
|
// eslint-disable-next-line no-shadow
|
|
7112
7160
|
var CUSTOM_EVENTS;
|
|
@@ -7147,8 +7195,7 @@ class EmitterDC extends events_1.EventEmitter {
|
|
|
7147
7195
|
}
|
|
7148
7196
|
}
|
|
7149
7197
|
exports.EmitterDC = EmitterDC;
|
|
7150
|
-
|
|
7151
|
-
exports.default = emitter;
|
|
7198
|
+
exports.emitter = new EmitterDC();
|
|
7152
7199
|
//# sourceMappingURL=emitter.js.map
|
|
7153
7200
|
|
|
7154
7201
|
/***/ }),
|
|
@@ -7270,6 +7317,7 @@ function parseIgnoreRulesToGlobs(rules, baseDir) {
|
|
|
7270
7317
|
}, []);
|
|
7271
7318
|
}
|
|
7272
7319
|
function parseFileIgnores(path) {
|
|
7320
|
+
var _a, _b;
|
|
7273
7321
|
let rules = [];
|
|
7274
7322
|
const dirname = nodePath.dirname(path);
|
|
7275
7323
|
try {
|
|
@@ -7278,7 +7326,9 @@ function parseFileIgnores(path) {
|
|
|
7278
7326
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
7279
7327
|
const parsed = (0, yaml_1.parse)(f);
|
|
7280
7328
|
const concatIgnorePath = (p) => `${nodePath.dirname(path)}/${p}`;
|
|
7281
|
-
|
|
7329
|
+
const codeIgnoredPaths = ((_a = parsed.exclude.code) === null || _a === void 0 ? void 0 : _a.map(concatIgnorePath)) || [];
|
|
7330
|
+
const globalIgnoredPaths = ((_b = parsed.exclude.global) === null || _b === void 0 ? void 0 : _b.map(concatIgnorePath)) || [];
|
|
7331
|
+
return [...codeIgnoredPaths, ...globalIgnoredPaths];
|
|
7282
7332
|
}
|
|
7283
7333
|
rules = f
|
|
7284
7334
|
.split('\n')
|
|
@@ -7838,8 +7888,7 @@ async function getAnalysis(options) {
|
|
|
7838
7888
|
hash: options.bundleHash,
|
|
7839
7889
|
limitToFiles: options.limitToFiles || [],
|
|
7840
7890
|
},
|
|
7841
|
-
...(0, lodash_pick_1.default)(options, ['severity', 'prioritized']),
|
|
7842
|
-
// severity: options.severity || AnalysisSeverity.info,
|
|
7891
|
+
...(0, lodash_pick_1.default)(options, ['severity', 'prioritized', 'legacy']),
|
|
7843
7892
|
},
|
|
7844
7893
|
};
|
|
7845
7894
|
try {
|
|
@@ -7881,21 +7930,20 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
7881
7930
|
__setModuleDefault(result, mod);
|
|
7882
7931
|
return result;
|
|
7883
7932
|
};
|
|
7884
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7885
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
7886
|
-
};
|
|
7887
7933
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
7888
|
-
exports.
|
|
7934
|
+
exports.getIpFamily = exports.checkSession = exports.startSession = exports.getAnalysis = exports.AnalysisSeverity = exports.constants = exports.emitter = exports.extendAnalysis = exports.createBundleFromFolders = exports.analyzeFolders = exports.getGlobPatterns = void 0;
|
|
7889
7935
|
const analysis_1 = __webpack_require__(54151);
|
|
7890
7936
|
Object.defineProperty(exports, "analyzeFolders", ({ enumerable: true, get: function () { return analysis_1.analyzeFolders; } }));
|
|
7937
|
+
Object.defineProperty(exports, "extendAnalysis", ({ enumerable: true, get: function () { return analysis_1.extendAnalysis; } }));
|
|
7891
7938
|
const bundles_1 = __webpack_require__(86639);
|
|
7892
7939
|
Object.defineProperty(exports, "createBundleFromFolders", ({ enumerable: true, get: function () { return bundles_1.createBundleFromFolders; } }));
|
|
7893
|
-
const emitter_1 =
|
|
7894
|
-
exports
|
|
7940
|
+
const emitter_1 = __webpack_require__(37544);
|
|
7941
|
+
Object.defineProperty(exports, "emitter", ({ enumerable: true, get: function () { return emitter_1.emitter; } }));
|
|
7895
7942
|
const http_1 = __webpack_require__(60776);
|
|
7896
7943
|
Object.defineProperty(exports, "startSession", ({ enumerable: true, get: function () { return http_1.startSession; } }));
|
|
7897
7944
|
Object.defineProperty(exports, "checkSession", ({ enumerable: true, get: function () { return http_1.checkSession; } }));
|
|
7898
7945
|
Object.defineProperty(exports, "getAnalysis", ({ enumerable: true, get: function () { return http_1.getAnalysis; } }));
|
|
7946
|
+
Object.defineProperty(exports, "getIpFamily", ({ enumerable: true, get: function () { return http_1.getIpFamily; } }));
|
|
7899
7947
|
const constants = __importStar(__webpack_require__(65765));
|
|
7900
7948
|
exports.constants = constants;
|
|
7901
7949
|
const files_1 = __webpack_require__(32083);
|
|
@@ -7924,6 +7972,24 @@ var AnalysisSeverity;
|
|
|
7924
7972
|
|
|
7925
7973
|
/***/ }),
|
|
7926
7974
|
|
|
7975
|
+
/***/ 24054:
|
|
7976
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
7977
|
+
|
|
7978
|
+
"use strict";
|
|
7979
|
+
|
|
7980
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
7981
|
+
exports.fromEntries = void 0;
|
|
7982
|
+
function fromEntries(entries) {
|
|
7983
|
+
return [...entries].reduce((obj, [key, val]) => {
|
|
7984
|
+
obj[key] = val; // eslint-disable-line no-param-reassign
|
|
7985
|
+
return obj;
|
|
7986
|
+
}, {});
|
|
7987
|
+
}
|
|
7988
|
+
exports.fromEntries = fromEntries;
|
|
7989
|
+
//# sourceMappingURL=utils.js.map
|
|
7990
|
+
|
|
7991
|
+
/***/ }),
|
|
7992
|
+
|
|
7927
7993
|
/***/ 14577:
|
|
7928
7994
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
7929
7995
|
|
|
@@ -7958,7 +8024,7 @@ const needle_1 = __importDefault(__webpack_require__(11642));
|
|
|
7958
8024
|
const querystring = __importStar(__webpack_require__(71191));
|
|
7959
8025
|
const https_1 = __importDefault(__webpack_require__(57211));
|
|
7960
8026
|
const url_1 = __webpack_require__(78835);
|
|
7961
|
-
const emitter_1 =
|
|
8027
|
+
const emitter_1 = __webpack_require__(37544);
|
|
7962
8028
|
const constants_1 = __webpack_require__(65765);
|
|
7963
8029
|
const agentOptions = {
|
|
7964
8030
|
keepAlive: true,
|
|
@@ -7995,14 +8061,14 @@ async function makeRequest(payload) {
|
|
|
7995
8061
|
rejectUnauthorized: !global.ignoreUnknownCA,
|
|
7996
8062
|
agent,
|
|
7997
8063
|
};
|
|
7998
|
-
emitter_1.
|
|
8064
|
+
emitter_1.emitter.apiRequestLog(`=> HTTP ${method === null || method === void 0 ? void 0 : method.toUpperCase()} ${url} ${data !== null && data !== void 0 ? data : ''}`.slice(0, 399));
|
|
7999
8065
|
let attempts = (_a = payload.attempts) !== null && _a !== void 0 ? _a : constants_1.MAX_RETRY_ATTEMPTS;
|
|
8000
8066
|
let retryDelay = (_b = payload.retryDelay) !== null && _b !== void 0 ? _b : constants_1.REQUEST_RETRY_DELAY;
|
|
8001
8067
|
let response, success;
|
|
8002
8068
|
do {
|
|
8003
8069
|
try {
|
|
8004
8070
|
response = await (0, needle_1.default)(method, url, data, options);
|
|
8005
|
-
emitter_1.
|
|
8071
|
+
emitter_1.emitter.apiRequestLog(`<= Response: ${response.statusCode} ${JSON.stringify(response.body)}`);
|
|
8006
8072
|
success = !!(response.statusCode && response.statusCode >= 200 && response.statusCode < 300);
|
|
8007
8073
|
if (success)
|
|
8008
8074
|
return { success, response };
|
|
@@ -8022,7 +8088,7 @@ async function makeRequest(payload) {
|
|
|
8022
8088
|
}
|
|
8023
8089
|
}
|
|
8024
8090
|
catch (err) {
|
|
8025
|
-
emitter_1.
|
|
8091
|
+
emitter_1.emitter.apiRequestLog(`Request error --> ${err}`.slice(0, 399));
|
|
8026
8092
|
throw err;
|
|
8027
8093
|
}
|
|
8028
8094
|
} while (attempts > 0);
|
|
@@ -8723,7 +8789,7 @@ var digest = {};
|
|
|
8723
8789
|
|
|
8724
8790
|
digest.parse_header = function(header) {
|
|
8725
8791
|
var challenge = {},
|
|
8726
|
-
matches = header.match(/([a-z0-9_-]+)="?([a-z0-
|
|
8792
|
+
matches = header.match(/([a-z0-9_-]+)="?([a-z0-9_=\/\.@\s-\+)()]+)"?/gi);
|
|
8727
8793
|
|
|
8728
8794
|
for (var i = 0, l = matches.length; i < l; i++) {
|
|
8729
8795
|
var parts = matches[i].split('='),
|
|
@@ -9221,6 +9287,28 @@ function get_stream_length(stream, given_length, cb) {
|
|
|
9221
9287
|
});
|
|
9222
9288
|
}
|
|
9223
9289
|
|
|
9290
|
+
function resolve_url(href, base) {
|
|
9291
|
+
if (url.URL)
|
|
9292
|
+
return new url.URL(href, base);
|
|
9293
|
+
|
|
9294
|
+
// older Node version (< v6.13)
|
|
9295
|
+
return url.resolve(base, href);
|
|
9296
|
+
}
|
|
9297
|
+
|
|
9298
|
+
function pump_streams(streams, cb) {
|
|
9299
|
+
if (stream.pipeline)
|
|
9300
|
+
return stream.pipeline.apply(null, streams.concat(cb));
|
|
9301
|
+
|
|
9302
|
+
var tmp = streams.shift();
|
|
9303
|
+
while (streams.length) {
|
|
9304
|
+
tmp = tmp.pipe(streams.shift());
|
|
9305
|
+
tmp.once('error', function(e) {
|
|
9306
|
+
cb && cb(e);
|
|
9307
|
+
cb = null;
|
|
9308
|
+
})
|
|
9309
|
+
}
|
|
9310
|
+
}
|
|
9311
|
+
|
|
9224
9312
|
//////////////////////////////////////////
|
|
9225
9313
|
// the main act
|
|
9226
9314
|
|
|
@@ -9232,7 +9320,7 @@ function Needle(method, uri, data, options, callback) {
|
|
|
9232
9320
|
if (typeof uri !== 'string')
|
|
9233
9321
|
throw new TypeError('URL must be a string, not ' + uri);
|
|
9234
9322
|
|
|
9235
|
-
this.method = method;
|
|
9323
|
+
this.method = method.toLowerCase();
|
|
9236
9324
|
this.uri = uri;
|
|
9237
9325
|
this.data = data;
|
|
9238
9326
|
|
|
@@ -9395,7 +9483,7 @@ Needle.prototype.start = function() {
|
|
|
9395
9483
|
|
|
9396
9484
|
} else if (is_stream(data)) {
|
|
9397
9485
|
|
|
9398
|
-
if (method
|
|
9486
|
+
if (method == 'get')
|
|
9399
9487
|
throw new Error('Refusing to pipe() a stream via GET. Did you mean .post?');
|
|
9400
9488
|
|
|
9401
9489
|
if (config.stream_length > 0 || (config.stream_length === 0 && data.path)) {
|
|
@@ -9417,7 +9505,7 @@ Needle.prototype.start = function() {
|
|
|
9417
9505
|
|
|
9418
9506
|
body = data; // use the raw buffer as request body.
|
|
9419
9507
|
|
|
9420
|
-
} else if (method
|
|
9508
|
+
} else if (method == 'get' && !json) {
|
|
9421
9509
|
|
|
9422
9510
|
// append the data to the URI as a querystring.
|
|
9423
9511
|
uri = uri.replace(/\?.*|$/, '?' + stringify(data));
|
|
@@ -9513,7 +9601,8 @@ Needle.prototype.send_request = function(count, method, uri, config, post_data,
|
|
|
9513
9601
|
uri = modified_uri;
|
|
9514
9602
|
}
|
|
9515
9603
|
|
|
9516
|
-
var
|
|
9604
|
+
var request,
|
|
9605
|
+
timer,
|
|
9517
9606
|
returned = 0,
|
|
9518
9607
|
self = this,
|
|
9519
9608
|
request_opts = this.get_request_opts(method, uri, config),
|
|
@@ -9525,6 +9614,7 @@ Needle.prototype.send_request = function(count, method, uri, config, post_data,
|
|
|
9525
9614
|
|
|
9526
9615
|
if (timer) clearTimeout(timer);
|
|
9527
9616
|
request.removeListener('error', had_error);
|
|
9617
|
+
out.done = true;
|
|
9528
9618
|
|
|
9529
9619
|
if (callback)
|
|
9530
9620
|
return callback(err, resp, resp ? resp.body : undefined);
|
|
@@ -9532,6 +9622,11 @@ Needle.prototype.send_request = function(count, method, uri, config, post_data,
|
|
|
9532
9622
|
// NOTE: this event used to be called 'end', but the behaviour was confusing
|
|
9533
9623
|
// when errors ocurred, because the stream would still emit an 'end' event.
|
|
9534
9624
|
out.emit('done', err);
|
|
9625
|
+
|
|
9626
|
+
// trigger the 'done' event on streams we're being piped to, if any
|
|
9627
|
+
var pipes = out._readableState.pipes || [];
|
|
9628
|
+
if (!pipes.forEach) pipes = [pipes];
|
|
9629
|
+
pipes.forEach(function(st) { st.emit('done', err); })
|
|
9535
9630
|
}
|
|
9536
9631
|
|
|
9537
9632
|
function had_error(err) {
|
|
@@ -9563,7 +9658,7 @@ Needle.prototype.send_request = function(count, method, uri, config, post_data,
|
|
|
9563
9658
|
}
|
|
9564
9659
|
|
|
9565
9660
|
debug('Making request #' + count, request_opts);
|
|
9566
|
-
|
|
9661
|
+
request = protocol.request(request_opts, function(resp) {
|
|
9567
9662
|
|
|
9568
9663
|
var headers = resp.headers;
|
|
9569
9664
|
debug('Got response', resp.statusCode, headers);
|
|
@@ -9611,8 +9706,9 @@ Needle.prototype.send_request = function(count, method, uri, config, post_data,
|
|
|
9611
9706
|
|
|
9612
9707
|
config.headers['host'] = null; // clear previous Host header to avoid conflicts.
|
|
9613
9708
|
|
|
9614
|
-
|
|
9615
|
-
|
|
9709
|
+
var redirect_url = resolve_url(headers.location, uri);
|
|
9710
|
+
debug('Redirecting to ' + redirect_url.toString());
|
|
9711
|
+
return self.send_request(++count, method, redirect_url.toString(), config, post_data, out, callback);
|
|
9616
9712
|
} else if (config.follow_max > 0) {
|
|
9617
9713
|
return done(new Error('Max redirects reached. Possible loop in: ' + headers.location));
|
|
9618
9714
|
}
|
|
@@ -9636,7 +9732,7 @@ Needle.prototype.send_request = function(count, method, uri, config, post_data,
|
|
|
9636
9732
|
|
|
9637
9733
|
var pipeline = [],
|
|
9638
9734
|
mime = parse_content_type(headers['content-type']),
|
|
9639
|
-
text_response = mime.type && mime.type.indexOf('text/') != -1;
|
|
9735
|
+
text_response = mime.type && (mime.type.indexOf('text/') != -1 || !!mime.type.match(/(\/|\+)(xml|json)$/));
|
|
9640
9736
|
|
|
9641
9737
|
// To start, if our body is compressed and we're able to inflate it, do it.
|
|
9642
9738
|
if (headers['content-encoding'] && decompressors[headers['content-encoding']]) {
|
|
@@ -9666,18 +9762,21 @@ Needle.prototype.send_request = function(count, method, uri, config, post_data,
|
|
|
9666
9762
|
|
|
9667
9763
|
// If we're not parsing, and unless decoding was disabled, we'll try
|
|
9668
9764
|
// decoding non UTF-8 bodies to UTF-8, using the iconv-lite library.
|
|
9669
|
-
} else if (text_response && config.decode_response
|
|
9670
|
-
|
|
9671
|
-
pipeline.push(decoder(mime.charset));
|
|
9765
|
+
} else if (text_response && config.decode_response && mime.charset) {
|
|
9766
|
+
pipeline.push(decoder(mime.charset));
|
|
9672
9767
|
}
|
|
9768
|
+
|
|
9673
9769
|
// And `out` is the stream we finally push the decoded/parsed output to.
|
|
9674
9770
|
pipeline.push(out);
|
|
9675
9771
|
|
|
9676
9772
|
// Now, release the kraken!
|
|
9677
|
-
|
|
9678
|
-
|
|
9679
|
-
|
|
9680
|
-
|
|
9773
|
+
pump_streams([resp].concat(pipeline), function(err) {
|
|
9774
|
+
if (err) debug(err)
|
|
9775
|
+
|
|
9776
|
+
// on node v8.x, if an error ocurrs on the receiving end,
|
|
9777
|
+
// then we want to abort the request to avoid having dangling sockets
|
|
9778
|
+
if (err && err.message == 'write after end') request.destroy();
|
|
9779
|
+
});
|
|
9681
9780
|
|
|
9682
9781
|
// If the user has requested and output file, pipe the output stream to it.
|
|
9683
9782
|
// In stream mode, we will still get the response stream to play with.
|
|
@@ -9718,7 +9817,6 @@ Needle.prototype.send_request = function(count, method, uri, config, post_data,
|
|
|
9718
9817
|
|
|
9719
9818
|
// Gather and count the amount of (raw) bytes using a PassThrough stream.
|
|
9720
9819
|
var clean_pipe = new stream.PassThrough();
|
|
9721
|
-
resp.pipe(clean_pipe);
|
|
9722
9820
|
|
|
9723
9821
|
clean_pipe.on('readable', function() {
|
|
9724
9822
|
var chunk;
|
|
@@ -9728,6 +9826,10 @@ Needle.prototype.send_request = function(count, method, uri, config, post_data,
|
|
|
9728
9826
|
}
|
|
9729
9827
|
})
|
|
9730
9828
|
|
|
9829
|
+
pump_streams([resp, clean_pipe], function(err) {
|
|
9830
|
+
if (err) debug(err);
|
|
9831
|
+
});
|
|
9832
|
+
|
|
9731
9833
|
// Listen on the 'readable' event to aggregate the chunks, but only if
|
|
9732
9834
|
// file output wasn't requested. Otherwise we'd have two stream readers.
|
|
9733
9835
|
if (!config.output || resp.statusCode != 200) {
|
|
@@ -9775,14 +9877,21 @@ Needle.prototype.send_request = function(count, method, uri, config, post_data,
|
|
|
9775
9877
|
// is triggered after all data has been written to it.
|
|
9776
9878
|
if (out.file) {
|
|
9777
9879
|
out.file.on('close', function() {
|
|
9778
|
-
done(null, resp
|
|
9880
|
+
done(null, resp);
|
|
9779
9881
|
})
|
|
9780
9882
|
} else { // elvis has left the building.
|
|
9781
|
-
done(null, resp
|
|
9883
|
+
done(null, resp);
|
|
9782
9884
|
}
|
|
9783
9885
|
|
|
9784
9886
|
});
|
|
9785
9887
|
|
|
9888
|
+
// out.on('error', function(err) {
|
|
9889
|
+
// had_error(err);
|
|
9890
|
+
// if (err.code == 'ERR_STREAM_DESTROYED' || err.code == 'ERR_STREAM_PREMATURE_CLOSE') {
|
|
9891
|
+
// request.abort();
|
|
9892
|
+
// }
|
|
9893
|
+
// })
|
|
9894
|
+
|
|
9786
9895
|
}); // end request call
|
|
9787
9896
|
|
|
9788
9897
|
// unless open_timeout was disabled, set a timeout to abort the request.
|
|
@@ -9806,7 +9915,10 @@ Needle.prototype.send_request = function(count, method, uri, config, post_data,
|
|
|
9806
9915
|
set_timeout('response', config.response_timeout);
|
|
9807
9916
|
}
|
|
9808
9917
|
|
|
9809
|
-
//
|
|
9918
|
+
// socket.once('close', function(e) {
|
|
9919
|
+
// console.log('socket closed!', e);
|
|
9920
|
+
// })
|
|
9921
|
+
|
|
9810
9922
|
if (!socket.on_socket_end) {
|
|
9811
9923
|
socket.on_socket_end = on_socket_end;
|
|
9812
9924
|
socket.once('end', function() { process.nextTick(on_socket_end.bind(socket)) });
|
|
@@ -9815,7 +9927,9 @@ Needle.prototype.send_request = function(count, method, uri, config, post_data,
|
|
|
9815
9927
|
|
|
9816
9928
|
if (post_data) {
|
|
9817
9929
|
if (is_stream(post_data)) {
|
|
9818
|
-
post_data
|
|
9930
|
+
pump_streams([post_data, request], function(err) {
|
|
9931
|
+
if (err) debug(err);
|
|
9932
|
+
});
|
|
9819
9933
|
} else {
|
|
9820
9934
|
request.write(post_data, config.encoding);
|
|
9821
9935
|
request.end();
|
|
@@ -9824,6 +9938,7 @@ Needle.prototype.send_request = function(count, method, uri, config, post_data,
|
|
|
9824
9938
|
request.end();
|
|
9825
9939
|
}
|
|
9826
9940
|
|
|
9941
|
+
out.abort = function() { request.abort() }; // easier access
|
|
9827
9942
|
out.request = request;
|
|
9828
9943
|
return out;
|
|
9829
9944
|
}
|
|
@@ -9840,7 +9955,7 @@ if (typeof Promise !== 'undefined') {
|
|
|
9840
9955
|
else
|
|
9841
9956
|
verb = args.shift();
|
|
9842
9957
|
|
|
9843
|
-
if (verb.match(/get|head/) && args.length == 2)
|
|
9958
|
+
if (verb.match(/get|head/i) && args.length == 2)
|
|
9844
9959
|
args.splice(1, 0, null); // assume no data if head/get with two args (url, options)
|
|
9845
9960
|
|
|
9846
9961
|
return new Promise(function(resolve, reject) {
|
|
@@ -274273,7 +274388,7 @@ module.exports = __webpack_require__(93419).YAML
|
|
|
274273
274388
|
/***/ ((module) => {
|
|
274274
274389
|
|
|
274275
274390
|
"use strict";
|
|
274276
|
-
module.exports = {"i8":"
|
|
274391
|
+
module.exports = {"i8":"3.0.0"};
|
|
274277
274392
|
|
|
274278
274393
|
/***/ }),
|
|
274279
274394
|
|