@coana-tech/cli 14.12.43 → 14.12.44
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/cli.mjs +423 -398
- package/package.json +1 -1
- package/reachability-analyzers-cli.mjs +3 -3
- package/repos/coana-tech/alucard/alucard.jar +0 -0
- package/repos/coana-tech/goana/bin/goana-darwin-amd64.gz +0 -0
- package/repos/coana-tech/goana/bin/goana-darwin-arm64.gz +0 -0
- package/repos/coana-tech/goana/bin/goana-linux-amd64.gz +0 -0
- package/repos/coana-tech/goana/bin/goana-linux-arm64.gz +0 -0
package/cli.mjs
CHANGED
|
@@ -47599,8 +47599,340 @@ var require_es_set_tostringtag = __commonJS({
|
|
|
47599
47599
|
}
|
|
47600
47600
|
});
|
|
47601
47601
|
|
|
47602
|
-
// ../../node_modules/.pnpm/form-data@4.0.
|
|
47602
|
+
// ../../node_modules/.pnpm/form-data@4.0.4/node_modules/form-data/lib/populate.js
|
|
47603
47603
|
var require_populate = __commonJS({
|
|
47604
|
+
"../../node_modules/.pnpm/form-data@4.0.4/node_modules/form-data/lib/populate.js"(exports2, module2) {
|
|
47605
|
+
"use strict";
|
|
47606
|
+
module2.exports = function(dst, src) {
|
|
47607
|
+
Object.keys(src).forEach(function(prop2) {
|
|
47608
|
+
dst[prop2] = dst[prop2] || src[prop2];
|
|
47609
|
+
});
|
|
47610
|
+
return dst;
|
|
47611
|
+
};
|
|
47612
|
+
}
|
|
47613
|
+
});
|
|
47614
|
+
|
|
47615
|
+
// ../../node_modules/.pnpm/form-data@4.0.4/node_modules/form-data/lib/form_data.js
|
|
47616
|
+
var require_form_data = __commonJS({
|
|
47617
|
+
"../../node_modules/.pnpm/form-data@4.0.4/node_modules/form-data/lib/form_data.js"(exports2, module2) {
|
|
47618
|
+
"use strict";
|
|
47619
|
+
var CombinedStream = require_combined_stream();
|
|
47620
|
+
var util5 = __require("util");
|
|
47621
|
+
var path2 = __require("path");
|
|
47622
|
+
var http2 = __require("http");
|
|
47623
|
+
var https2 = __require("https");
|
|
47624
|
+
var parseUrl = __require("url").parse;
|
|
47625
|
+
var fs = __require("fs");
|
|
47626
|
+
var Stream2 = __require("stream").Stream;
|
|
47627
|
+
var crypto7 = __require("crypto");
|
|
47628
|
+
var mime = require_mime_types();
|
|
47629
|
+
var asynckit = require_asynckit();
|
|
47630
|
+
var setToStringTag = require_es_set_tostringtag();
|
|
47631
|
+
var hasOwn2 = require_hasown();
|
|
47632
|
+
var populate = require_populate();
|
|
47633
|
+
function FormData4(options) {
|
|
47634
|
+
if (!(this instanceof FormData4)) {
|
|
47635
|
+
return new FormData4(options);
|
|
47636
|
+
}
|
|
47637
|
+
this._overheadLength = 0;
|
|
47638
|
+
this._valueLength = 0;
|
|
47639
|
+
this._valuesToMeasure = [];
|
|
47640
|
+
CombinedStream.call(this);
|
|
47641
|
+
options = options || {};
|
|
47642
|
+
for (var option in options) {
|
|
47643
|
+
this[option] = options[option];
|
|
47644
|
+
}
|
|
47645
|
+
}
|
|
47646
|
+
util5.inherits(FormData4, CombinedStream);
|
|
47647
|
+
FormData4.LINE_BREAK = "\r\n";
|
|
47648
|
+
FormData4.DEFAULT_CONTENT_TYPE = "application/octet-stream";
|
|
47649
|
+
FormData4.prototype.append = function(field, value, options) {
|
|
47650
|
+
options = options || {};
|
|
47651
|
+
if (typeof options === "string") {
|
|
47652
|
+
options = { filename: options };
|
|
47653
|
+
}
|
|
47654
|
+
var append4 = CombinedStream.prototype.append.bind(this);
|
|
47655
|
+
if (typeof value === "number" || value == null) {
|
|
47656
|
+
value = String(value);
|
|
47657
|
+
}
|
|
47658
|
+
if (Array.isArray(value)) {
|
|
47659
|
+
this._error(new Error("Arrays are not supported."));
|
|
47660
|
+
return;
|
|
47661
|
+
}
|
|
47662
|
+
var header = this._multiPartHeader(field, value, options);
|
|
47663
|
+
var footer = this._multiPartFooter();
|
|
47664
|
+
append4(header);
|
|
47665
|
+
append4(value);
|
|
47666
|
+
append4(footer);
|
|
47667
|
+
this._trackLength(header, value, options);
|
|
47668
|
+
};
|
|
47669
|
+
FormData4.prototype._trackLength = function(header, value, options) {
|
|
47670
|
+
var valueLength = 0;
|
|
47671
|
+
if (options.knownLength != null) {
|
|
47672
|
+
valueLength += Number(options.knownLength);
|
|
47673
|
+
} else if (Buffer.isBuffer(value)) {
|
|
47674
|
+
valueLength = value.length;
|
|
47675
|
+
} else if (typeof value === "string") {
|
|
47676
|
+
valueLength = Buffer.byteLength(value);
|
|
47677
|
+
}
|
|
47678
|
+
this._valueLength += valueLength;
|
|
47679
|
+
this._overheadLength += Buffer.byteLength(header) + FormData4.LINE_BREAK.length;
|
|
47680
|
+
if (!value || !value.path && !(value.readable && hasOwn2(value, "httpVersion")) && !(value instanceof Stream2)) {
|
|
47681
|
+
return;
|
|
47682
|
+
}
|
|
47683
|
+
if (!options.knownLength) {
|
|
47684
|
+
this._valuesToMeasure.push(value);
|
|
47685
|
+
}
|
|
47686
|
+
};
|
|
47687
|
+
FormData4.prototype._lengthRetriever = function(value, callback) {
|
|
47688
|
+
if (hasOwn2(value, "fd")) {
|
|
47689
|
+
if (value.end != void 0 && value.end != Infinity && value.start != void 0) {
|
|
47690
|
+
callback(null, value.end + 1 - (value.start ? value.start : 0));
|
|
47691
|
+
} else {
|
|
47692
|
+
fs.stat(value.path, function(err, stat4) {
|
|
47693
|
+
if (err) {
|
|
47694
|
+
callback(err);
|
|
47695
|
+
return;
|
|
47696
|
+
}
|
|
47697
|
+
var fileSize = stat4.size - (value.start ? value.start : 0);
|
|
47698
|
+
callback(null, fileSize);
|
|
47699
|
+
});
|
|
47700
|
+
}
|
|
47701
|
+
} else if (hasOwn2(value, "httpVersion")) {
|
|
47702
|
+
callback(null, Number(value.headers["content-length"]));
|
|
47703
|
+
} else if (hasOwn2(value, "httpModule")) {
|
|
47704
|
+
value.on("response", function(response) {
|
|
47705
|
+
value.pause();
|
|
47706
|
+
callback(null, Number(response.headers["content-length"]));
|
|
47707
|
+
});
|
|
47708
|
+
value.resume();
|
|
47709
|
+
} else {
|
|
47710
|
+
callback("Unknown stream");
|
|
47711
|
+
}
|
|
47712
|
+
};
|
|
47713
|
+
FormData4.prototype._multiPartHeader = function(field, value, options) {
|
|
47714
|
+
if (typeof options.header === "string") {
|
|
47715
|
+
return options.header;
|
|
47716
|
+
}
|
|
47717
|
+
var contentDisposition = this._getContentDisposition(value, options);
|
|
47718
|
+
var contentType = this._getContentType(value, options);
|
|
47719
|
+
var contents2 = "";
|
|
47720
|
+
var headers = {
|
|
47721
|
+
// add custom disposition as third element or keep it two elements if not
|
|
47722
|
+
"Content-Disposition": ["form-data", 'name="' + field + '"'].concat(contentDisposition || []),
|
|
47723
|
+
// if no content type. allow it to be empty array
|
|
47724
|
+
"Content-Type": [].concat(contentType || [])
|
|
47725
|
+
};
|
|
47726
|
+
if (typeof options.header === "object") {
|
|
47727
|
+
populate(headers, options.header);
|
|
47728
|
+
}
|
|
47729
|
+
var header;
|
|
47730
|
+
for (var prop2 in headers) {
|
|
47731
|
+
if (hasOwn2(headers, prop2)) {
|
|
47732
|
+
header = headers[prop2];
|
|
47733
|
+
if (header == null) {
|
|
47734
|
+
continue;
|
|
47735
|
+
}
|
|
47736
|
+
if (!Array.isArray(header)) {
|
|
47737
|
+
header = [header];
|
|
47738
|
+
}
|
|
47739
|
+
if (header.length) {
|
|
47740
|
+
contents2 += prop2 + ": " + header.join("; ") + FormData4.LINE_BREAK;
|
|
47741
|
+
}
|
|
47742
|
+
}
|
|
47743
|
+
}
|
|
47744
|
+
return "--" + this.getBoundary() + FormData4.LINE_BREAK + contents2 + FormData4.LINE_BREAK;
|
|
47745
|
+
};
|
|
47746
|
+
FormData4.prototype._getContentDisposition = function(value, options) {
|
|
47747
|
+
var filename;
|
|
47748
|
+
if (typeof options.filepath === "string") {
|
|
47749
|
+
filename = path2.normalize(options.filepath).replace(/\\/g, "/");
|
|
47750
|
+
} else if (options.filename || value && (value.name || value.path)) {
|
|
47751
|
+
filename = path2.basename(options.filename || value && (value.name || value.path));
|
|
47752
|
+
} else if (value && value.readable && hasOwn2(value, "httpVersion")) {
|
|
47753
|
+
filename = path2.basename(value.client._httpMessage.path || "");
|
|
47754
|
+
}
|
|
47755
|
+
if (filename) {
|
|
47756
|
+
return 'filename="' + filename + '"';
|
|
47757
|
+
}
|
|
47758
|
+
};
|
|
47759
|
+
FormData4.prototype._getContentType = function(value, options) {
|
|
47760
|
+
var contentType = options.contentType;
|
|
47761
|
+
if (!contentType && value && value.name) {
|
|
47762
|
+
contentType = mime.lookup(value.name);
|
|
47763
|
+
}
|
|
47764
|
+
if (!contentType && value && value.path) {
|
|
47765
|
+
contentType = mime.lookup(value.path);
|
|
47766
|
+
}
|
|
47767
|
+
if (!contentType && value && value.readable && hasOwn2(value, "httpVersion")) {
|
|
47768
|
+
contentType = value.headers["content-type"];
|
|
47769
|
+
}
|
|
47770
|
+
if (!contentType && (options.filepath || options.filename)) {
|
|
47771
|
+
contentType = mime.lookup(options.filepath || options.filename);
|
|
47772
|
+
}
|
|
47773
|
+
if (!contentType && value && typeof value === "object") {
|
|
47774
|
+
contentType = FormData4.DEFAULT_CONTENT_TYPE;
|
|
47775
|
+
}
|
|
47776
|
+
return contentType;
|
|
47777
|
+
};
|
|
47778
|
+
FormData4.prototype._multiPartFooter = function() {
|
|
47779
|
+
return function(next2) {
|
|
47780
|
+
var footer = FormData4.LINE_BREAK;
|
|
47781
|
+
var lastPart = this._streams.length === 0;
|
|
47782
|
+
if (lastPart) {
|
|
47783
|
+
footer += this._lastBoundary();
|
|
47784
|
+
}
|
|
47785
|
+
next2(footer);
|
|
47786
|
+
}.bind(this);
|
|
47787
|
+
};
|
|
47788
|
+
FormData4.prototype._lastBoundary = function() {
|
|
47789
|
+
return "--" + this.getBoundary() + "--" + FormData4.LINE_BREAK;
|
|
47790
|
+
};
|
|
47791
|
+
FormData4.prototype.getHeaders = function(userHeaders) {
|
|
47792
|
+
var header;
|
|
47793
|
+
var formHeaders = {
|
|
47794
|
+
"content-type": "multipart/form-data; boundary=" + this.getBoundary()
|
|
47795
|
+
};
|
|
47796
|
+
for (header in userHeaders) {
|
|
47797
|
+
if (hasOwn2(userHeaders, header)) {
|
|
47798
|
+
formHeaders[header.toLowerCase()] = userHeaders[header];
|
|
47799
|
+
}
|
|
47800
|
+
}
|
|
47801
|
+
return formHeaders;
|
|
47802
|
+
};
|
|
47803
|
+
FormData4.prototype.setBoundary = function(boundary) {
|
|
47804
|
+
if (typeof boundary !== "string") {
|
|
47805
|
+
throw new TypeError("FormData boundary must be a string");
|
|
47806
|
+
}
|
|
47807
|
+
this._boundary = boundary;
|
|
47808
|
+
};
|
|
47809
|
+
FormData4.prototype.getBoundary = function() {
|
|
47810
|
+
if (!this._boundary) {
|
|
47811
|
+
this._generateBoundary();
|
|
47812
|
+
}
|
|
47813
|
+
return this._boundary;
|
|
47814
|
+
};
|
|
47815
|
+
FormData4.prototype.getBuffer = function() {
|
|
47816
|
+
var dataBuffer = new Buffer.alloc(0);
|
|
47817
|
+
var boundary = this.getBoundary();
|
|
47818
|
+
for (var i7 = 0, len = this._streams.length; i7 < len; i7++) {
|
|
47819
|
+
if (typeof this._streams[i7] !== "function") {
|
|
47820
|
+
if (Buffer.isBuffer(this._streams[i7])) {
|
|
47821
|
+
dataBuffer = Buffer.concat([dataBuffer, this._streams[i7]]);
|
|
47822
|
+
} else {
|
|
47823
|
+
dataBuffer = Buffer.concat([dataBuffer, Buffer.from(this._streams[i7])]);
|
|
47824
|
+
}
|
|
47825
|
+
if (typeof this._streams[i7] !== "string" || this._streams[i7].substring(2, boundary.length + 2) !== boundary) {
|
|
47826
|
+
dataBuffer = Buffer.concat([dataBuffer, Buffer.from(FormData4.LINE_BREAK)]);
|
|
47827
|
+
}
|
|
47828
|
+
}
|
|
47829
|
+
}
|
|
47830
|
+
return Buffer.concat([dataBuffer, Buffer.from(this._lastBoundary())]);
|
|
47831
|
+
};
|
|
47832
|
+
FormData4.prototype._generateBoundary = function() {
|
|
47833
|
+
this._boundary = "--------------------------" + crypto7.randomBytes(12).toString("hex");
|
|
47834
|
+
};
|
|
47835
|
+
FormData4.prototype.getLengthSync = function() {
|
|
47836
|
+
var knownLength = this._overheadLength + this._valueLength;
|
|
47837
|
+
if (this._streams.length) {
|
|
47838
|
+
knownLength += this._lastBoundary().length;
|
|
47839
|
+
}
|
|
47840
|
+
if (!this.hasKnownLength()) {
|
|
47841
|
+
this._error(new Error("Cannot calculate proper length in synchronous way."));
|
|
47842
|
+
}
|
|
47843
|
+
return knownLength;
|
|
47844
|
+
};
|
|
47845
|
+
FormData4.prototype.hasKnownLength = function() {
|
|
47846
|
+
var hasKnownLength = true;
|
|
47847
|
+
if (this._valuesToMeasure.length) {
|
|
47848
|
+
hasKnownLength = false;
|
|
47849
|
+
}
|
|
47850
|
+
return hasKnownLength;
|
|
47851
|
+
};
|
|
47852
|
+
FormData4.prototype.getLength = function(cb) {
|
|
47853
|
+
var knownLength = this._overheadLength + this._valueLength;
|
|
47854
|
+
if (this._streams.length) {
|
|
47855
|
+
knownLength += this._lastBoundary().length;
|
|
47856
|
+
}
|
|
47857
|
+
if (!this._valuesToMeasure.length) {
|
|
47858
|
+
process.nextTick(cb.bind(this, null, knownLength));
|
|
47859
|
+
return;
|
|
47860
|
+
}
|
|
47861
|
+
asynckit.parallel(this._valuesToMeasure, this._lengthRetriever, function(err, values) {
|
|
47862
|
+
if (err) {
|
|
47863
|
+
cb(err);
|
|
47864
|
+
return;
|
|
47865
|
+
}
|
|
47866
|
+
values.forEach(function(length) {
|
|
47867
|
+
knownLength += length;
|
|
47868
|
+
});
|
|
47869
|
+
cb(null, knownLength);
|
|
47870
|
+
});
|
|
47871
|
+
};
|
|
47872
|
+
FormData4.prototype.submit = function(params, cb) {
|
|
47873
|
+
var request;
|
|
47874
|
+
var options;
|
|
47875
|
+
var defaults3 = { method: "post" };
|
|
47876
|
+
if (typeof params === "string") {
|
|
47877
|
+
params = parseUrl(params);
|
|
47878
|
+
options = populate({
|
|
47879
|
+
port: params.port,
|
|
47880
|
+
path: params.pathname,
|
|
47881
|
+
host: params.hostname,
|
|
47882
|
+
protocol: params.protocol
|
|
47883
|
+
}, defaults3);
|
|
47884
|
+
} else {
|
|
47885
|
+
options = populate(params, defaults3);
|
|
47886
|
+
if (!options.port) {
|
|
47887
|
+
options.port = options.protocol === "https:" ? 443 : 80;
|
|
47888
|
+
}
|
|
47889
|
+
}
|
|
47890
|
+
options.headers = this.getHeaders(params.headers);
|
|
47891
|
+
if (options.protocol === "https:") {
|
|
47892
|
+
request = https2.request(options);
|
|
47893
|
+
} else {
|
|
47894
|
+
request = http2.request(options);
|
|
47895
|
+
}
|
|
47896
|
+
this.getLength(function(err, length) {
|
|
47897
|
+
if (err && err !== "Unknown stream") {
|
|
47898
|
+
this._error(err);
|
|
47899
|
+
return;
|
|
47900
|
+
}
|
|
47901
|
+
if (length) {
|
|
47902
|
+
request.setHeader("Content-Length", length);
|
|
47903
|
+
}
|
|
47904
|
+
this.pipe(request);
|
|
47905
|
+
if (cb) {
|
|
47906
|
+
var onResponse;
|
|
47907
|
+
var callback = function(error, responce) {
|
|
47908
|
+
request.removeListener("error", callback);
|
|
47909
|
+
request.removeListener("response", onResponse);
|
|
47910
|
+
return cb.call(this, error, responce);
|
|
47911
|
+
};
|
|
47912
|
+
onResponse = callback.bind(this, null);
|
|
47913
|
+
request.on("error", callback);
|
|
47914
|
+
request.on("response", onResponse);
|
|
47915
|
+
}
|
|
47916
|
+
}.bind(this));
|
|
47917
|
+
return request;
|
|
47918
|
+
};
|
|
47919
|
+
FormData4.prototype._error = function(err) {
|
|
47920
|
+
if (!this.error) {
|
|
47921
|
+
this.error = err;
|
|
47922
|
+
this.pause();
|
|
47923
|
+
this.emit("error", err);
|
|
47924
|
+
}
|
|
47925
|
+
};
|
|
47926
|
+
FormData4.prototype.toString = function() {
|
|
47927
|
+
return "[object FormData]";
|
|
47928
|
+
};
|
|
47929
|
+
setToStringTag(FormData4, "FormData");
|
|
47930
|
+
module2.exports = FormData4;
|
|
47931
|
+
}
|
|
47932
|
+
});
|
|
47933
|
+
|
|
47934
|
+
// ../../node_modules/.pnpm/form-data@4.0.2/node_modules/form-data/lib/populate.js
|
|
47935
|
+
var require_populate2 = __commonJS({
|
|
47604
47936
|
"../../node_modules/.pnpm/form-data@4.0.2/node_modules/form-data/lib/populate.js"(exports2, module2) {
|
|
47605
47937
|
module2.exports = function(dst, src) {
|
|
47606
47938
|
Object.keys(src).forEach(function(prop2) {
|
|
@@ -47612,7 +47944,7 @@ var require_populate = __commonJS({
|
|
|
47612
47944
|
});
|
|
47613
47945
|
|
|
47614
47946
|
// ../../node_modules/.pnpm/form-data@4.0.2/node_modules/form-data/lib/form_data.js
|
|
47615
|
-
var
|
|
47947
|
+
var require_form_data2 = __commonJS({
|
|
47616
47948
|
"../../node_modules/.pnpm/form-data@4.0.2/node_modules/form-data/lib/form_data.js"(exports2, module2) {
|
|
47617
47949
|
var CombinedStream = require_combined_stream();
|
|
47618
47950
|
var util5 = __require("util");
|
|
@@ -47625,7 +47957,7 @@ var require_form_data = __commonJS({
|
|
|
47625
47957
|
var mime = require_mime_types();
|
|
47626
47958
|
var asynckit = require_asynckit();
|
|
47627
47959
|
var setToStringTag = require_es_set_tostringtag();
|
|
47628
|
-
var populate =
|
|
47960
|
+
var populate = require_populate2();
|
|
47629
47961
|
module2.exports = FormData4;
|
|
47630
47962
|
util5.inherits(FormData4, CombinedStream);
|
|
47631
47963
|
function FormData4(options) {
|
|
@@ -49261,338 +49593,6 @@ var require_follow_redirects = __commonJS({
|
|
|
49261
49593
|
}
|
|
49262
49594
|
});
|
|
49263
49595
|
|
|
49264
|
-
// ../../node_modules/.pnpm/form-data@4.0.4/node_modules/form-data/lib/populate.js
|
|
49265
|
-
var require_populate2 = __commonJS({
|
|
49266
|
-
"../../node_modules/.pnpm/form-data@4.0.4/node_modules/form-data/lib/populate.js"(exports2, module2) {
|
|
49267
|
-
"use strict";
|
|
49268
|
-
module2.exports = function(dst, src) {
|
|
49269
|
-
Object.keys(src).forEach(function(prop2) {
|
|
49270
|
-
dst[prop2] = dst[prop2] || src[prop2];
|
|
49271
|
-
});
|
|
49272
|
-
return dst;
|
|
49273
|
-
};
|
|
49274
|
-
}
|
|
49275
|
-
});
|
|
49276
|
-
|
|
49277
|
-
// ../../node_modules/.pnpm/form-data@4.0.4/node_modules/form-data/lib/form_data.js
|
|
49278
|
-
var require_form_data2 = __commonJS({
|
|
49279
|
-
"../../node_modules/.pnpm/form-data@4.0.4/node_modules/form-data/lib/form_data.js"(exports2, module2) {
|
|
49280
|
-
"use strict";
|
|
49281
|
-
var CombinedStream = require_combined_stream();
|
|
49282
|
-
var util5 = __require("util");
|
|
49283
|
-
var path2 = __require("path");
|
|
49284
|
-
var http2 = __require("http");
|
|
49285
|
-
var https2 = __require("https");
|
|
49286
|
-
var parseUrl = __require("url").parse;
|
|
49287
|
-
var fs = __require("fs");
|
|
49288
|
-
var Stream2 = __require("stream").Stream;
|
|
49289
|
-
var crypto7 = __require("crypto");
|
|
49290
|
-
var mime = require_mime_types();
|
|
49291
|
-
var asynckit = require_asynckit();
|
|
49292
|
-
var setToStringTag = require_es_set_tostringtag();
|
|
49293
|
-
var hasOwn2 = require_hasown();
|
|
49294
|
-
var populate = require_populate2();
|
|
49295
|
-
function FormData4(options) {
|
|
49296
|
-
if (!(this instanceof FormData4)) {
|
|
49297
|
-
return new FormData4(options);
|
|
49298
|
-
}
|
|
49299
|
-
this._overheadLength = 0;
|
|
49300
|
-
this._valueLength = 0;
|
|
49301
|
-
this._valuesToMeasure = [];
|
|
49302
|
-
CombinedStream.call(this);
|
|
49303
|
-
options = options || {};
|
|
49304
|
-
for (var option in options) {
|
|
49305
|
-
this[option] = options[option];
|
|
49306
|
-
}
|
|
49307
|
-
}
|
|
49308
|
-
util5.inherits(FormData4, CombinedStream);
|
|
49309
|
-
FormData4.LINE_BREAK = "\r\n";
|
|
49310
|
-
FormData4.DEFAULT_CONTENT_TYPE = "application/octet-stream";
|
|
49311
|
-
FormData4.prototype.append = function(field, value, options) {
|
|
49312
|
-
options = options || {};
|
|
49313
|
-
if (typeof options === "string") {
|
|
49314
|
-
options = { filename: options };
|
|
49315
|
-
}
|
|
49316
|
-
var append4 = CombinedStream.prototype.append.bind(this);
|
|
49317
|
-
if (typeof value === "number" || value == null) {
|
|
49318
|
-
value = String(value);
|
|
49319
|
-
}
|
|
49320
|
-
if (Array.isArray(value)) {
|
|
49321
|
-
this._error(new Error("Arrays are not supported."));
|
|
49322
|
-
return;
|
|
49323
|
-
}
|
|
49324
|
-
var header = this._multiPartHeader(field, value, options);
|
|
49325
|
-
var footer = this._multiPartFooter();
|
|
49326
|
-
append4(header);
|
|
49327
|
-
append4(value);
|
|
49328
|
-
append4(footer);
|
|
49329
|
-
this._trackLength(header, value, options);
|
|
49330
|
-
};
|
|
49331
|
-
FormData4.prototype._trackLength = function(header, value, options) {
|
|
49332
|
-
var valueLength = 0;
|
|
49333
|
-
if (options.knownLength != null) {
|
|
49334
|
-
valueLength += Number(options.knownLength);
|
|
49335
|
-
} else if (Buffer.isBuffer(value)) {
|
|
49336
|
-
valueLength = value.length;
|
|
49337
|
-
} else if (typeof value === "string") {
|
|
49338
|
-
valueLength = Buffer.byteLength(value);
|
|
49339
|
-
}
|
|
49340
|
-
this._valueLength += valueLength;
|
|
49341
|
-
this._overheadLength += Buffer.byteLength(header) + FormData4.LINE_BREAK.length;
|
|
49342
|
-
if (!value || !value.path && !(value.readable && hasOwn2(value, "httpVersion")) && !(value instanceof Stream2)) {
|
|
49343
|
-
return;
|
|
49344
|
-
}
|
|
49345
|
-
if (!options.knownLength) {
|
|
49346
|
-
this._valuesToMeasure.push(value);
|
|
49347
|
-
}
|
|
49348
|
-
};
|
|
49349
|
-
FormData4.prototype._lengthRetriever = function(value, callback) {
|
|
49350
|
-
if (hasOwn2(value, "fd")) {
|
|
49351
|
-
if (value.end != void 0 && value.end != Infinity && value.start != void 0) {
|
|
49352
|
-
callback(null, value.end + 1 - (value.start ? value.start : 0));
|
|
49353
|
-
} else {
|
|
49354
|
-
fs.stat(value.path, function(err, stat4) {
|
|
49355
|
-
if (err) {
|
|
49356
|
-
callback(err);
|
|
49357
|
-
return;
|
|
49358
|
-
}
|
|
49359
|
-
var fileSize = stat4.size - (value.start ? value.start : 0);
|
|
49360
|
-
callback(null, fileSize);
|
|
49361
|
-
});
|
|
49362
|
-
}
|
|
49363
|
-
} else if (hasOwn2(value, "httpVersion")) {
|
|
49364
|
-
callback(null, Number(value.headers["content-length"]));
|
|
49365
|
-
} else if (hasOwn2(value, "httpModule")) {
|
|
49366
|
-
value.on("response", function(response) {
|
|
49367
|
-
value.pause();
|
|
49368
|
-
callback(null, Number(response.headers["content-length"]));
|
|
49369
|
-
});
|
|
49370
|
-
value.resume();
|
|
49371
|
-
} else {
|
|
49372
|
-
callback("Unknown stream");
|
|
49373
|
-
}
|
|
49374
|
-
};
|
|
49375
|
-
FormData4.prototype._multiPartHeader = function(field, value, options) {
|
|
49376
|
-
if (typeof options.header === "string") {
|
|
49377
|
-
return options.header;
|
|
49378
|
-
}
|
|
49379
|
-
var contentDisposition = this._getContentDisposition(value, options);
|
|
49380
|
-
var contentType = this._getContentType(value, options);
|
|
49381
|
-
var contents2 = "";
|
|
49382
|
-
var headers = {
|
|
49383
|
-
// add custom disposition as third element or keep it two elements if not
|
|
49384
|
-
"Content-Disposition": ["form-data", 'name="' + field + '"'].concat(contentDisposition || []),
|
|
49385
|
-
// if no content type. allow it to be empty array
|
|
49386
|
-
"Content-Type": [].concat(contentType || [])
|
|
49387
|
-
};
|
|
49388
|
-
if (typeof options.header === "object") {
|
|
49389
|
-
populate(headers, options.header);
|
|
49390
|
-
}
|
|
49391
|
-
var header;
|
|
49392
|
-
for (var prop2 in headers) {
|
|
49393
|
-
if (hasOwn2(headers, prop2)) {
|
|
49394
|
-
header = headers[prop2];
|
|
49395
|
-
if (header == null) {
|
|
49396
|
-
continue;
|
|
49397
|
-
}
|
|
49398
|
-
if (!Array.isArray(header)) {
|
|
49399
|
-
header = [header];
|
|
49400
|
-
}
|
|
49401
|
-
if (header.length) {
|
|
49402
|
-
contents2 += prop2 + ": " + header.join("; ") + FormData4.LINE_BREAK;
|
|
49403
|
-
}
|
|
49404
|
-
}
|
|
49405
|
-
}
|
|
49406
|
-
return "--" + this.getBoundary() + FormData4.LINE_BREAK + contents2 + FormData4.LINE_BREAK;
|
|
49407
|
-
};
|
|
49408
|
-
FormData4.prototype._getContentDisposition = function(value, options) {
|
|
49409
|
-
var filename;
|
|
49410
|
-
if (typeof options.filepath === "string") {
|
|
49411
|
-
filename = path2.normalize(options.filepath).replace(/\\/g, "/");
|
|
49412
|
-
} else if (options.filename || value && (value.name || value.path)) {
|
|
49413
|
-
filename = path2.basename(options.filename || value && (value.name || value.path));
|
|
49414
|
-
} else if (value && value.readable && hasOwn2(value, "httpVersion")) {
|
|
49415
|
-
filename = path2.basename(value.client._httpMessage.path || "");
|
|
49416
|
-
}
|
|
49417
|
-
if (filename) {
|
|
49418
|
-
return 'filename="' + filename + '"';
|
|
49419
|
-
}
|
|
49420
|
-
};
|
|
49421
|
-
FormData4.prototype._getContentType = function(value, options) {
|
|
49422
|
-
var contentType = options.contentType;
|
|
49423
|
-
if (!contentType && value && value.name) {
|
|
49424
|
-
contentType = mime.lookup(value.name);
|
|
49425
|
-
}
|
|
49426
|
-
if (!contentType && value && value.path) {
|
|
49427
|
-
contentType = mime.lookup(value.path);
|
|
49428
|
-
}
|
|
49429
|
-
if (!contentType && value && value.readable && hasOwn2(value, "httpVersion")) {
|
|
49430
|
-
contentType = value.headers["content-type"];
|
|
49431
|
-
}
|
|
49432
|
-
if (!contentType && (options.filepath || options.filename)) {
|
|
49433
|
-
contentType = mime.lookup(options.filepath || options.filename);
|
|
49434
|
-
}
|
|
49435
|
-
if (!contentType && value && typeof value === "object") {
|
|
49436
|
-
contentType = FormData4.DEFAULT_CONTENT_TYPE;
|
|
49437
|
-
}
|
|
49438
|
-
return contentType;
|
|
49439
|
-
};
|
|
49440
|
-
FormData4.prototype._multiPartFooter = function() {
|
|
49441
|
-
return function(next2) {
|
|
49442
|
-
var footer = FormData4.LINE_BREAK;
|
|
49443
|
-
var lastPart = this._streams.length === 0;
|
|
49444
|
-
if (lastPart) {
|
|
49445
|
-
footer += this._lastBoundary();
|
|
49446
|
-
}
|
|
49447
|
-
next2(footer);
|
|
49448
|
-
}.bind(this);
|
|
49449
|
-
};
|
|
49450
|
-
FormData4.prototype._lastBoundary = function() {
|
|
49451
|
-
return "--" + this.getBoundary() + "--" + FormData4.LINE_BREAK;
|
|
49452
|
-
};
|
|
49453
|
-
FormData4.prototype.getHeaders = function(userHeaders) {
|
|
49454
|
-
var header;
|
|
49455
|
-
var formHeaders = {
|
|
49456
|
-
"content-type": "multipart/form-data; boundary=" + this.getBoundary()
|
|
49457
|
-
};
|
|
49458
|
-
for (header in userHeaders) {
|
|
49459
|
-
if (hasOwn2(userHeaders, header)) {
|
|
49460
|
-
formHeaders[header.toLowerCase()] = userHeaders[header];
|
|
49461
|
-
}
|
|
49462
|
-
}
|
|
49463
|
-
return formHeaders;
|
|
49464
|
-
};
|
|
49465
|
-
FormData4.prototype.setBoundary = function(boundary) {
|
|
49466
|
-
if (typeof boundary !== "string") {
|
|
49467
|
-
throw new TypeError("FormData boundary must be a string");
|
|
49468
|
-
}
|
|
49469
|
-
this._boundary = boundary;
|
|
49470
|
-
};
|
|
49471
|
-
FormData4.prototype.getBoundary = function() {
|
|
49472
|
-
if (!this._boundary) {
|
|
49473
|
-
this._generateBoundary();
|
|
49474
|
-
}
|
|
49475
|
-
return this._boundary;
|
|
49476
|
-
};
|
|
49477
|
-
FormData4.prototype.getBuffer = function() {
|
|
49478
|
-
var dataBuffer = new Buffer.alloc(0);
|
|
49479
|
-
var boundary = this.getBoundary();
|
|
49480
|
-
for (var i7 = 0, len = this._streams.length; i7 < len; i7++) {
|
|
49481
|
-
if (typeof this._streams[i7] !== "function") {
|
|
49482
|
-
if (Buffer.isBuffer(this._streams[i7])) {
|
|
49483
|
-
dataBuffer = Buffer.concat([dataBuffer, this._streams[i7]]);
|
|
49484
|
-
} else {
|
|
49485
|
-
dataBuffer = Buffer.concat([dataBuffer, Buffer.from(this._streams[i7])]);
|
|
49486
|
-
}
|
|
49487
|
-
if (typeof this._streams[i7] !== "string" || this._streams[i7].substring(2, boundary.length + 2) !== boundary) {
|
|
49488
|
-
dataBuffer = Buffer.concat([dataBuffer, Buffer.from(FormData4.LINE_BREAK)]);
|
|
49489
|
-
}
|
|
49490
|
-
}
|
|
49491
|
-
}
|
|
49492
|
-
return Buffer.concat([dataBuffer, Buffer.from(this._lastBoundary())]);
|
|
49493
|
-
};
|
|
49494
|
-
FormData4.prototype._generateBoundary = function() {
|
|
49495
|
-
this._boundary = "--------------------------" + crypto7.randomBytes(12).toString("hex");
|
|
49496
|
-
};
|
|
49497
|
-
FormData4.prototype.getLengthSync = function() {
|
|
49498
|
-
var knownLength = this._overheadLength + this._valueLength;
|
|
49499
|
-
if (this._streams.length) {
|
|
49500
|
-
knownLength += this._lastBoundary().length;
|
|
49501
|
-
}
|
|
49502
|
-
if (!this.hasKnownLength()) {
|
|
49503
|
-
this._error(new Error("Cannot calculate proper length in synchronous way."));
|
|
49504
|
-
}
|
|
49505
|
-
return knownLength;
|
|
49506
|
-
};
|
|
49507
|
-
FormData4.prototype.hasKnownLength = function() {
|
|
49508
|
-
var hasKnownLength = true;
|
|
49509
|
-
if (this._valuesToMeasure.length) {
|
|
49510
|
-
hasKnownLength = false;
|
|
49511
|
-
}
|
|
49512
|
-
return hasKnownLength;
|
|
49513
|
-
};
|
|
49514
|
-
FormData4.prototype.getLength = function(cb) {
|
|
49515
|
-
var knownLength = this._overheadLength + this._valueLength;
|
|
49516
|
-
if (this._streams.length) {
|
|
49517
|
-
knownLength += this._lastBoundary().length;
|
|
49518
|
-
}
|
|
49519
|
-
if (!this._valuesToMeasure.length) {
|
|
49520
|
-
process.nextTick(cb.bind(this, null, knownLength));
|
|
49521
|
-
return;
|
|
49522
|
-
}
|
|
49523
|
-
asynckit.parallel(this._valuesToMeasure, this._lengthRetriever, function(err, values) {
|
|
49524
|
-
if (err) {
|
|
49525
|
-
cb(err);
|
|
49526
|
-
return;
|
|
49527
|
-
}
|
|
49528
|
-
values.forEach(function(length) {
|
|
49529
|
-
knownLength += length;
|
|
49530
|
-
});
|
|
49531
|
-
cb(null, knownLength);
|
|
49532
|
-
});
|
|
49533
|
-
};
|
|
49534
|
-
FormData4.prototype.submit = function(params, cb) {
|
|
49535
|
-
var request;
|
|
49536
|
-
var options;
|
|
49537
|
-
var defaults3 = { method: "post" };
|
|
49538
|
-
if (typeof params === "string") {
|
|
49539
|
-
params = parseUrl(params);
|
|
49540
|
-
options = populate({
|
|
49541
|
-
port: params.port,
|
|
49542
|
-
path: params.pathname,
|
|
49543
|
-
host: params.hostname,
|
|
49544
|
-
protocol: params.protocol
|
|
49545
|
-
}, defaults3);
|
|
49546
|
-
} else {
|
|
49547
|
-
options = populate(params, defaults3);
|
|
49548
|
-
if (!options.port) {
|
|
49549
|
-
options.port = options.protocol === "https:" ? 443 : 80;
|
|
49550
|
-
}
|
|
49551
|
-
}
|
|
49552
|
-
options.headers = this.getHeaders(params.headers);
|
|
49553
|
-
if (options.protocol === "https:") {
|
|
49554
|
-
request = https2.request(options);
|
|
49555
|
-
} else {
|
|
49556
|
-
request = http2.request(options);
|
|
49557
|
-
}
|
|
49558
|
-
this.getLength(function(err, length) {
|
|
49559
|
-
if (err && err !== "Unknown stream") {
|
|
49560
|
-
this._error(err);
|
|
49561
|
-
return;
|
|
49562
|
-
}
|
|
49563
|
-
if (length) {
|
|
49564
|
-
request.setHeader("Content-Length", length);
|
|
49565
|
-
}
|
|
49566
|
-
this.pipe(request);
|
|
49567
|
-
if (cb) {
|
|
49568
|
-
var onResponse;
|
|
49569
|
-
var callback = function(error, responce) {
|
|
49570
|
-
request.removeListener("error", callback);
|
|
49571
|
-
request.removeListener("response", onResponse);
|
|
49572
|
-
return cb.call(this, error, responce);
|
|
49573
|
-
};
|
|
49574
|
-
onResponse = callback.bind(this, null);
|
|
49575
|
-
request.on("error", callback);
|
|
49576
|
-
request.on("response", onResponse);
|
|
49577
|
-
}
|
|
49578
|
-
}.bind(this));
|
|
49579
|
-
return request;
|
|
49580
|
-
};
|
|
49581
|
-
FormData4.prototype._error = function(err) {
|
|
49582
|
-
if (!this.error) {
|
|
49583
|
-
this.error = err;
|
|
49584
|
-
this.pause();
|
|
49585
|
-
this.emit("error", err);
|
|
49586
|
-
}
|
|
49587
|
-
};
|
|
49588
|
-
FormData4.prototype.toString = function() {
|
|
49589
|
-
return "[object FormData]";
|
|
49590
|
-
};
|
|
49591
|
-
setToStringTag(FormData4, "FormData");
|
|
49592
|
-
module2.exports = FormData4;
|
|
49593
|
-
}
|
|
49594
|
-
});
|
|
49595
|
-
|
|
49596
49596
|
// ../../node_modules/.pnpm/is-retry-allowed@2.2.0/node_modules/is-retry-allowed/index.js
|
|
49597
49597
|
var require_is_retry_allowed = __commonJS({
|
|
49598
49598
|
"../../node_modules/.pnpm/is-retry-allowed@2.2.0/node_modules/is-retry-allowed/index.js"(exports2, module2) {
|
|
@@ -184569,7 +184569,7 @@ var require_p_retry = __commonJS({
|
|
|
184569
184569
|
var require_axios = __commonJS({
|
|
184570
184570
|
"../../node_modules/.pnpm/axios@1.9.0/node_modules/axios/dist/node/axios.cjs"(exports2, module2) {
|
|
184571
184571
|
"use strict";
|
|
184572
|
-
var FormData$1 =
|
|
184572
|
+
var FormData$1 = require_form_data();
|
|
184573
184573
|
var crypto7 = __require("crypto");
|
|
184574
184574
|
var url2 = __require("url");
|
|
184575
184575
|
var proxyFromEnv2 = require_proxy_from_env();
|
|
@@ -195318,6 +195318,20 @@ function resolveConflicts2(ecosystem, patches, ctxt) {
|
|
|
195318
195318
|
return resolvedPatches;
|
|
195319
195319
|
}
|
|
195320
195320
|
|
|
195321
|
+
// ../utils/src/dashboard-api/socket-api.ts
|
|
195322
|
+
var import_form_data2 = __toESM(require_form_data(), 1);
|
|
195323
|
+
import { readFile as readFile8 } from "node:fs/promises";
|
|
195324
|
+
import { join as join5, relative as relative3, resolve as resolve8 } from "node:path";
|
|
195325
|
+
|
|
195326
|
+
// ../web-compat-utils/src/ghsa.ts
|
|
195327
|
+
function extractGHSAIdFromUrl(url2) {
|
|
195328
|
+
const match2 = url2.match(/(GHSA-[a-z0-9-]+)/);
|
|
195329
|
+
if (match2) {
|
|
195330
|
+
return match2[1];
|
|
195331
|
+
}
|
|
195332
|
+
return void 0;
|
|
195333
|
+
}
|
|
195334
|
+
|
|
195321
195335
|
// ../../node_modules/.pnpm/axios@1.8.2/node_modules/axios/lib/helpers/bind.js
|
|
195322
195336
|
function bind(fn2, thisArg) {
|
|
195323
195337
|
return function wrap2() {
|
|
@@ -195763,7 +195777,7 @@ AxiosError.from = (error, code, config3, request, response, customProps) => {
|
|
|
195763
195777
|
var AxiosError_default = AxiosError;
|
|
195764
195778
|
|
|
195765
195779
|
// ../../node_modules/.pnpm/axios@1.8.2/node_modules/axios/lib/platform/node/classes/FormData.js
|
|
195766
|
-
var import_form_data = __toESM(
|
|
195780
|
+
var import_form_data = __toESM(require_form_data2(), 1);
|
|
195767
195781
|
var FormData_default = import_form_data.default;
|
|
195768
195782
|
|
|
195769
195783
|
// ../../node_modules/.pnpm/axios@1.8.2/node_modules/axios/lib/helpers/toFormData.js
|
|
@@ -198616,20 +198630,6 @@ var {
|
|
|
198616
198630
|
mergeConfig: mergeConfig2
|
|
198617
198631
|
} = axios_default;
|
|
198618
198632
|
|
|
198619
|
-
// ../utils/src/dashboard-api/socket-api.ts
|
|
198620
|
-
var import_form_data2 = __toESM(require_form_data2(), 1);
|
|
198621
|
-
import { readFile as readFile8 } from "node:fs/promises";
|
|
198622
|
-
import { join as join5, relative as relative3, resolve as resolve8 } from "node:path";
|
|
198623
|
-
|
|
198624
|
-
// ../web-compat-utils/src/ghsa.ts
|
|
198625
|
-
function extractGHSAIdFromUrl(url2) {
|
|
198626
|
-
const match2 = url2.match(/(GHSA-[a-z0-9-]+)/);
|
|
198627
|
-
if (match2) {
|
|
198628
|
-
return match2[1];
|
|
198629
|
-
}
|
|
198630
|
-
return void 0;
|
|
198631
|
-
}
|
|
198632
|
-
|
|
198633
198633
|
// ../../node_modules/.pnpm/axios-retry@4.1.0_axios@1.8.2/node_modules/axios-retry/dist/esm/index.js
|
|
198634
198634
|
var import_is_retry_allowed = __toESM(require_is_retry_allowed(), 1);
|
|
198635
198635
|
var namespace = "axios-retry";
|
|
@@ -198822,7 +198822,7 @@ function prettyPrintAxiosError(error) {
|
|
|
198822
198822
|
printableHeaders = Object.fromEntries(
|
|
198823
198823
|
Object.entries(headers).map(([key, value]) => {
|
|
198824
198824
|
try {
|
|
198825
|
-
if (key === "api-key" || key === "apiKey") {
|
|
198825
|
+
if (key === "api-key" || key === "apiKey" || key === "Authorization") {
|
|
198826
198826
|
return [key, "REDACTED"];
|
|
198827
198827
|
}
|
|
198828
198828
|
if (Array.isArray(value)) {
|
|
@@ -198907,7 +198907,7 @@ async function createSocketTier1Scan(cliOptions, coanaCliVersion) {
|
|
|
198907
198907
|
};
|
|
198908
198908
|
return (await axios2.put(url2, data2, { headers: getAuthHeaders() })).data;
|
|
198909
198909
|
} catch (error) {
|
|
198910
|
-
handleError(error, "Error creating tier 1 scan",
|
|
198910
|
+
handleError(error, "Error creating tier 1 scan", true);
|
|
198911
198911
|
throw new Error("we should never reach this point");
|
|
198912
198912
|
}
|
|
198913
198913
|
}
|
|
@@ -199048,7 +199048,7 @@ async function getLatestBucketsSocket(subprojectPath, workspacePath) {
|
|
|
199048
199048
|
}
|
|
199049
199049
|
logger.debug(
|
|
199050
199050
|
"Unable to retrieve cached analysis configuration. Will continue with default configuration.",
|
|
199051
|
-
error
|
|
199051
|
+
error.message
|
|
199052
199052
|
);
|
|
199053
199053
|
return void 0;
|
|
199054
199054
|
}
|
|
@@ -199064,7 +199064,7 @@ async function useSocketComputeFixEndpoint(autofixRunId, artifacts, vulnerableAr
|
|
|
199064
199064
|
};
|
|
199065
199065
|
return (await axios2.post(url2, data2, { headers: getAuthHeaders() })).data;
|
|
199066
199066
|
} catch (error) {
|
|
199067
|
-
|
|
199067
|
+
handleError(error, "Request to compute fixes failed", false);
|
|
199068
199068
|
return {
|
|
199069
199069
|
type: "error",
|
|
199070
199070
|
message: "Error during computation"
|
|
@@ -199078,8 +199078,8 @@ async function augmentArtifactsWithVulnerabilities(components) {
|
|
|
199078
199078
|
const augmentedArtifacts = (await axios2.post(url2, data2, { headers: getAuthHeaders() })).data;
|
|
199079
199079
|
return parseSocketResponse(augmentedArtifacts);
|
|
199080
199080
|
} catch (e) {
|
|
199081
|
-
|
|
199082
|
-
throw
|
|
199081
|
+
handleError(e, "Failed to scan for vulnerabilities in socket mode", true);
|
|
199082
|
+
throw new Error("we should never reach this point");
|
|
199083
199083
|
}
|
|
199084
199084
|
}
|
|
199085
199085
|
async function fetchManifestFilesFromManifestsTarHash(manifestsTarHash) {
|
|
@@ -199087,10 +199087,8 @@ async function fetchManifestFilesFromManifestsTarHash(manifestsTarHash) {
|
|
|
199087
199087
|
const url2 = getSocketApiUrl(`orgs/${process.env.SOCKET_ORG_SLUG}/manifest-files?tarHash=${manifestsTarHash}`);
|
|
199088
199088
|
return (await axios2.get(url2, { headers: getAuthHeaders() })).data;
|
|
199089
199089
|
} catch (e) {
|
|
199090
|
-
|
|
199091
|
-
|
|
199092
|
-
}
|
|
199093
|
-
throw new Error("Failed to fetch artifacts from Socket API using manifests tar hash");
|
|
199090
|
+
handleError(e, "Failed to fetch artifacts from Socket API using manifests tar hash", true);
|
|
199091
|
+
throw new Error("we should never reach this point");
|
|
199094
199092
|
}
|
|
199095
199093
|
}
|
|
199096
199094
|
async function fetchArtifactsFromManifestsTarHash(manifestsTarHash) {
|
|
@@ -199099,10 +199097,8 @@ async function fetchArtifactsFromManifestsTarHash(manifestsTarHash) {
|
|
|
199099
199097
|
const responseData = (await axios2.post(url2, {}, { headers: getAuthHeaders() })).data;
|
|
199100
199098
|
return parseComputeArtifactsResponse(responseData);
|
|
199101
199099
|
} catch (e) {
|
|
199102
|
-
|
|
199103
|
-
|
|
199104
|
-
}
|
|
199105
|
-
throw new Error("Failed to fetch artifacts from Socket API using manifests tar hash");
|
|
199100
|
+
handleError(e, "Failed to fetch artifacts from Socket API using manifests tar hash", true);
|
|
199101
|
+
throw new Error("we should never reach this point");
|
|
199106
199102
|
}
|
|
199107
199103
|
}
|
|
199108
199104
|
async function computeSocketFactArtifacts(rootDir, manifestFiles) {
|
|
@@ -206926,8 +206922,10 @@ var getNpmBin = once(async () => {
|
|
|
206926
206922
|
});
|
|
206927
206923
|
async function actuallyRunInstall(specificPackagesArgs = [], dir) {
|
|
206928
206924
|
const installationCommand = cmdt2`${await getNpmBin()} install -f --ignore-scripts --no-fund --no-audit --no-progress ${specificPackagesArgs}`;
|
|
206929
|
-
logger.info(`
|
|
206930
|
-
|
|
206925
|
+
logger.info(`Running installation command: "${installationCommand}" in ${dir}`);
|
|
206926
|
+
const result = execAndLogOnFailure2(installationCommand, dir);
|
|
206927
|
+
logger.info(`Installation completed.`);
|
|
206928
|
+
return result;
|
|
206931
206929
|
}
|
|
206932
206930
|
async function getWorkspacePathsFromPackageJSON(projectFolder, useDotWhenNoWorkspaces = false) {
|
|
206933
206931
|
const rootPackageJson = getPackageJsonObject(projectFolder);
|
|
@@ -207072,8 +207070,10 @@ var PnpmFixingManager = class extends NpmEcosystemFixingManager {
|
|
|
207072
207070
|
}
|
|
207073
207071
|
async actuallyRunInstall(specificPackagesCmd = [], workspacePath = ".") {
|
|
207074
207072
|
const installationCommand = cmdt`pnpm install --ignore-scripts${await this.getPnpmMajorVersion() >= 9 && specificPackagesCmd.length === 0 ? "--no-frozen-lockfile" : ""} --config.confirmModulesPurge=false ${specificPackagesCmd}`;
|
|
207075
|
-
|
|
207076
|
-
|
|
207073
|
+
const installDir = resolve17(this.rootDir, this.subprojectPath, workspacePath);
|
|
207074
|
+
logger.info(`Running installation command: "${installationCommand}" in ${installDir}`);
|
|
207075
|
+
await exec(installationCommand, installDir);
|
|
207076
|
+
logger.info(`Installation completed.`);
|
|
207077
207077
|
}
|
|
207078
207078
|
async getLockFileYaml() {
|
|
207079
207079
|
const lockFile = await (0, import_lockfile_file2.readWantedLockfile)(resolve17(this.rootDir, this.subprojectPath), { ignoreIncompatible: true });
|
|
@@ -207367,8 +207367,8 @@ var YarnFixingManager = class extends NpmEcosystemFixingManager {
|
|
|
207367
207367
|
env.YARN_NODE_LINKER = "node-modules";
|
|
207368
207368
|
}
|
|
207369
207369
|
const installationCommand = cmdt`${cmdWithoutSpecificPackages} ${specificPackagesArgs}`;
|
|
207370
|
-
logger.info(`Running installation command: ${installationCommand}`);
|
|
207371
207370
|
const installDir = resolve19(this.rootDir, this.subprojectPath, workspacePath ?? ".");
|
|
207371
|
+
logger.info(`Running installation command: "${installationCommand}" in ${installDir}`);
|
|
207372
207372
|
const installResult = await this.runYarnCommand(installationCommand, installDir, { env });
|
|
207373
207373
|
if (installResult.error) {
|
|
207374
207374
|
logger.info(`Failed to install packages: ${installResult.error.message}`);
|
|
@@ -207481,7 +207481,7 @@ var YarnFixingManager = class extends NpmEcosystemFixingManager {
|
|
|
207481
207481
|
import { dirname as dirname8, join as join9, relative as relative7 } from "path";
|
|
207482
207482
|
import { existsSync as existsSync11 } from "fs";
|
|
207483
207483
|
import { readFile as readFile16, writeFile as writeFile6 } from "fs/promises";
|
|
207484
|
-
function applyUpgradesToPackageJson(packageJsonContent, upgrades, rangeStyle) {
|
|
207484
|
+
function applyUpgradesToPackageJson(filePath, packageJsonContent, upgrades, rangeStyle) {
|
|
207485
207485
|
let modifiedContent = packageJsonContent;
|
|
207486
207486
|
for (const upgrade of sortUpgradesByOffset(upgrades)) {
|
|
207487
207487
|
if (upgrade.manifestRef?.start !== void 0 && upgrade.manifestRef?.end !== void 0) {
|
|
@@ -207503,6 +207503,9 @@ function applyUpgradesToPackageJson(packageJsonContent, upgrades, rangeStyle) {
|
|
|
207503
207503
|
const specifier = specifierMatch ? specifierMatch[1] : "";
|
|
207504
207504
|
newVersionString = `"${specifier}${upgrade.upgradeVersion}"`;
|
|
207505
207505
|
}
|
|
207506
|
+
logger.info(
|
|
207507
|
+
`Upgrading ${upgrade.packageName} from ${originalVersionString} to ${newVersionString} in ${filePath}`
|
|
207508
|
+
);
|
|
207506
207509
|
modifiedContent = modifiedContent.substring(0, start) + newVersionString + modifiedContent.substring(end2);
|
|
207507
207510
|
continue;
|
|
207508
207511
|
}
|
|
@@ -207533,6 +207536,7 @@ function applyUpgradesToPackageJson(packageJsonContent, upgrades, rangeStyle) {
|
|
|
207533
207536
|
const specifier = specifierMatch ? specifierMatch[1] : "";
|
|
207534
207537
|
versionString = specifier + upgrade.upgradeVersion;
|
|
207535
207538
|
}
|
|
207539
|
+
logger.info(`Upgrading ${upgrade.packageName} from ${currentVersion} to ${versionString} in ${filePath}`);
|
|
207536
207540
|
return `${prefix}${versionString}"`;
|
|
207537
207541
|
});
|
|
207538
207542
|
}
|
|
@@ -207634,7 +207638,12 @@ var NpmSocketUpgradeManager = class {
|
|
|
207634
207638
|
};
|
|
207635
207639
|
}
|
|
207636
207640
|
);
|
|
207637
|
-
const modifiedContent = applyUpgradesToPackageJson(
|
|
207641
|
+
const modifiedContent = applyUpgradesToPackageJson(
|
|
207642
|
+
packageJsonPath,
|
|
207643
|
+
packageJsonContent,
|
|
207644
|
+
upgradesWithPackageNames,
|
|
207645
|
+
rangeStyle
|
|
207646
|
+
);
|
|
207638
207647
|
await writeFile6(packageJsonPath, modifiedContent, "utf-8");
|
|
207639
207648
|
}
|
|
207640
207649
|
await fixingManager.finalizeFixes();
|
|
@@ -212763,7 +212772,7 @@ function computeVulnChainDetails(artifacts, vulnerableArtifactId) {
|
|
|
212763
212772
|
|
|
212764
212773
|
// dist/cli-upgrade-purl.js
|
|
212765
212774
|
var ECOSYSTEMS_WITH_SOCKET_UPGRADES = ["NPM", "MAVEN", "NUGET", "GO", "RUST"];
|
|
212766
|
-
async function upgradePurl(rootDir, upgrades, options, logFile, cliFixRunId) {
|
|
212775
|
+
async function upgradePurl(rootDir, upgrades, options, logFile, cliFixRunId, prefetchedArtifacts) {
|
|
212767
212776
|
if (options.rangeStyle && options.rangeStyle !== "pin") {
|
|
212768
212777
|
throw new Error('Range style must be "pin"');
|
|
212769
212778
|
}
|
|
@@ -212798,7 +212807,7 @@ ${upgrades.map(({ purl, upgradeVersion }) => ` ${prettyPrintPurlUpgrade(purl, up
|
|
|
212798
212807
|
const purlToUpgradeVersion = new Map(supportedUpgrades.map((upgrade) => [upgrade.purl, upgrade.upgradeVersion]));
|
|
212799
212808
|
const [manifestFiles, artifacts] = await Promise.all([
|
|
212800
212809
|
fetchManifestFilesFromManifestsTarHash(options.manifestsTarHash),
|
|
212801
|
-
(await fetchArtifactsFromSocket(rootDir, options.manifestsTarHash, "upgrade-purls")).artifacts
|
|
212810
|
+
prefetchedArtifacts ?? (await fetchArtifactsFromSocket(rootDir, options.manifestsTarHash, "upgrade-purls")).artifacts
|
|
212802
212811
|
]);
|
|
212803
212812
|
const ecosystemToSocketArtifactUpgrades = /* @__PURE__ */ new Map();
|
|
212804
212813
|
artifacts.forEach((artifact, idx) => {
|
|
@@ -212950,7 +212959,7 @@ ${vulnerabilityFixes.map((fix) => ` ${fix.dependencyName} from ${fix.currentVers
|
|
|
212950
212959
|
// dist/cli-compute-fixes-and-upgrade-purls.js
|
|
212951
212960
|
async function computeFixesAndUpgradePurls(path2, options, logFile) {
|
|
212952
212961
|
const autofixRunId = options.manifestsTarHash && await getSocketAPI().registerAutofixOrUpgradePurlRun(options.manifestsTarHash, options, "autofix");
|
|
212953
|
-
const { artifacts, ghsaToVulnerableArtifactIds } = await computeInputForComputingFixes(path2, options);
|
|
212962
|
+
const { artifacts, ghsaToVulnerableArtifactIds, socketFactArtifacts } = await computeInputForComputingFixes(path2, options);
|
|
212954
212963
|
if (Object.keys(ghsaToVulnerableArtifactIds).length === 0) {
|
|
212955
212964
|
logger.info("No vulnerabilities to compute fixes for");
|
|
212956
212965
|
return { type: "no-vulnerabilities-found" };
|
|
@@ -213017,7 +213026,7 @@ async function computeFixesAndUpgradePurls(path2, options, logFile) {
|
|
|
213017
213026
|
concurrency: "1",
|
|
213018
213027
|
globPattern: options.globPattern,
|
|
213019
213028
|
rangeStyle: options.rangeStyle
|
|
213020
|
-
}, void 0, autofixRunId) ?? "fixed-all";
|
|
213029
|
+
}, void 0, autofixRunId, socketFactArtifacts) ?? "fixed-all";
|
|
213021
213030
|
if (autofixRunId) {
|
|
213022
213031
|
await getSocketAPI().finalizeAutofixRun(autofixRunId, ghsasFailedToFix.length === 0 && applyFixesStatus === "fixed-all" ? "fixed-all" : ghsasFailedToFix.length === Object.keys(ghsaToVulnerableArtifactIdsToApply).length || applyFixesStatus === "fixed-none" ? "fixed-none" : "fixed-some");
|
|
213023
213032
|
}
|
|
@@ -213034,30 +213043,29 @@ async function computeFixesAndUpgradePurls(path2, options, logFile) {
|
|
|
213034
213043
|
}
|
|
213035
213044
|
}
|
|
213036
213045
|
async function computeInputForComputingFixes(path2, options) {
|
|
213037
|
-
if (options.manifestsTarHash)
|
|
213038
|
-
|
|
213039
|
-
|
|
213040
|
-
|
|
213041
|
-
|
|
213042
|
-
|
|
213043
|
-
|
|
213044
|
-
|
|
213045
|
-
|
|
213046
|
-
|
|
213046
|
+
if (!options.manifestsTarHash)
|
|
213047
|
+
throw new Error("Manifests tar hash is required for computing fixes");
|
|
213048
|
+
const { artifacts } = await fetchArtifactsFromSocket(path2, options.manifestsTarHash, "autofix");
|
|
213049
|
+
const ghsaToVulnerableArtifactIds = {};
|
|
213050
|
+
for (const [index2, artifact] of artifacts.entries()) {
|
|
213051
|
+
if (!artifact.vulnerabilities)
|
|
213052
|
+
continue;
|
|
213053
|
+
for (const vulnerability of artifact.vulnerabilities) {
|
|
213054
|
+
if (!(ghsaToVulnerableArtifactIds[vulnerability.ghsaId] ??= []).includes(index2)) {
|
|
213055
|
+
ghsaToVulnerableArtifactIds[vulnerability.ghsaId].push(index2);
|
|
213047
213056
|
}
|
|
213048
213057
|
}
|
|
213049
|
-
const sbomTaskArtifacts = artifacts.map((artifact) => ({
|
|
213050
|
-
type: artifact.type,
|
|
213051
|
-
name: artifact.name ?? "",
|
|
213052
|
-
version: artifact.version ?? "",
|
|
213053
|
-
namespace: artifact.namespace ?? void 0,
|
|
213054
|
-
adj: artifact.dependencies?.map((dep) => artifacts.findIndex((a4) => a4.id === dep)) ?? [],
|
|
213055
|
-
direct: artifact.direct,
|
|
213056
|
-
topLevelAncestors: artifact.toplevelAncestors?.map((ancestor) => artifacts.findIndex((a4) => a4.id === ancestor)) ?? []
|
|
213057
|
-
}));
|
|
213058
|
-
return { artifacts: sbomTaskArtifacts, ghsaToVulnerableArtifactIds };
|
|
213059
213058
|
}
|
|
213060
|
-
|
|
213059
|
+
const sbomTaskArtifacts = artifacts.map((artifact) => ({
|
|
213060
|
+
type: artifact.type,
|
|
213061
|
+
name: artifact.name ?? "",
|
|
213062
|
+
version: artifact.version ?? "",
|
|
213063
|
+
namespace: artifact.namespace ?? void 0,
|
|
213064
|
+
adj: artifact.dependencies?.map((dep) => artifacts.findIndex((a4) => a4.id === dep)) ?? [],
|
|
213065
|
+
direct: artifact.direct,
|
|
213066
|
+
topLevelAncestors: artifact.toplevelAncestors?.map((ancestor) => artifacts.findIndex((a4) => a4.id === ancestor)) ?? []
|
|
213067
|
+
}));
|
|
213068
|
+
return { artifacts: sbomTaskArtifacts, ghsaToVulnerableArtifactIds, socketFactArtifacts: artifacts };
|
|
213061
213069
|
}
|
|
213062
213070
|
async function computeDirectDependencyUpgrades(artifacts, fixesFound) {
|
|
213063
213071
|
const purlToArtifact = Object.fromEntries(artifacts.map((a4) => [simplePurl(a4.type, a4.namespace ?? null, a4.name ?? "", a4.version ?? null), a4]));
|
|
@@ -228701,7 +228709,7 @@ async function onlineScan(dependencyTree, apiKey, timeout) {
|
|
|
228701
228709
|
}
|
|
228702
228710
|
|
|
228703
228711
|
// dist/version.js
|
|
228704
|
-
var version2 = "14.12.
|
|
228712
|
+
var version2 = "14.12.44";
|
|
228705
228713
|
|
|
228706
228714
|
// dist/cli-core.js
|
|
228707
228715
|
var { mapValues, omit, partition, pick } = import_lodash15.default;
|
|
@@ -229452,6 +229460,7 @@ computeFixesAndUpgradePurlsCmd.name("compute-fixes-and-upgrade-purls").argument(
|
|
|
229452
229460
|
await withTmpDirectory("compute-fixes-and-upgrade-purls", async (tmpDir) => {
|
|
229453
229461
|
const logFile = join28(tmpDir, "compute-fixes-and-upgrade-purls.log");
|
|
229454
229462
|
logger.initWinstonLogger(options.debug, logFile);
|
|
229463
|
+
await initializeComputeFixesAndUpgradePurls(path2, options);
|
|
229455
229464
|
const optionsToUse = {
|
|
229456
229465
|
...y8(options, ["minimumReleaseAge"]),
|
|
229457
229466
|
minimumReleaseAgeInMinutes: options.minimumReleaseAge ? parseMinimumReleaseAgeToMinutes(options.minimumReleaseAge) : void 0
|
|
@@ -229465,6 +229474,22 @@ computeFixesAndUpgradePurlsCmd.name("compute-fixes-and-upgrade-purls").argument(
|
|
|
229465
229474
|
}
|
|
229466
229475
|
});
|
|
229467
229476
|
}).configureHelp({ sortOptions: true });
|
|
229477
|
+
async function initializeComputeFixesAndUpgradePurls(path2, options) {
|
|
229478
|
+
logger.info(`Coana CLI version ${version2} compute fixes and upgrade purls initiated on ${path2}`);
|
|
229479
|
+
logger.debug("running in debug mode");
|
|
229480
|
+
logger.debug("using options", JSON.stringify(a3(Object.fromEntries(Object.entries(options).filter(([_, value]) => value)), [
|
|
229481
|
+
"debug",
|
|
229482
|
+
"silent",
|
|
229483
|
+
"applyFixesTo",
|
|
229484
|
+
"dryRun",
|
|
229485
|
+
"globPattern",
|
|
229486
|
+
"manifestsTarHash",
|
|
229487
|
+
"rangeStyle",
|
|
229488
|
+
"disableMajorUpdates",
|
|
229489
|
+
"outputFile",
|
|
229490
|
+
"minimumReleaseAge"
|
|
229491
|
+
]), null, 2));
|
|
229492
|
+
}
|
|
229468
229493
|
var compareReportsCommand = new Command();
|
|
229469
229494
|
compareReportsCommand.name("compare-reports").argument("<baselineReportPath>", "Path to the baseline report").argument("<newReportPath>", "Path to the new report").option("--api-key <key>", "Set the Coana dashboard API key.").option("-d, --debug", "Enable debug logging", false).option("--no-pr-comment", "Disable pull request comments (only relevant when run from a PR)", true).option("--no-block", "Do not fail with a non-zero exit code when new reachable vulnerabilities are detected", true).option("--ignore-undeterminable-reachability", "Ignore vulnerabilities with undeterminable reachability", false).action(async (baselineReportPath, newReportPath, options) => {
|
|
229470
229495
|
async function readReport(reportPath) {
|
package/package.json
CHANGED
|
@@ -72819,7 +72819,7 @@ function prettyPrintAxiosError(error) {
|
|
|
72819
72819
|
printableHeaders = Object.fromEntries(
|
|
72820
72820
|
Object.entries(headers).map(([key, value]) => {
|
|
72821
72821
|
try {
|
|
72822
|
-
if (key === "api-key" || key === "apiKey") {
|
|
72822
|
+
if (key === "api-key" || key === "apiKey" || key === "Authorization") {
|
|
72823
72823
|
return [key, "REDACTED"];
|
|
72824
72824
|
}
|
|
72825
72825
|
if (Array.isArray(value)) {
|
|
@@ -73375,7 +73375,7 @@ async function createSocketTier1Scan(cliOptions, coanaCliVersion) {
|
|
|
73375
73375
|
};
|
|
73376
73376
|
return (await axios2.put(url2, data2, { headers: getAuthHeaders() })).data;
|
|
73377
73377
|
} catch (error) {
|
|
73378
|
-
handleError(error, "Error creating tier 1 scan",
|
|
73378
|
+
handleError(error, "Error creating tier 1 scan", true);
|
|
73379
73379
|
throw new Error("we should never reach this point");
|
|
73380
73380
|
}
|
|
73381
73381
|
}
|
|
@@ -73516,7 +73516,7 @@ async function getLatestBucketsSocket(subprojectPath, workspacePath) {
|
|
|
73516
73516
|
}
|
|
73517
73517
|
logger.debug(
|
|
73518
73518
|
"Unable to retrieve cached analysis configuration. Will continue with default configuration.",
|
|
73519
|
-
error
|
|
73519
|
+
error.message
|
|
73520
73520
|
);
|
|
73521
73521
|
return void 0;
|
|
73522
73522
|
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|