@zhuixin/engine 0.2.1 → 0.2.2
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/engine-main.js +554 -320
- package/package.json +3 -3
package/dist/engine-main.js
CHANGED
|
@@ -363,25 +363,25 @@ var require_utils = __commonJS({
|
|
|
363
363
|
}
|
|
364
364
|
mkdirSync(folder);
|
|
365
365
|
};
|
|
366
|
-
Utils.prototype.writeFileTo = function(
|
|
366
|
+
Utils.prototype.writeFileTo = function(path9, content, overwrite, attr) {
|
|
367
367
|
const self = this;
|
|
368
|
-
if (self.fs.existsSync(
|
|
368
|
+
if (self.fs.existsSync(path9)) {
|
|
369
369
|
if (!overwrite) return false;
|
|
370
|
-
var stat = self.fs.statSync(
|
|
370
|
+
var stat = self.fs.statSync(path9);
|
|
371
371
|
if (stat.isDirectory()) {
|
|
372
372
|
return false;
|
|
373
373
|
}
|
|
374
374
|
}
|
|
375
|
-
var folder = pth.dirname(
|
|
375
|
+
var folder = pth.dirname(path9);
|
|
376
376
|
if (!self.fs.existsSync(folder)) {
|
|
377
377
|
self.makeDir(folder);
|
|
378
378
|
}
|
|
379
379
|
var fd;
|
|
380
380
|
try {
|
|
381
|
-
fd = self.fs.openSync(
|
|
381
|
+
fd = self.fs.openSync(path9, "w", 438);
|
|
382
382
|
} catch (e) {
|
|
383
|
-
self.fs.chmodSync(
|
|
384
|
-
fd = self.fs.openSync(
|
|
383
|
+
self.fs.chmodSync(path9, 438);
|
|
384
|
+
fd = self.fs.openSync(path9, "w", 438);
|
|
385
385
|
}
|
|
386
386
|
if (fd) {
|
|
387
387
|
try {
|
|
@@ -390,31 +390,31 @@ var require_utils = __commonJS({
|
|
|
390
390
|
self.fs.closeSync(fd);
|
|
391
391
|
}
|
|
392
392
|
}
|
|
393
|
-
self.fs.chmodSync(
|
|
393
|
+
self.fs.chmodSync(path9, attr || 438);
|
|
394
394
|
return true;
|
|
395
395
|
};
|
|
396
|
-
Utils.prototype.writeFileToAsync = function(
|
|
396
|
+
Utils.prototype.writeFileToAsync = function(path9, content, overwrite, attr, callback) {
|
|
397
397
|
if (typeof attr === "function") {
|
|
398
398
|
callback = attr;
|
|
399
399
|
attr = void 0;
|
|
400
400
|
}
|
|
401
401
|
const self = this;
|
|
402
|
-
self.fs.exists(
|
|
402
|
+
self.fs.exists(path9, function(exist) {
|
|
403
403
|
if (exist && !overwrite) return callback(false);
|
|
404
|
-
self.fs.stat(
|
|
404
|
+
self.fs.stat(path9, function(err, stat) {
|
|
405
405
|
if (exist && stat.isDirectory()) {
|
|
406
406
|
return callback(false);
|
|
407
407
|
}
|
|
408
|
-
var folder = pth.dirname(
|
|
408
|
+
var folder = pth.dirname(path9);
|
|
409
409
|
self.fs.exists(folder, function(exists) {
|
|
410
410
|
if (!exists) self.makeDir(folder);
|
|
411
|
-
self.fs.open(
|
|
411
|
+
self.fs.open(path9, "w", 438, function(err2, fd) {
|
|
412
412
|
if (err2) {
|
|
413
|
-
self.fs.chmod(
|
|
414
|
-
self.fs.open(
|
|
413
|
+
self.fs.chmod(path9, 438, function() {
|
|
414
|
+
self.fs.open(path9, "w", 438, function(err3, fd2) {
|
|
415
415
|
self.fs.write(fd2, content, 0, content.length, 0, function() {
|
|
416
416
|
self.fs.close(fd2, function() {
|
|
417
|
-
self.fs.chmod(
|
|
417
|
+
self.fs.chmod(path9, attr || 438, function() {
|
|
418
418
|
callback(true);
|
|
419
419
|
});
|
|
420
420
|
});
|
|
@@ -424,13 +424,13 @@ var require_utils = __commonJS({
|
|
|
424
424
|
} else if (fd) {
|
|
425
425
|
self.fs.write(fd, content, 0, content.length, 0, function() {
|
|
426
426
|
self.fs.close(fd, function() {
|
|
427
|
-
self.fs.chmod(
|
|
427
|
+
self.fs.chmod(path9, attr || 438, function() {
|
|
428
428
|
callback(true);
|
|
429
429
|
});
|
|
430
430
|
});
|
|
431
431
|
});
|
|
432
432
|
} else {
|
|
433
|
-
self.fs.chmod(
|
|
433
|
+
self.fs.chmod(path9, attr || 438, function() {
|
|
434
434
|
callback(true);
|
|
435
435
|
});
|
|
436
436
|
}
|
|
@@ -439,7 +439,7 @@ var require_utils = __commonJS({
|
|
|
439
439
|
});
|
|
440
440
|
});
|
|
441
441
|
};
|
|
442
|
-
Utils.prototype.findFiles = function(
|
|
442
|
+
Utils.prototype.findFiles = function(path9) {
|
|
443
443
|
const self = this;
|
|
444
444
|
function findSync(dir, pattern, recursive) {
|
|
445
445
|
if (typeof pattern === "boolean") {
|
|
@@ -448,16 +448,16 @@ var require_utils = __commonJS({
|
|
|
448
448
|
}
|
|
449
449
|
let files = [];
|
|
450
450
|
self.fs.readdirSync(dir).forEach(function(file) {
|
|
451
|
-
const
|
|
452
|
-
const stat = self.fs.statSync(
|
|
453
|
-
if (!pattern || pattern.test(
|
|
454
|
-
files.push(pth.normalize(
|
|
451
|
+
const path10 = pth.join(dir, file);
|
|
452
|
+
const stat = self.fs.statSync(path10);
|
|
453
|
+
if (!pattern || pattern.test(path10)) {
|
|
454
|
+
files.push(pth.normalize(path10) + (stat.isDirectory() ? self.sep : ""));
|
|
455
455
|
}
|
|
456
|
-
if (stat.isDirectory() && recursive) files = files.concat(findSync(
|
|
456
|
+
if (stat.isDirectory() && recursive) files = files.concat(findSync(path10, pattern, recursive));
|
|
457
457
|
});
|
|
458
458
|
return files;
|
|
459
459
|
}
|
|
460
|
-
return findSync(
|
|
460
|
+
return findSync(path9, void 0, true);
|
|
461
461
|
};
|
|
462
462
|
Utils.prototype.findFilesAsync = function(dir, cb) {
|
|
463
463
|
const self = this;
|
|
@@ -512,14 +512,14 @@ var require_utils = __commonJS({
|
|
|
512
512
|
return "UNSUPPORTED (" + method + ")";
|
|
513
513
|
}
|
|
514
514
|
};
|
|
515
|
-
Utils.canonical = function(
|
|
516
|
-
if (!
|
|
517
|
-
const safeSuffix = pth.posix.normalize("/" +
|
|
515
|
+
Utils.canonical = function(path9) {
|
|
516
|
+
if (!path9) return "";
|
|
517
|
+
const safeSuffix = pth.posix.normalize("/" + path9.split("\\").join("/"));
|
|
518
518
|
return pth.join(".", safeSuffix);
|
|
519
519
|
};
|
|
520
|
-
Utils.zipnamefix = function(
|
|
521
|
-
if (!
|
|
522
|
-
const safeSuffix = pth.posix.normalize("/" +
|
|
520
|
+
Utils.zipnamefix = function(path9) {
|
|
521
|
+
if (!path9) return "";
|
|
522
|
+
const safeSuffix = pth.posix.normalize("/" + path9.split("\\").join("/"));
|
|
523
523
|
return pth.posix.join(".", safeSuffix);
|
|
524
524
|
};
|
|
525
525
|
Utils.findLast = function(arr, callback) {
|
|
@@ -536,9 +536,9 @@ var require_utils = __commonJS({
|
|
|
536
536
|
prefix = pth.resolve(pth.normalize(prefix));
|
|
537
537
|
var parts = name.split("/");
|
|
538
538
|
for (var i = 0, l = parts.length; i < l; i++) {
|
|
539
|
-
var
|
|
540
|
-
if (
|
|
541
|
-
return
|
|
539
|
+
var path9 = pth.normalize(pth.join(prefix, parts.slice(i, l).join(pth.sep)));
|
|
540
|
+
if (path9 === prefix || path9.startsWith(prefix + pth.sep)) {
|
|
541
|
+
return path9;
|
|
542
542
|
}
|
|
543
543
|
}
|
|
544
544
|
return pth.normalize(pth.join(prefix, pth.basename(name)));
|
|
@@ -585,8 +585,8 @@ var require_fattr = __commonJS({
|
|
|
585
585
|
"node_modules/.pnpm/adm-zip@0.5.18/node_modules/adm-zip/util/fattr.js"(exports2, module2) {
|
|
586
586
|
"use strict";
|
|
587
587
|
var pth = require("path");
|
|
588
|
-
module2.exports = function(
|
|
589
|
-
var _path =
|
|
588
|
+
module2.exports = function(path9, { fs: fs10 }) {
|
|
589
|
+
var _path = path9 || "", _obj = newAttr(), _stat = null;
|
|
590
590
|
function newAttr() {
|
|
591
591
|
return {
|
|
592
592
|
directory: false,
|
|
@@ -597,8 +597,8 @@ var require_fattr = __commonJS({
|
|
|
597
597
|
atime: 0
|
|
598
598
|
};
|
|
599
599
|
}
|
|
600
|
-
if (_path &&
|
|
601
|
-
_stat =
|
|
600
|
+
if (_path && fs10.existsSync(_path)) {
|
|
601
|
+
_stat = fs10.statSync(_path);
|
|
602
602
|
_obj.directory = _stat.isDirectory();
|
|
603
603
|
_obj.mtime = _stat.mtime;
|
|
604
604
|
_obj.atime = _stat.atime;
|
|
@@ -5406,23 +5406,23 @@ var require_dom = __commonJS({
|
|
|
5406
5406
|
substringData: function(offset, count) {
|
|
5407
5407
|
return this.data.substring(offset, offset + count);
|
|
5408
5408
|
},
|
|
5409
|
-
appendData: function(
|
|
5410
|
-
|
|
5411
|
-
this.nodeValue = this.data =
|
|
5412
|
-
this.length =
|
|
5409
|
+
appendData: function(text2) {
|
|
5410
|
+
text2 = this.data + text2;
|
|
5411
|
+
this.nodeValue = this.data = text2;
|
|
5412
|
+
this.length = text2.length;
|
|
5413
5413
|
},
|
|
5414
|
-
insertData: function(offset,
|
|
5415
|
-
this.replaceData(offset, 0,
|
|
5414
|
+
insertData: function(offset, text2) {
|
|
5415
|
+
this.replaceData(offset, 0, text2);
|
|
5416
5416
|
},
|
|
5417
5417
|
deleteData: function(offset, count) {
|
|
5418
5418
|
this.replaceData(offset, count, "");
|
|
5419
5419
|
},
|
|
5420
|
-
replaceData: function(offset, count,
|
|
5420
|
+
replaceData: function(offset, count, text2) {
|
|
5421
5421
|
var start = this.data.substring(0, offset);
|
|
5422
5422
|
var end = this.data.substring(offset + count);
|
|
5423
|
-
|
|
5424
|
-
this.nodeValue = this.data =
|
|
5425
|
-
this.length =
|
|
5423
|
+
text2 = start + text2 + end;
|
|
5424
|
+
this.nodeValue = this.data = text2;
|
|
5425
|
+
this.length = text2.length;
|
|
5426
5426
|
}
|
|
5427
5427
|
};
|
|
5428
5428
|
_extends(CharacterData, Node);
|
|
@@ -5433,11 +5433,11 @@ var require_dom = __commonJS({
|
|
|
5433
5433
|
nodeName: "#text",
|
|
5434
5434
|
nodeType: TEXT_NODE,
|
|
5435
5435
|
splitText: function(offset) {
|
|
5436
|
-
var
|
|
5437
|
-
var newText =
|
|
5438
|
-
|
|
5439
|
-
this.data = this.nodeValue =
|
|
5440
|
-
this.length =
|
|
5436
|
+
var text2 = this.data;
|
|
5437
|
+
var newText = text2.substring(offset);
|
|
5438
|
+
text2 = text2.substring(0, offset);
|
|
5439
|
+
this.data = this.nodeValue = text2;
|
|
5440
|
+
this.length = text2.length;
|
|
5441
5441
|
var newNode = this.ownerDocument.createTextNode(newText);
|
|
5442
5442
|
if (this.parentNode) {
|
|
5443
5443
|
this.parentNode.insertBefore(newNode, this.nextSibling);
|
|
@@ -8232,12 +8232,12 @@ var require_sax = __commonJS({
|
|
|
8232
8232
|
}
|
|
8233
8233
|
if (!source.substring(start).match(/^\s*$/)) {
|
|
8234
8234
|
var doc = domBuilder.doc;
|
|
8235
|
-
var
|
|
8235
|
+
var text2 = doc.createTextNode(source.substring(start));
|
|
8236
8236
|
if (doc.documentElement) {
|
|
8237
8237
|
return errorHandler.error("Extra content at the end of the document");
|
|
8238
8238
|
}
|
|
8239
|
-
doc.appendChild(
|
|
8240
|
-
domBuilder.currentElement =
|
|
8239
|
+
doc.appendChild(text2);
|
|
8240
|
+
domBuilder.currentElement = text2;
|
|
8241
8241
|
}
|
|
8242
8242
|
return;
|
|
8243
8243
|
}
|
|
@@ -8622,11 +8622,11 @@ var require_sax = __commonJS({
|
|
|
8622
8622
|
if (elEndStart < 0) {
|
|
8623
8623
|
return elStartEnd + 1;
|
|
8624
8624
|
}
|
|
8625
|
-
var
|
|
8625
|
+
var text2 = source.substring(elStartEnd + 1, elEndStart);
|
|
8626
8626
|
if (isEscapableRaw) {
|
|
8627
|
-
|
|
8627
|
+
text2 = text2.replace(ENTITY_REG, entityReplacer);
|
|
8628
8628
|
}
|
|
8629
|
-
domBuilder.characters(
|
|
8629
|
+
domBuilder.characters(text2, 0, text2.length);
|
|
8630
8630
|
return elEndStart;
|
|
8631
8631
|
}
|
|
8632
8632
|
return elStartEnd + 1;
|
|
@@ -8663,11 +8663,11 @@ var require_sax = __commonJS({
|
|
|
8663
8663
|
function substringFromIndex() {
|
|
8664
8664
|
return source.substring(index);
|
|
8665
8665
|
}
|
|
8666
|
-
function substringStartsWith(
|
|
8667
|
-
return source.substring(index, index +
|
|
8666
|
+
function substringStartsWith(text2) {
|
|
8667
|
+
return source.substring(index, index + text2.length) === text2;
|
|
8668
8668
|
}
|
|
8669
|
-
function substringStartsWithCaseInsensitive(
|
|
8670
|
-
return source.substring(index, index +
|
|
8669
|
+
function substringStartsWithCaseInsensitive(text2) {
|
|
8670
|
+
return source.substring(index, index + text2.length).toUpperCase() === text2.toUpperCase();
|
|
8671
8671
|
}
|
|
8672
8672
|
function getMatch(args) {
|
|
8673
8673
|
var expr = g.reg("^", args);
|
|
@@ -9255,9 +9255,9 @@ var require_parse = __commonJS({
|
|
|
9255
9255
|
doc.documentElement.nodeName === "plist",
|
|
9256
9256
|
"malformed document. First element should be <plist>"
|
|
9257
9257
|
);
|
|
9258
|
-
var
|
|
9259
|
-
if (
|
|
9260
|
-
return
|
|
9258
|
+
var plist3 = parsePlistXML(doc.documentElement);
|
|
9259
|
+
if (plist3.length == 1) plist3 = plist3[0];
|
|
9260
|
+
return plist3;
|
|
9261
9261
|
}
|
|
9262
9262
|
function parsePlistXML(node) {
|
|
9263
9263
|
var i, new_obj, key, val, new_arr, res, counter, type;
|
|
@@ -10288,14 +10288,14 @@ var require_XMLCData = __commonJS({
|
|
|
10288
10288
|
module2.exports = XMLCData = class XMLCData extends XMLCharacterData {
|
|
10289
10289
|
// Initializes a new instance of `XMLCData`
|
|
10290
10290
|
// `text` CDATA text
|
|
10291
|
-
constructor(parent,
|
|
10291
|
+
constructor(parent, text2) {
|
|
10292
10292
|
super(parent);
|
|
10293
|
-
if (
|
|
10293
|
+
if (text2 == null) {
|
|
10294
10294
|
throw new Error("Missing CDATA text. " + this.debugInfo());
|
|
10295
10295
|
}
|
|
10296
10296
|
this.name = "#cdata-section";
|
|
10297
10297
|
this.type = NodeType.CData;
|
|
10298
|
-
this.value = this.stringify.cdata(
|
|
10298
|
+
this.value = this.stringify.cdata(text2);
|
|
10299
10299
|
}
|
|
10300
10300
|
// Creates and returns a deep clone of `this`
|
|
10301
10301
|
clone() {
|
|
@@ -10325,14 +10325,14 @@ var require_XMLComment = __commonJS({
|
|
|
10325
10325
|
module2.exports = XMLComment = class XMLComment extends XMLCharacterData {
|
|
10326
10326
|
// Initializes a new instance of `XMLComment`
|
|
10327
10327
|
// `text` comment text
|
|
10328
|
-
constructor(parent,
|
|
10328
|
+
constructor(parent, text2) {
|
|
10329
10329
|
super(parent);
|
|
10330
|
-
if (
|
|
10330
|
+
if (text2 == null) {
|
|
10331
10331
|
throw new Error("Missing comment text. " + this.debugInfo());
|
|
10332
10332
|
}
|
|
10333
10333
|
this.name = "#comment";
|
|
10334
10334
|
this.type = NodeType.Comment;
|
|
10335
|
-
this.value = this.stringify.comment(
|
|
10335
|
+
this.value = this.stringify.comment(text2);
|
|
10336
10336
|
}
|
|
10337
10337
|
// Creates and returns a deep clone of `this`
|
|
10338
10338
|
clone() {
|
|
@@ -10870,13 +10870,13 @@ var require_XMLRaw = __commonJS({
|
|
|
10870
10870
|
module2.exports = XMLRaw = class XMLRaw extends XMLNode {
|
|
10871
10871
|
// Initializes a new instance of `XMLRaw`
|
|
10872
10872
|
// `text` raw text
|
|
10873
|
-
constructor(parent,
|
|
10873
|
+
constructor(parent, text2) {
|
|
10874
10874
|
super(parent);
|
|
10875
|
-
if (
|
|
10875
|
+
if (text2 == null) {
|
|
10876
10876
|
throw new Error("Missing raw text. " + this.debugInfo());
|
|
10877
10877
|
}
|
|
10878
10878
|
this.type = NodeType.Raw;
|
|
10879
|
-
this.value = this.stringify.raw(
|
|
10879
|
+
this.value = this.stringify.raw(text2);
|
|
10880
10880
|
}
|
|
10881
10881
|
// Creates and returns a deep clone of `this`
|
|
10882
10882
|
clone() {
|
|
@@ -10907,14 +10907,14 @@ var require_XMLText = __commonJS({
|
|
|
10907
10907
|
class XMLText2 extends XMLCharacterData {
|
|
10908
10908
|
// Initializes a new instance of `XMLText`
|
|
10909
10909
|
// `text` element text
|
|
10910
|
-
constructor(parent,
|
|
10910
|
+
constructor(parent, text2) {
|
|
10911
10911
|
super(parent);
|
|
10912
|
-
if (
|
|
10912
|
+
if (text2 == null) {
|
|
10913
10913
|
throw new Error("Missing element text. " + this.debugInfo());
|
|
10914
10914
|
}
|
|
10915
10915
|
this.name = "#text";
|
|
10916
10916
|
this.type = NodeType.Text;
|
|
10917
|
-
this.value = this.stringify.text(
|
|
10917
|
+
this.value = this.stringify.text(text2);
|
|
10918
10918
|
}
|
|
10919
10919
|
// Creates and returns a deep clone of `this`
|
|
10920
10920
|
clone() {
|
|
@@ -11176,18 +11176,18 @@ var require_XMLNode = __commonJS({
|
|
|
11176
11176
|
// `name` node name or an object describing the XML tree
|
|
11177
11177
|
// `attributes` an object containing name/value pairs of attributes
|
|
11178
11178
|
// `text` element text
|
|
11179
|
-
element(name, attributes,
|
|
11179
|
+
element(name, attributes, text2) {
|
|
11180
11180
|
var childNode, item, j, k, key, lastChild, len, len1, val;
|
|
11181
11181
|
lastChild = null;
|
|
11182
|
-
if (attributes === null &&
|
|
11183
|
-
[attributes,
|
|
11182
|
+
if (attributes === null && text2 == null) {
|
|
11183
|
+
[attributes, text2] = [{}, null];
|
|
11184
11184
|
}
|
|
11185
11185
|
if (attributes == null) {
|
|
11186
11186
|
attributes = {};
|
|
11187
11187
|
}
|
|
11188
11188
|
attributes = getValue(attributes);
|
|
11189
11189
|
if (!isObject(attributes)) {
|
|
11190
|
-
[
|
|
11190
|
+
[text2, attributes] = [attributes, text2];
|
|
11191
11191
|
}
|
|
11192
11192
|
if (name != null) {
|
|
11193
11193
|
name = getValue(name);
|
|
@@ -11232,21 +11232,21 @@ var require_XMLNode = __commonJS({
|
|
|
11232
11232
|
lastChild = this.element(key, val);
|
|
11233
11233
|
}
|
|
11234
11234
|
}
|
|
11235
|
-
} else if (!this.options.keepNullNodes &&
|
|
11235
|
+
} else if (!this.options.keepNullNodes && text2 === null) {
|
|
11236
11236
|
lastChild = this.dummy();
|
|
11237
11237
|
} else {
|
|
11238
11238
|
if (!this.options.ignoreDecorators && this.stringify.convertTextKey && name.indexOf(this.stringify.convertTextKey) === 0) {
|
|
11239
|
-
lastChild = this.text(
|
|
11239
|
+
lastChild = this.text(text2);
|
|
11240
11240
|
} else if (!this.options.ignoreDecorators && this.stringify.convertCDataKey && name.indexOf(this.stringify.convertCDataKey) === 0) {
|
|
11241
|
-
lastChild = this.cdata(
|
|
11241
|
+
lastChild = this.cdata(text2);
|
|
11242
11242
|
} else if (!this.options.ignoreDecorators && this.stringify.convertCommentKey && name.indexOf(this.stringify.convertCommentKey) === 0) {
|
|
11243
|
-
lastChild = this.comment(
|
|
11243
|
+
lastChild = this.comment(text2);
|
|
11244
11244
|
} else if (!this.options.ignoreDecorators && this.stringify.convertRawKey && name.indexOf(this.stringify.convertRawKey) === 0) {
|
|
11245
|
-
lastChild = this.raw(
|
|
11245
|
+
lastChild = this.raw(text2);
|
|
11246
11246
|
} else if (!this.options.ignoreDecorators && this.stringify.convertPIKey && name.indexOf(this.stringify.convertPIKey) === 0) {
|
|
11247
|
-
lastChild = this.instruction(name.substr(this.stringify.convertPIKey.length),
|
|
11247
|
+
lastChild = this.instruction(name.substr(this.stringify.convertPIKey.length), text2);
|
|
11248
11248
|
} else {
|
|
11249
|
-
lastChild = this.node(name, attributes,
|
|
11249
|
+
lastChild = this.node(name, attributes, text2);
|
|
11250
11250
|
}
|
|
11251
11251
|
}
|
|
11252
11252
|
if (lastChild == null) {
|
|
@@ -11258,7 +11258,7 @@ var require_XMLNode = __commonJS({
|
|
|
11258
11258
|
// `name` node name or an object describing the XML tree
|
|
11259
11259
|
// `attributes` an object containing name/value pairs of attributes
|
|
11260
11260
|
// `text` element text
|
|
11261
|
-
insertBefore(name, attributes,
|
|
11261
|
+
insertBefore(name, attributes, text2) {
|
|
11262
11262
|
var child, i, newChild, refChild, removed;
|
|
11263
11263
|
if (name != null ? name.type : void 0) {
|
|
11264
11264
|
newChild = name;
|
|
@@ -11279,7 +11279,7 @@ var require_XMLNode = __commonJS({
|
|
|
11279
11279
|
}
|
|
11280
11280
|
i = this.parent.children.indexOf(this);
|
|
11281
11281
|
removed = this.parent.children.splice(i);
|
|
11282
|
-
child = this.parent.element(name, attributes,
|
|
11282
|
+
child = this.parent.element(name, attributes, text2);
|
|
11283
11283
|
Array.prototype.push.apply(this.parent.children, removed);
|
|
11284
11284
|
return child;
|
|
11285
11285
|
}
|
|
@@ -11288,14 +11288,14 @@ var require_XMLNode = __commonJS({
|
|
|
11288
11288
|
// `name` node name or an object describing the XML tree
|
|
11289
11289
|
// `attributes` an object containing name/value pairs of attributes
|
|
11290
11290
|
// `text` element text
|
|
11291
|
-
insertAfter(name, attributes,
|
|
11291
|
+
insertAfter(name, attributes, text2) {
|
|
11292
11292
|
var child, i, removed;
|
|
11293
11293
|
if (this.isRoot) {
|
|
11294
11294
|
throw new Error("Cannot insert elements at root level. " + this.debugInfo(name));
|
|
11295
11295
|
}
|
|
11296
11296
|
i = this.parent.children.indexOf(this);
|
|
11297
11297
|
removed = this.parent.children.splice(i + 1);
|
|
11298
|
-
child = this.parent.element(name, attributes,
|
|
11298
|
+
child = this.parent.element(name, attributes, text2);
|
|
11299
11299
|
Array.prototype.push.apply(this.parent.children, removed);
|
|
11300
11300
|
return child;
|
|
11301
11301
|
}
|
|
@@ -11313,7 +11313,7 @@ var require_XMLNode = __commonJS({
|
|
|
11313
11313
|
// `name` name of the node
|
|
11314
11314
|
// `attributes` an object containing name/value pairs of attributes
|
|
11315
11315
|
// `text` element text
|
|
11316
|
-
node(name, attributes,
|
|
11316
|
+
node(name, attributes, text2) {
|
|
11317
11317
|
var child;
|
|
11318
11318
|
if (name != null) {
|
|
11319
11319
|
name = getValue(name);
|
|
@@ -11321,11 +11321,11 @@ var require_XMLNode = __commonJS({
|
|
|
11321
11321
|
attributes || (attributes = {});
|
|
11322
11322
|
attributes = getValue(attributes);
|
|
11323
11323
|
if (!isObject(attributes)) {
|
|
11324
|
-
[
|
|
11324
|
+
[text2, attributes] = [attributes, text2];
|
|
11325
11325
|
}
|
|
11326
11326
|
child = new XMLElement(this, name, attributes);
|
|
11327
|
-
if (
|
|
11328
|
-
child.text(
|
|
11327
|
+
if (text2 != null) {
|
|
11328
|
+
child.text(text2);
|
|
11329
11329
|
}
|
|
11330
11330
|
this.children.push(child);
|
|
11331
11331
|
return child;
|
|
@@ -11582,11 +11582,11 @@ var require_XMLNode = __commonJS({
|
|
|
11582
11582
|
}
|
|
11583
11583
|
}
|
|
11584
11584
|
// Aliases
|
|
11585
|
-
ele(name, attributes,
|
|
11586
|
-
return this.element(name, attributes,
|
|
11585
|
+
ele(name, attributes, text2) {
|
|
11586
|
+
return this.element(name, attributes, text2);
|
|
11587
11587
|
}
|
|
11588
|
-
nod(name, attributes,
|
|
11589
|
-
return this.node(name, attributes,
|
|
11588
|
+
nod(name, attributes, text2) {
|
|
11589
|
+
return this.node(name, attributes, text2);
|
|
11590
11590
|
}
|
|
11591
11591
|
txt(value) {
|
|
11592
11592
|
return this.text(value);
|
|
@@ -11606,11 +11606,11 @@ var require_XMLNode = __commonJS({
|
|
|
11606
11606
|
dec(version, encoding, standalone) {
|
|
11607
11607
|
return this.declaration(version, encoding, standalone);
|
|
11608
11608
|
}
|
|
11609
|
-
e(name, attributes,
|
|
11610
|
-
return this.element(name, attributes,
|
|
11609
|
+
e(name, attributes, text2) {
|
|
11610
|
+
return this.element(name, attributes, text2);
|
|
11611
11611
|
}
|
|
11612
|
-
n(name, attributes,
|
|
11613
|
-
return this.node(name, attributes,
|
|
11612
|
+
n(name, attributes, text2) {
|
|
11613
|
+
return this.node(name, attributes, text2);
|
|
11614
11614
|
}
|
|
11615
11615
|
t(value) {
|
|
11616
11616
|
return this.text(value);
|
|
@@ -12995,7 +12995,7 @@ var require_XMLDocumentCB = __commonJS({
|
|
|
12995
12995
|
// `name` name of the node
|
|
12996
12996
|
// `attributes` an object containing name/value pairs of attributes
|
|
12997
12997
|
// `text` element text
|
|
12998
|
-
node(name, attributes,
|
|
12998
|
+
node(name, attributes, text2) {
|
|
12999
12999
|
if (name == null) {
|
|
13000
13000
|
throw new Error("Missing node name.");
|
|
13001
13001
|
}
|
|
@@ -13009,14 +13009,14 @@ var require_XMLDocumentCB = __commonJS({
|
|
|
13009
13009
|
}
|
|
13010
13010
|
attributes = getValue(attributes);
|
|
13011
13011
|
if (!isObject(attributes)) {
|
|
13012
|
-
[
|
|
13012
|
+
[text2, attributes] = [attributes, text2];
|
|
13013
13013
|
}
|
|
13014
13014
|
this.currentNode = new XMLElement(this, name, attributes);
|
|
13015
13015
|
this.currentNode.children = false;
|
|
13016
13016
|
this.currentLevel++;
|
|
13017
13017
|
this.openTags[this.currentLevel] = this.currentNode;
|
|
13018
|
-
if (
|
|
13019
|
-
this.text(
|
|
13018
|
+
if (text2 != null) {
|
|
13019
|
+
this.text(text2);
|
|
13020
13020
|
}
|
|
13021
13021
|
return this;
|
|
13022
13022
|
}
|
|
@@ -13025,7 +13025,7 @@ var require_XMLDocumentCB = __commonJS({
|
|
|
13025
13025
|
// `name` name of the node
|
|
13026
13026
|
// `attributes` an object containing name/value pairs of attributes
|
|
13027
13027
|
// `text` element text
|
|
13028
|
-
element(name, attributes,
|
|
13028
|
+
element(name, attributes, text2) {
|
|
13029
13029
|
var child, i, len, oldValidationFlag, ref, root;
|
|
13030
13030
|
if (this.currentNode && this.currentNode.type === NodeType.DocType) {
|
|
13031
13031
|
this.dtdElement(...arguments);
|
|
@@ -13045,7 +13045,7 @@ var require_XMLDocumentCB = __commonJS({
|
|
|
13045
13045
|
}
|
|
13046
13046
|
}
|
|
13047
13047
|
} else {
|
|
13048
|
-
this.node(name, attributes,
|
|
13048
|
+
this.node(name, attributes, text2);
|
|
13049
13049
|
}
|
|
13050
13050
|
}
|
|
13051
13051
|
return this;
|
|
@@ -13356,8 +13356,8 @@ var require_XMLDocumentCB = __commonJS({
|
|
|
13356
13356
|
ele() {
|
|
13357
13357
|
return this.element(...arguments);
|
|
13358
13358
|
}
|
|
13359
|
-
nod(name, attributes,
|
|
13360
|
-
return this.node(name, attributes,
|
|
13359
|
+
nod(name, attributes, text2) {
|
|
13360
|
+
return this.node(name, attributes, text2);
|
|
13361
13361
|
}
|
|
13362
13362
|
txt(value) {
|
|
13363
13363
|
return this.text(value);
|
|
@@ -13377,11 +13377,11 @@ var require_XMLDocumentCB = __commonJS({
|
|
|
13377
13377
|
dtd(root, pubID, sysID) {
|
|
13378
13378
|
return this.doctype(root, pubID, sysID);
|
|
13379
13379
|
}
|
|
13380
|
-
e(name, attributes,
|
|
13381
|
-
return this.element(name, attributes,
|
|
13380
|
+
e(name, attributes, text2) {
|
|
13381
|
+
return this.element(name, attributes, text2);
|
|
13382
13382
|
}
|
|
13383
|
-
n(name, attributes,
|
|
13384
|
-
return this.node(name, attributes,
|
|
13383
|
+
n(name, attributes, text2) {
|
|
13384
|
+
return this.node(name, attributes, text2);
|
|
13385
13385
|
}
|
|
13386
13386
|
t(value) {
|
|
13387
13387
|
return this.text(value);
|
|
@@ -14770,14 +14770,14 @@ var require_BigInteger = __commonJS({
|
|
|
14770
14770
|
}
|
|
14771
14771
|
return low.add(Integer.fromArray(result, BASE, false));
|
|
14772
14772
|
}
|
|
14773
|
-
var parseBase = function(
|
|
14773
|
+
var parseBase = function(text2, base, alphabet, caseSensitive) {
|
|
14774
14774
|
alphabet = alphabet || DEFAULT_ALPHABET;
|
|
14775
|
-
|
|
14775
|
+
text2 = String(text2);
|
|
14776
14776
|
if (!caseSensitive) {
|
|
14777
|
-
|
|
14777
|
+
text2 = text2.toLowerCase();
|
|
14778
14778
|
alphabet = alphabet.toLowerCase();
|
|
14779
14779
|
}
|
|
14780
|
-
var length =
|
|
14780
|
+
var length = text2.length;
|
|
14781
14781
|
var i2;
|
|
14782
14782
|
var absBase = Math.abs(base);
|
|
14783
14783
|
var alphabetValues = {};
|
|
@@ -14785,7 +14785,7 @@ var require_BigInteger = __commonJS({
|
|
|
14785
14785
|
alphabetValues[alphabet[i2]] = i2;
|
|
14786
14786
|
}
|
|
14787
14787
|
for (i2 = 0; i2 < length; i2++) {
|
|
14788
|
-
var c =
|
|
14788
|
+
var c = text2[i2];
|
|
14789
14789
|
if (c === "-") continue;
|
|
14790
14790
|
if (c in alphabetValues) {
|
|
14791
14791
|
if (alphabetValues[c] >= absBase) {
|
|
@@ -14796,16 +14796,16 @@ var require_BigInteger = __commonJS({
|
|
|
14796
14796
|
}
|
|
14797
14797
|
base = parseValue(base);
|
|
14798
14798
|
var digits = [];
|
|
14799
|
-
var isNegative =
|
|
14800
|
-
for (i2 = isNegative ? 1 : 0; i2 <
|
|
14801
|
-
var c =
|
|
14799
|
+
var isNegative = text2[0] === "-";
|
|
14800
|
+
for (i2 = isNegative ? 1 : 0; i2 < text2.length; i2++) {
|
|
14801
|
+
var c = text2[i2];
|
|
14802
14802
|
if (c in alphabetValues) digits.push(parseValue(alphabetValues[c]));
|
|
14803
14803
|
else if (c === "<") {
|
|
14804
14804
|
var start = i2;
|
|
14805
14805
|
do {
|
|
14806
14806
|
i2++;
|
|
14807
|
-
} while (
|
|
14808
|
-
digits.push(parseValue(
|
|
14807
|
+
} while (text2[i2] !== ">" && i2 < text2.length);
|
|
14808
|
+
digits.push(parseValue(text2.slice(start + 1, i2)));
|
|
14809
14809
|
} else throw new Error(c + " is not a valid character");
|
|
14810
14810
|
}
|
|
14811
14811
|
return parseBaseFromArray(digits, base, isNegative);
|
|
@@ -14937,15 +14937,15 @@ var require_BigInteger = __commonJS({
|
|
|
14937
14937
|
if (exp[0] === "+") exp = exp.slice(1);
|
|
14938
14938
|
exp = +exp;
|
|
14939
14939
|
if (exp !== truncate(exp) || !isPrecise(exp)) throw new Error("Invalid integer: " + exp + " is not a valid exponent.");
|
|
14940
|
-
var
|
|
14941
|
-
var decimalPlace =
|
|
14940
|
+
var text2 = split[0];
|
|
14941
|
+
var decimalPlace = text2.indexOf(".");
|
|
14942
14942
|
if (decimalPlace >= 0) {
|
|
14943
|
-
exp -=
|
|
14944
|
-
|
|
14943
|
+
exp -= text2.length - decimalPlace - 1;
|
|
14944
|
+
text2 = text2.slice(0, decimalPlace) + text2.slice(decimalPlace + 1);
|
|
14945
14945
|
}
|
|
14946
14946
|
if (exp < 0) throw new Error("Cannot include negative exponent part for integers");
|
|
14947
|
-
|
|
14948
|
-
v =
|
|
14947
|
+
text2 += new Array(exp + 1).join("0");
|
|
14948
|
+
v = text2;
|
|
14949
14949
|
}
|
|
14950
14950
|
var isValid2 = /^([0-9][0-9]*)$/.test(v);
|
|
14951
14951
|
if (!isValid2) throw new Error("Invalid integer: " + v);
|
|
@@ -15019,7 +15019,7 @@ var require_BigInteger = __commonJS({
|
|
|
15019
15019
|
var require_bplistParser = __commonJS({
|
|
15020
15020
|
"node_modules/.pnpm/bplist-parser@0.3.2/node_modules/bplist-parser/bplistParser.js"(exports2) {
|
|
15021
15021
|
"use strict";
|
|
15022
|
-
var
|
|
15022
|
+
var fs10 = require("fs");
|
|
15023
15023
|
var bigInt = require_BigInteger();
|
|
15024
15024
|
var debug = false;
|
|
15025
15025
|
exports2.maxObjectSize = 100 * 1e3 * 1e3;
|
|
@@ -15034,7 +15034,7 @@ var require_bplistParser = __commonJS({
|
|
|
15034
15034
|
let err = null;
|
|
15035
15035
|
let result;
|
|
15036
15036
|
try {
|
|
15037
|
-
result =
|
|
15037
|
+
result = parseBuffer2(buffer);
|
|
15038
15038
|
resolve(result);
|
|
15039
15039
|
} catch (ex) {
|
|
15040
15040
|
err = ex;
|
|
@@ -15046,7 +15046,7 @@ var require_bplistParser = __commonJS({
|
|
|
15046
15046
|
if (Buffer.isBuffer(fileNameOrBuffer)) {
|
|
15047
15047
|
return tryParseBuffer(fileNameOrBuffer);
|
|
15048
15048
|
}
|
|
15049
|
-
|
|
15049
|
+
fs10.readFile(fileNameOrBuffer, function(err, data) {
|
|
15050
15050
|
if (err) {
|
|
15051
15051
|
reject(err);
|
|
15052
15052
|
return callback(err);
|
|
@@ -15057,11 +15057,11 @@ var require_bplistParser = __commonJS({
|
|
|
15057
15057
|
};
|
|
15058
15058
|
exports2.parseFileSync = function(fileNameOrBuffer) {
|
|
15059
15059
|
if (!Buffer.isBuffer(fileNameOrBuffer)) {
|
|
15060
|
-
fileNameOrBuffer =
|
|
15060
|
+
fileNameOrBuffer = fs10.readFileSync(fileNameOrBuffer);
|
|
15061
15061
|
}
|
|
15062
|
-
return
|
|
15062
|
+
return parseBuffer2(fileNameOrBuffer);
|
|
15063
15063
|
};
|
|
15064
|
-
var
|
|
15064
|
+
var parseBuffer2 = exports2.parseBuffer = function(buffer) {
|
|
15065
15065
|
const header = buffer.slice(0, "bplist".length).toString("utf8");
|
|
15066
15066
|
if (header !== "bplist") {
|
|
15067
15067
|
throw new Error("Invalid binary plist. Expected 'bplist' at offset 0.");
|
|
@@ -15347,8 +15347,8 @@ var require_bplistParser = __commonJS({
|
|
|
15347
15347
|
});
|
|
15348
15348
|
|
|
15349
15349
|
// src/engine-main.ts
|
|
15350
|
-
var
|
|
15351
|
-
var
|
|
15350
|
+
var import_node_fs9 = __toESM(require("fs"));
|
|
15351
|
+
var import_node_path8 = __toESM(require("path"));
|
|
15352
15352
|
var import_node_readline = __toESM(require("readline"));
|
|
15353
15353
|
|
|
15354
15354
|
// node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/external.js
|
|
@@ -15829,8 +15829,8 @@ function getErrorMap() {
|
|
|
15829
15829
|
|
|
15830
15830
|
// node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js
|
|
15831
15831
|
var makeIssue = (params) => {
|
|
15832
|
-
const { data, path:
|
|
15833
|
-
const fullPath = [...
|
|
15832
|
+
const { data, path: path9, errorMaps, issueData } = params;
|
|
15833
|
+
const fullPath = [...path9, ...issueData.path || []];
|
|
15834
15834
|
const fullIssue = {
|
|
15835
15835
|
...issueData,
|
|
15836
15836
|
path: fullPath
|
|
@@ -15946,11 +15946,11 @@ var errorUtil;
|
|
|
15946
15946
|
|
|
15947
15947
|
// node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js
|
|
15948
15948
|
var ParseInputLazyPath = class {
|
|
15949
|
-
constructor(parent, value,
|
|
15949
|
+
constructor(parent, value, path9, key) {
|
|
15950
15950
|
this._cachedPath = [];
|
|
15951
15951
|
this.parent = parent;
|
|
15952
15952
|
this.data = value;
|
|
15953
|
-
this._path =
|
|
15953
|
+
this._path = path9;
|
|
15954
15954
|
this._key = key;
|
|
15955
15955
|
}
|
|
15956
15956
|
get path() {
|
|
@@ -19392,10 +19392,11 @@ var coerce = {
|
|
|
19392
19392
|
};
|
|
19393
19393
|
var NEVER = INVALID;
|
|
19394
19394
|
|
|
19395
|
-
// node_modules/.pnpm/@zhuixin+protocol@0.
|
|
19395
|
+
// node_modules/.pnpm/@zhuixin+protocol@0.2.4/node_modules/@zhuixin/protocol/dist/index.js
|
|
19396
19396
|
var PROTOCOL_VERSION = "1";
|
|
19397
19397
|
var engineCapabilities = [
|
|
19398
19398
|
"inspect:ipa",
|
|
19399
|
+
"inspect:mac-app",
|
|
19399
19400
|
"extract:app",
|
|
19400
19401
|
"javascript:analyze",
|
|
19401
19402
|
"native:inspect",
|
|
@@ -19449,6 +19450,15 @@ var DEFINITIONS = [
|
|
|
19449
19450
|
requiresArtifact: true,
|
|
19450
19451
|
builtIn: true
|
|
19451
19452
|
},
|
|
19453
|
+
{
|
|
19454
|
+
id: "inspect:mac-app",
|
|
19455
|
+
label: "Inspect macOS app",
|
|
19456
|
+
description: "Contents/Info.plist, bundle layout, architectures, signature and entitlements.",
|
|
19457
|
+
targetPlatforms: ["macos"],
|
|
19458
|
+
packageFormats: ["app"],
|
|
19459
|
+
requiresArtifact: true,
|
|
19460
|
+
builtIn: true
|
|
19461
|
+
},
|
|
19452
19462
|
{
|
|
19453
19463
|
id: "extract:app",
|
|
19454
19464
|
label: "Extract app",
|
|
@@ -19678,8 +19688,8 @@ function defaultWorkspaceRoot(hostPlatform, env) {
|
|
|
19678
19688
|
|
|
19679
19689
|
// src/jobs/capability.ts
|
|
19680
19690
|
var import_node_crypto = require("crypto");
|
|
19681
|
-
var
|
|
19682
|
-
var
|
|
19691
|
+
var import_node_fs5 = __toESM(require("fs"));
|
|
19692
|
+
var import_node_path5 = __toESM(require("path"));
|
|
19683
19693
|
|
|
19684
19694
|
// src/errors.ts
|
|
19685
19695
|
var CoreFailure = class extends Error {
|
|
@@ -19914,6 +19924,156 @@ async function inspectIpaFile(ipaPath) {
|
|
|
19914
19924
|
};
|
|
19915
19925
|
}
|
|
19916
19926
|
|
|
19927
|
+
// src/inspectors/macApp.ts
|
|
19928
|
+
var import_node_child_process = require("child_process");
|
|
19929
|
+
var import_node_fs4 = __toESM(require("fs"));
|
|
19930
|
+
var import_node_path3 = __toESM(require("path"));
|
|
19931
|
+
var import_node_util = require("util");
|
|
19932
|
+
var bplist = __toESM(require_bplistParser());
|
|
19933
|
+
var import_plist2 = __toESM(require_plist());
|
|
19934
|
+
var execFileAsync = (0, import_node_util.promisify)(import_node_child_process.execFile);
|
|
19935
|
+
function readPlist(filePath) {
|
|
19936
|
+
const buffer = import_node_fs4.default.readFileSync(filePath);
|
|
19937
|
+
if (buffer.subarray(0, 6).toString("utf8") === "bplist") {
|
|
19938
|
+
const [parsed] = bplist.parseBuffer(buffer);
|
|
19939
|
+
return parsed ?? {};
|
|
19940
|
+
}
|
|
19941
|
+
return import_plist2.default.parse(buffer.toString("utf8"));
|
|
19942
|
+
}
|
|
19943
|
+
function text(value) {
|
|
19944
|
+
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
19945
|
+
}
|
|
19946
|
+
function archName2(cpu, subtype) {
|
|
19947
|
+
if (cpu === 7) return "i386";
|
|
19948
|
+
if (cpu === 16777223) return "x86_64";
|
|
19949
|
+
if (cpu === 12) return "arm";
|
|
19950
|
+
if (cpu === 16777228) return (subtype & 16777215) === 2 ? "arm64e" : "arm64";
|
|
19951
|
+
return `cpu-${cpu.toString(16)}`;
|
|
19952
|
+
}
|
|
19953
|
+
function machOArchitectures(filePath) {
|
|
19954
|
+
const fd = import_node_fs4.default.openSync(filePath, "r");
|
|
19955
|
+
try {
|
|
19956
|
+
const head = Buffer.alloc(16);
|
|
19957
|
+
const read = import_node_fs4.default.readSync(fd, head, 0, head.length, 0);
|
|
19958
|
+
if (read < 12) return [];
|
|
19959
|
+
const be = head.readUInt32BE(0);
|
|
19960
|
+
if (be === 3405691582 || be === 3405691583) {
|
|
19961
|
+
const count = head.readUInt32BE(4);
|
|
19962
|
+
if (count <= 0 || count > 64) return [];
|
|
19963
|
+
const entrySize = be === 3405691583 ? 32 : 20;
|
|
19964
|
+
const table = Buffer.alloc(count * entrySize);
|
|
19965
|
+
import_node_fs4.default.readSync(fd, table, 0, table.length, 8);
|
|
19966
|
+
const result = [];
|
|
19967
|
+
for (let index = 0; index < count; index += 1) {
|
|
19968
|
+
const offset = index * entrySize;
|
|
19969
|
+
result.push(
|
|
19970
|
+
archName2(table.readUInt32BE(offset), table.readUInt32BE(offset + 4))
|
|
19971
|
+
);
|
|
19972
|
+
}
|
|
19973
|
+
return result;
|
|
19974
|
+
}
|
|
19975
|
+
const le = head.readUInt32LE(0);
|
|
19976
|
+
if (le === 4277009103 || le === 4277009102) {
|
|
19977
|
+
return [archName2(head.readUInt32LE(4), head.readUInt32LE(8))];
|
|
19978
|
+
}
|
|
19979
|
+
return [];
|
|
19980
|
+
} finally {
|
|
19981
|
+
import_node_fs4.default.closeSync(fd);
|
|
19982
|
+
}
|
|
19983
|
+
}
|
|
19984
|
+
async function readSignature(bundlePath, warnings) {
|
|
19985
|
+
if (process.platform !== "darwin") {
|
|
19986
|
+
warnings.push("Signature details require a macOS host.");
|
|
19987
|
+
return void 0;
|
|
19988
|
+
}
|
|
19989
|
+
try {
|
|
19990
|
+
const { stdout, stderr } = await execFileAsync(
|
|
19991
|
+
"codesign",
|
|
19992
|
+
["-dv", "--entitlements", ":-", bundlePath],
|
|
19993
|
+
{ timeout: 3e4, maxBuffer: 4 * 1024 * 1024 }
|
|
19994
|
+
);
|
|
19995
|
+
const details = `${stderr}`;
|
|
19996
|
+
const authority = [...details.matchAll(/^Authority=(.+)$/gm)].map(
|
|
19997
|
+
(match) => match[1].trim()
|
|
19998
|
+
);
|
|
19999
|
+
const team = /^TeamIdentifier=(.+)$/m.exec(details)?.[1]?.trim();
|
|
20000
|
+
const signed = /^CodeDirectory|^Signature=/m.test(details) || authority.length > 0;
|
|
20001
|
+
return {
|
|
20002
|
+
signed,
|
|
20003
|
+
authority: authority.length ? authority : void 0,
|
|
20004
|
+
teamIdentifier: team,
|
|
20005
|
+
entitlements: stdout.trim() || void 0
|
|
20006
|
+
};
|
|
20007
|
+
} catch (error) {
|
|
20008
|
+
const stderr = error.stderr ?? "";
|
|
20009
|
+
const signed = /^Signature=/m.test(stderr);
|
|
20010
|
+
if (!signed) warnings.push("No code signature could be read.");
|
|
20011
|
+
return { signed };
|
|
20012
|
+
}
|
|
20013
|
+
}
|
|
20014
|
+
async function inspectMacApp(bundlePath) {
|
|
20015
|
+
const warnings = [];
|
|
20016
|
+
const contents = import_node_path3.default.join(bundlePath, "Contents");
|
|
20017
|
+
const infoPath = import_node_path3.default.join(contents, "Info.plist");
|
|
20018
|
+
if (!import_node_fs4.default.existsSync(infoPath)) {
|
|
20019
|
+
throw new Error("Contents/Info.plist is missing.");
|
|
20020
|
+
}
|
|
20021
|
+
const info = readPlist(infoPath);
|
|
20022
|
+
const executableName = text(info.CFBundleExecutable);
|
|
20023
|
+
const macOsDir = import_node_path3.default.join(contents, "MacOS");
|
|
20024
|
+
const candidates = import_node_fs4.default.existsSync(macOsDir) ? import_node_fs4.default.readdirSync(macOsDir, { withFileTypes: true }).filter((entry) => entry.isFile()).map((entry) => entry.name) : [];
|
|
20025
|
+
const mainBinary = executableName && candidates.find((name) => name === executableName) || candidates[0];
|
|
20026
|
+
let mainExecutable;
|
|
20027
|
+
if (mainBinary) {
|
|
20028
|
+
const binaryPath = import_node_path3.default.join(macOsDir, mainBinary);
|
|
20029
|
+
const architectures = machOArchitectures(binaryPath);
|
|
20030
|
+
if (!architectures.length) warnings.push("Main executable is not a Mach-O binary.");
|
|
20031
|
+
mainExecutable = {
|
|
20032
|
+
path: import_node_path3.default.join("Contents", "MacOS", mainBinary),
|
|
20033
|
+
architectures,
|
|
20034
|
+
sizeBytes: import_node_fs4.default.statSync(binaryPath).size
|
|
20035
|
+
};
|
|
20036
|
+
} else {
|
|
20037
|
+
warnings.push("No executable found under Contents/MacOS.");
|
|
20038
|
+
}
|
|
20039
|
+
const topLevel = import_node_fs4.default.existsSync(contents) ? import_node_fs4.default.readdirSync(contents, { withFileTypes: true }).map((entry) => entry.name) : [];
|
|
20040
|
+
const frameworksDir = import_node_path3.default.join(contents, "Frameworks");
|
|
20041
|
+
const pluginsDir = import_node_path3.default.join(contents, "PlugIns");
|
|
20042
|
+
const resourcesDir = import_node_path3.default.join(contents, "Resources");
|
|
20043
|
+
const list = (dir) => import_node_fs4.default.existsSync(dir) ? import_node_fs4.default.readdirSync(dir, { withFileTypes: true }).filter((entry) => entry.isDirectory() || entry.name.endsWith(".framework")).map((entry) => entry.name) : [];
|
|
20044
|
+
const countResources = (dir) => {
|
|
20045
|
+
if (!import_node_fs4.default.existsSync(dir)) return 0;
|
|
20046
|
+
let total = 0;
|
|
20047
|
+
for (const entry of import_node_fs4.default.readdirSync(dir, { withFileTypes: true })) {
|
|
20048
|
+
const full = import_node_path3.default.join(dir, entry.name);
|
|
20049
|
+
if (entry.isDirectory()) total += countResources(full);
|
|
20050
|
+
else total += 1;
|
|
20051
|
+
}
|
|
20052
|
+
return total;
|
|
20053
|
+
};
|
|
20054
|
+
return {
|
|
20055
|
+
kind: "mac-app",
|
|
20056
|
+
bundle: {
|
|
20057
|
+
path: bundlePath,
|
|
20058
|
+
identifier: text(info.CFBundleIdentifier),
|
|
20059
|
+
name: text(info.CFBundleDisplayName) ?? text(info.CFBundleName) ?? import_node_path3.default.basename(bundlePath, ".app"),
|
|
20060
|
+
version: text(info.CFBundleShortVersionString),
|
|
20061
|
+
build: text(info.CFBundleVersion),
|
|
20062
|
+
executable: executableName,
|
|
20063
|
+
minimumSystemVersion: text(info.LSMinimumSystemVersion)
|
|
20064
|
+
},
|
|
20065
|
+
layout: {
|
|
20066
|
+
topLevel,
|
|
20067
|
+
frameworks: list(frameworksDir),
|
|
20068
|
+
plugins: list(pluginsDir),
|
|
20069
|
+
resourceCount: countResources(resourcesDir)
|
|
20070
|
+
},
|
|
20071
|
+
mainExecutable,
|
|
20072
|
+
signature: await readSignature(bundlePath, warnings),
|
|
20073
|
+
warnings
|
|
20074
|
+
};
|
|
20075
|
+
}
|
|
20076
|
+
|
|
19917
20077
|
// src/inspectors/report.ts
|
|
19918
20078
|
function cell(value) {
|
|
19919
20079
|
return String(value ?? "\u2014").replace(/\|/g, "\\|").replace(/\r?\n/g, " ");
|
|
@@ -19921,6 +20081,9 @@ function cell(value) {
|
|
|
19921
20081
|
function inspectionValue(inspection, key) {
|
|
19922
20082
|
return inspection && key in inspection ? inspection[key] : void 0;
|
|
19923
20083
|
}
|
|
20084
|
+
function record(value) {
|
|
20085
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
20086
|
+
}
|
|
19924
20087
|
function collectEvidencePaths(jobs) {
|
|
19925
20088
|
const paths = /* @__PURE__ */ new Set();
|
|
19926
20089
|
for (const job of jobs) {
|
|
@@ -19932,6 +20095,72 @@ function collectEvidencePaths(jobs) {
|
|
|
19932
20095
|
}
|
|
19933
20096
|
return [...paths];
|
|
19934
20097
|
}
|
|
20098
|
+
function renderMacAppInspection(lines, inspection, warnings) {
|
|
20099
|
+
const bundle = record(inspection.bundle) ?? {};
|
|
20100
|
+
const layout = record(inspection.layout) ?? {};
|
|
20101
|
+
const main = record(inspection.mainExecutable);
|
|
20102
|
+
const signature = record(inspection.signature);
|
|
20103
|
+
lines.push(
|
|
20104
|
+
"| Field | Value |",
|
|
20105
|
+
"| --- | --- |",
|
|
20106
|
+
`| Bundle ID | ${cell(bundle.identifier)} |`,
|
|
20107
|
+
`| Version | ${cell(bundle.version)} |`,
|
|
20108
|
+
`| Build | ${cell(bundle.build)} |`,
|
|
20109
|
+
`| Minimum system | ${cell(bundle.minimumSystemVersion)} |`,
|
|
20110
|
+
`| Bundle executable | ${cell(bundle.executable)} |`,
|
|
20111
|
+
`| Architectures | ${cell(
|
|
20112
|
+
Array.isArray(main?.architectures) ? main?.architectures.join(", ") : void 0
|
|
20113
|
+
)} |`,
|
|
20114
|
+
`| Frameworks | ${cell(
|
|
20115
|
+
Array.isArray(layout.frameworks) ? layout.frameworks.length : 0
|
|
20116
|
+
)} |`,
|
|
20117
|
+
`| Plug-ins | ${cell(Array.isArray(layout.plugins) ? layout.plugins.length : 0)} |`,
|
|
20118
|
+
`| Resources | ${cell(layout.resourceCount ?? 0)} files |`,
|
|
20119
|
+
`| Signed | ${cell(signature?.signed)} |`,
|
|
20120
|
+
`| Authority | ${cell(
|
|
20121
|
+
Array.isArray(signature?.authority) ? signature?.authority.join(", ") : void 0
|
|
20122
|
+
)} |`,
|
|
20123
|
+
""
|
|
20124
|
+
);
|
|
20125
|
+
if (warnings.length > 0) {
|
|
20126
|
+
lines.push("### Inspection warnings", "");
|
|
20127
|
+
for (const warning of warnings) lines.push(`- ${warning}`);
|
|
20128
|
+
lines.push("");
|
|
20129
|
+
}
|
|
20130
|
+
}
|
|
20131
|
+
function renderIpaInspection(lines, inspection, warnings) {
|
|
20132
|
+
lines.push(
|
|
20133
|
+
"| Field | Value |",
|
|
20134
|
+
"| --- | --- |",
|
|
20135
|
+
`| Bundle ID | ${cell(inspectionValue(inspection, "bundleId"))} |`,
|
|
20136
|
+
`| Version | ${cell(inspectionValue(inspection, "version"))} |`,
|
|
20137
|
+
`| Build | ${cell(inspectionValue(inspection, "build"))} |`,
|
|
20138
|
+
`| Minimum OS | ${cell(inspectionValue(inspection, "minimumOs"))} |`,
|
|
20139
|
+
`| Bundle executable | ${cell(inspectionValue(inspection, "executable"))} |`,
|
|
20140
|
+
""
|
|
20141
|
+
);
|
|
20142
|
+
const main = inspection.mainExecutable;
|
|
20143
|
+
if (main && typeof main === "object") {
|
|
20144
|
+
const record3 = main;
|
|
20145
|
+
const slices = Array.isArray(record3.slices) ? record3.slices : [];
|
|
20146
|
+
lines.push(
|
|
20147
|
+
"| Architecture | File type | cryptid | cryptoff | cryptsize |",
|
|
20148
|
+
"| --- | --- | --- | --- | --- |"
|
|
20149
|
+
);
|
|
20150
|
+
for (const item of slices) {
|
|
20151
|
+
const slice = item && typeof item === "object" ? item : {};
|
|
20152
|
+
lines.push(
|
|
20153
|
+
`| ${cell(slice.arch)} | ${cell(slice.filetype)} | ${cell(slice.cryptid)} | ${cell(slice.cryptoff)} | ${cell(slice.cryptsize)} |`
|
|
20154
|
+
);
|
|
20155
|
+
}
|
|
20156
|
+
lines.push("");
|
|
20157
|
+
}
|
|
20158
|
+
if (warnings.length > 0) {
|
|
20159
|
+
lines.push("### Inspection warnings", "");
|
|
20160
|
+
for (const warning of warnings) lines.push(`- ${warning}`);
|
|
20161
|
+
lines.push("");
|
|
20162
|
+
}
|
|
20163
|
+
}
|
|
19935
20164
|
function renderReportMarkdown(input2) {
|
|
19936
20165
|
const {
|
|
19937
20166
|
target,
|
|
@@ -19946,19 +20175,19 @@ function renderReportMarkdown(input2) {
|
|
|
19946
20175
|
const warnings = Array.isArray(inspection?.warnings) ? inspection.warnings.map(String) : [];
|
|
19947
20176
|
const evidencePaths = collectEvidencePaths(jobs);
|
|
19948
20177
|
const lines = [
|
|
19949
|
-
`# ${target.name} \xB7
|
|
20178
|
+
`# ${target.name} \xB7 Analysis report`,
|
|
19950
20179
|
"",
|
|
19951
|
-
`-
|
|
19952
|
-
`- Host
|
|
19953
|
-
`- Target
|
|
19954
|
-
`-
|
|
19955
|
-
|
|
20180
|
+
`- Generated: ${generatedAt}`,
|
|
20181
|
+
`- Host: ${hostPlatform}`,
|
|
20182
|
+
`- Target platform: ${target.targetRef.platform}`,
|
|
20183
|
+
`- Source: ${target.targetRef.sourceId} / ${target.targetRef.sourceRef}`,
|
|
20184
|
+
"- Scope: this report summarizes the local artifact, static inspection and job records. It does not describe runtime behavior.",
|
|
19956
20185
|
"",
|
|
19957
20186
|
"## Target",
|
|
19958
20187
|
"",
|
|
19959
|
-
"|
|
|
20188
|
+
"| Field | Value |",
|
|
19960
20189
|
"| --- | --- |",
|
|
19961
|
-
`|
|
|
20190
|
+
`| Name | ${cell(target.name)} |`,
|
|
19962
20191
|
`| Publisher | ${cell(target.publisher)} |`,
|
|
19963
20192
|
`| Bundle ID | ${cell(target.bundleId)} |`,
|
|
19964
20193
|
`| Package ID | ${cell(target.packageId)} |`,
|
|
@@ -19969,62 +20198,37 @@ function renderReportMarkdown(input2) {
|
|
|
19969
20198
|
""
|
|
19970
20199
|
];
|
|
19971
20200
|
if (!artifact) {
|
|
19972
|
-
lines.push("
|
|
20201
|
+
lines.push("No artifact has been registered yet.", "");
|
|
19973
20202
|
} else {
|
|
19974
20203
|
lines.push(
|
|
19975
|
-
"|
|
|
20204
|
+
"| Field | Value |",
|
|
19976
20205
|
"| --- | --- |",
|
|
19977
|
-
`|
|
|
19978
|
-
`|
|
|
19979
|
-
`|
|
|
20206
|
+
`| File | ${cell(artifact.path)} |`,
|
|
20207
|
+
`| Package format | ${cell(artifact.packageFormat.toUpperCase())} |`,
|
|
20208
|
+
`| Size | ${cell(`${artifact.sizeBytes} bytes`)} |`,
|
|
19980
20209
|
`| SHA-256 | ${cell(artifact.sha256)} |`,
|
|
19981
20210
|
`| Version / Build | ${cell(`${artifact.version ?? "unknown"} / ${artifact.buildNumber ?? "unknown"}`)} |`,
|
|
19982
|
-
`|
|
|
20211
|
+
`| Acquired | ${cell(artifact.downloadedAt)} |`,
|
|
19983
20212
|
"",
|
|
19984
|
-
"###
|
|
20213
|
+
"### Bundle inspection",
|
|
19985
20214
|
""
|
|
19986
20215
|
);
|
|
19987
20216
|
if (!inspection) {
|
|
19988
|
-
lines.push("artifact
|
|
20217
|
+
lines.push("The artifact has not been inspected yet.", "");
|
|
19989
20218
|
} else if (typeof inspection.error === "string") {
|
|
19990
|
-
lines.push(
|
|
20219
|
+
lines.push(`Inspection failed: ${cell(inspection.error)}`, "");
|
|
20220
|
+
} else if (inspection.kind === "mac-app") {
|
|
20221
|
+
renderMacAppInspection(lines, inspection, warnings);
|
|
19991
20222
|
} else {
|
|
19992
|
-
lines
|
|
19993
|
-
"| \u5B57\u6BB5 | \u503C |",
|
|
19994
|
-
"| --- | --- |",
|
|
19995
|
-
`| Bundle ID | ${cell(inspectionValue(inspection, "bundleId"))} |`,
|
|
19996
|
-
`| Version | ${cell(inspectionValue(inspection, "version"))} |`,
|
|
19997
|
-
`| Build | ${cell(inspectionValue(inspection, "build"))} |`,
|
|
19998
|
-
`| \u6700\u4F4E\u7CFB\u7EDF | ${cell(inspectionValue(inspection, "minimumOs"))} |`,
|
|
19999
|
-
`| Bundle executable | ${cell(inspectionValue(inspection, "executable"))} |`,
|
|
20000
|
-
""
|
|
20001
|
-
);
|
|
20002
|
-
const main = inspection.mainExecutable;
|
|
20003
|
-
if (main && typeof main === "object") {
|
|
20004
|
-
const record2 = main;
|
|
20005
|
-
const slices = Array.isArray(record2.slices) ? record2.slices : [];
|
|
20006
|
-
lines.push("| \u67B6\u6784 | \u6587\u4EF6\u7C7B\u578B | cryptid | cryptoff | cryptsize |", "| --- | --- | --- | --- | --- |");
|
|
20007
|
-
for (const item of slices) {
|
|
20008
|
-
const slice = item && typeof item === "object" ? item : {};
|
|
20009
|
-
lines.push(
|
|
20010
|
-
`| ${cell(slice.arch)} | ${cell(slice.filetype)} | ${cell(slice.cryptid)} | ${cell(slice.cryptoff)} | ${cell(slice.cryptsize)} |`
|
|
20011
|
-
);
|
|
20012
|
-
}
|
|
20013
|
-
lines.push("");
|
|
20014
|
-
}
|
|
20015
|
-
if (warnings.length > 0) {
|
|
20016
|
-
lines.push("### \u68C0\u67E5\u8B66\u544A", "");
|
|
20017
|
-
for (const warning of warnings) lines.push(`- ${warning}`);
|
|
20018
|
-
lines.push("");
|
|
20019
|
-
}
|
|
20223
|
+
renderIpaInspection(lines, inspection, warnings);
|
|
20020
20224
|
}
|
|
20021
20225
|
}
|
|
20022
20226
|
lines.push(
|
|
20023
|
-
"##
|
|
20227
|
+
"## Structured findings",
|
|
20024
20228
|
"",
|
|
20025
|
-
|
|
20229
|
+
`${findingTotal} finding(s) registered; ${findings.length} included in this report.`,
|
|
20026
20230
|
"",
|
|
20027
|
-
"|
|
|
20231
|
+
"| Type | Count |",
|
|
20028
20232
|
"| --- | --- |"
|
|
20029
20233
|
);
|
|
20030
20234
|
const byType = /* @__PURE__ */ new Map();
|
|
@@ -20042,29 +20246,29 @@ function renderReportMarkdown(input2) {
|
|
|
20042
20246
|
}
|
|
20043
20247
|
lines.push("");
|
|
20044
20248
|
for (const [type, title] of [
|
|
20045
|
-
["route", "
|
|
20046
|
-
["network_endpoint", "
|
|
20047
|
-
["module", "JavaScript
|
|
20048
|
-
["native_procedure", "
|
|
20049
|
-
["risk", "
|
|
20249
|
+
["route", "Routes"],
|
|
20250
|
+
["network_endpoint", "Network endpoint candidates"],
|
|
20251
|
+
["module", "JavaScript modules"],
|
|
20252
|
+
["native_procedure", "Native symbols"],
|
|
20253
|
+
["risk", "Risks and limitations"]
|
|
20050
20254
|
]) {
|
|
20051
20255
|
const items = findings.filter((finding) => finding.type === type).slice(0, 20);
|
|
20052
20256
|
if (items.length === 0) continue;
|
|
20053
20257
|
lines.push(`### ${title}`, "");
|
|
20054
20258
|
for (const item of items) {
|
|
20055
20259
|
const location = item.sourcePath ? ` \u2014 \`${item.sourcePath}\`${item.start ? `:${item.start.line}:${item.start.column}` : ""}` : "";
|
|
20056
|
-
lines.push(`- ${item.value}${location}
|
|
20260
|
+
lines.push(`- ${item.value}${location} (Evidence: \`${item.evidenceId}\`)`);
|
|
20057
20261
|
}
|
|
20058
20262
|
lines.push("");
|
|
20059
20263
|
}
|
|
20060
20264
|
lines.push(
|
|
20061
|
-
"##
|
|
20265
|
+
"## Jobs and evidence",
|
|
20062
20266
|
"",
|
|
20063
|
-
"|
|
|
20267
|
+
"| Capability | Status | Started | Finished | Result / error |",
|
|
20064
20268
|
"| --- | --- | --- | --- | --- |"
|
|
20065
20269
|
);
|
|
20066
20270
|
if (jobs.length === 0) {
|
|
20067
|
-
lines.push("| \u2014 | \u2014 | \u2014 | \u2014 |
|
|
20271
|
+
lines.push("| \u2014 | \u2014 | \u2014 | \u2014 | No jobs yet |");
|
|
20068
20272
|
} else {
|
|
20069
20273
|
for (const job of jobs) {
|
|
20070
20274
|
lines.push(
|
|
@@ -20074,19 +20278,19 @@ function renderReportMarkdown(input2) {
|
|
|
20074
20278
|
);
|
|
20075
20279
|
}
|
|
20076
20280
|
}
|
|
20077
|
-
lines.push("", "### Evidence
|
|
20281
|
+
lines.push("", "### Evidence paths", "");
|
|
20078
20282
|
if (evidencePaths.length === 0) {
|
|
20079
|
-
lines.push("
|
|
20283
|
+
lines.push("No evidence files have been registered yet.");
|
|
20080
20284
|
} else {
|
|
20081
20285
|
for (const evidencePath of evidencePaths) lines.push(`- \`${evidencePath}\``);
|
|
20082
20286
|
}
|
|
20083
20287
|
lines.push(
|
|
20084
20288
|
"",
|
|
20085
|
-
"##
|
|
20289
|
+
"## Limitations",
|
|
20086
20290
|
"",
|
|
20087
|
-
"-
|
|
20088
|
-
"- `cryptid != 0`
|
|
20089
|
-
"-
|
|
20291
|
+
"- Static analysis is observation and inference; it cannot prove the absence of uncovered code or server-side behavior.",
|
|
20292
|
+
"- A Mach-O slice with `cryptid != 0` is declared encrypted; its decompilation must not be treated as trustworthy original code.",
|
|
20293
|
+
"- The target app was not executed and no backend service was contacted.",
|
|
20090
20294
|
""
|
|
20091
20295
|
);
|
|
20092
20296
|
return lines.join("\n");
|
|
@@ -20101,8 +20305,8 @@ function describeResult(result) {
|
|
|
20101
20305
|
}
|
|
20102
20306
|
|
|
20103
20307
|
// src/process/run.ts
|
|
20104
|
-
var
|
|
20105
|
-
var
|
|
20308
|
+
var import_node_child_process2 = require("child_process");
|
|
20309
|
+
var import_node_path4 = __toESM(require("path"));
|
|
20106
20310
|
function quoteWindowsArgument(value) {
|
|
20107
20311
|
if (value.length === 0) return '""';
|
|
20108
20312
|
if (!/[\s"&|<>^()%!]/.test(value)) return value;
|
|
@@ -20112,7 +20316,7 @@ function windowsCommandLine(command, args) {
|
|
|
20112
20316
|
return [command, ...args].map(quoteWindowsArgument).join(" ");
|
|
20113
20317
|
}
|
|
20114
20318
|
function windowsSpawnSpec(command, args) {
|
|
20115
|
-
const extension =
|
|
20319
|
+
const extension = import_node_path4.default.extname(command).toLowerCase();
|
|
20116
20320
|
if (extension !== ".cmd" && extension !== ".bat") {
|
|
20117
20321
|
return { command, args, verbatim: false };
|
|
20118
20322
|
}
|
|
@@ -20130,7 +20334,7 @@ function runCommand(command, args, options = {}) {
|
|
|
20130
20334
|
let child;
|
|
20131
20335
|
try {
|
|
20132
20336
|
const spec = process.platform === "win32" ? windowsSpawnSpec(command, args) : { command, args, verbatim: false };
|
|
20133
|
-
child = (0,
|
|
20337
|
+
child = (0, import_node_child_process2.spawn)(spec.command, spec.args, {
|
|
20134
20338
|
env: options.env ?? process.env,
|
|
20135
20339
|
cwd: options.cwd,
|
|
20136
20340
|
stdio: ["ignore", "pipe", "pipe"],
|
|
@@ -20190,8 +20394,8 @@ function now() {
|
|
|
20190
20394
|
function isCancelled(job) {
|
|
20191
20395
|
return String(job.status) === "cancelled";
|
|
20192
20396
|
}
|
|
20193
|
-
function parseJsonDocument(
|
|
20194
|
-
const trimmed =
|
|
20397
|
+
function parseJsonDocument(text2) {
|
|
20398
|
+
const trimmed = text2.trim();
|
|
20195
20399
|
if (!trimmed) return null;
|
|
20196
20400
|
try {
|
|
20197
20401
|
const parsed = JSON.parse(trimmed);
|
|
@@ -20208,7 +20412,7 @@ function parseJsonDocument(text) {
|
|
|
20208
20412
|
}
|
|
20209
20413
|
}
|
|
20210
20414
|
}
|
|
20211
|
-
function
|
|
20415
|
+
function record2(value) {
|
|
20212
20416
|
return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
20213
20417
|
}
|
|
20214
20418
|
function compactCounts(source) {
|
|
@@ -20222,20 +20426,20 @@ function compactCounts(source) {
|
|
|
20222
20426
|
return result;
|
|
20223
20427
|
}
|
|
20224
20428
|
function observationProperties(node) {
|
|
20225
|
-
const item =
|
|
20429
|
+
const item = record2(node);
|
|
20226
20430
|
const observations = Array.isArray(item?.observations) ? item.observations : [];
|
|
20227
|
-
return
|
|
20431
|
+
return record2(record2(observations[0])?.properties) ?? {};
|
|
20228
20432
|
}
|
|
20229
20433
|
function observationSource(node) {
|
|
20230
|
-
const item =
|
|
20434
|
+
const item = record2(node);
|
|
20231
20435
|
const observations = Array.isArray(item?.observations) ? item.observations : [];
|
|
20232
|
-
const evidence =
|
|
20233
|
-
const location =
|
|
20436
|
+
const evidence = record2(record2(observations[0])?.evidence);
|
|
20437
|
+
const location = record2(record2(evidence?.location)?.value);
|
|
20234
20438
|
if (typeof location?.path === "string") {
|
|
20235
20439
|
return { sourcePath: location.path };
|
|
20236
20440
|
}
|
|
20237
20441
|
if (typeof location?.source === "string") {
|
|
20238
|
-
const start =
|
|
20442
|
+
const start = record2(location.start);
|
|
20239
20443
|
return {
|
|
20240
20444
|
sourcePath: location.source,
|
|
20241
20445
|
line: typeof start?.line === "number" ? start.line : void 0,
|
|
@@ -20255,16 +20459,16 @@ function isNetworkEndpointValue(value) {
|
|
|
20255
20459
|
return /^(?:https?|wss?):\/\//i.test(value) || /^\/\//.test(value) || /^[a-z0-9.-]+\.[a-z]{2,}(?:[/:?#]|$)/i.test(value) || /^\/[a-z0-9._~!$&'()*+,;=:@%/-]+$/i.test(value);
|
|
20256
20460
|
}
|
|
20257
20461
|
function detectTechnology(subjectName, modulePaths, assetPaths) {
|
|
20258
|
-
const
|
|
20462
|
+
const text2 = [subjectName, ...modulePaths, ...assetPaths].filter((value) => typeof value === "string").join("\n").toLowerCase();
|
|
20259
20463
|
const hints = [];
|
|
20260
|
-
if (/__uni__|uni-app|uni-jsframework|hbuilder/.test(
|
|
20464
|
+
if (/__uni__|uni-app|uni-jsframework|hbuilder/.test(text2)) {
|
|
20261
20465
|
hints.push("uni-app");
|
|
20262
20466
|
}
|
|
20263
|
-
if (/hbuilder/.test(
|
|
20264
|
-
if (/react-native|main\.jsbundle/.test(
|
|
20265
|
-
if (/flutter/.test(
|
|
20266
|
-
if (/capacitor/.test(
|
|
20267
|
-
if (/cordova/.test(
|
|
20467
|
+
if (/hbuilder/.test(text2)) hints.push("HBuilder");
|
|
20468
|
+
if (/react-native|main\.jsbundle/.test(text2)) hints.push("React Native");
|
|
20469
|
+
if (/flutter/.test(text2)) hints.push("Flutter");
|
|
20470
|
+
if (/capacitor/.test(text2)) hints.push("Capacitor");
|
|
20471
|
+
if (/cordova/.test(text2)) hints.push("Cordova");
|
|
20268
20472
|
return hints;
|
|
20269
20473
|
}
|
|
20270
20474
|
function hashText(value) {
|
|
@@ -20294,7 +20498,7 @@ function javascriptFindings(job, artifact, evidenceId, parsed, summary) {
|
|
|
20294
20498
|
createdAt
|
|
20295
20499
|
});
|
|
20296
20500
|
};
|
|
20297
|
-
const technology =
|
|
20501
|
+
const technology = record2(summary.technology);
|
|
20298
20502
|
if (Array.isArray(technology?.hints)) {
|
|
20299
20503
|
for (const hint of technology.hints) {
|
|
20300
20504
|
if (typeof hint === "string") {
|
|
@@ -20306,14 +20510,14 @@ function javascriptFindings(job, artifact, evidenceId, parsed, summary) {
|
|
|
20306
20510
|
}
|
|
20307
20511
|
}
|
|
20308
20512
|
}
|
|
20309
|
-
const normalized =
|
|
20310
|
-
const graph =
|
|
20513
|
+
const normalized = record2(parsed.normalized_result);
|
|
20514
|
+
const graph = record2(normalized?.graph);
|
|
20311
20515
|
const nodes = Array.isArray(graph?.nodes) ? graph.nodes : [];
|
|
20312
20516
|
const modulePaths = /* @__PURE__ */ new Set();
|
|
20313
20517
|
const assetPaths = /* @__PURE__ */ new Set();
|
|
20314
20518
|
const storageValues = /* @__PURE__ */ new Set();
|
|
20315
20519
|
for (const node of nodes) {
|
|
20316
|
-
const item =
|
|
20520
|
+
const item = record2(node);
|
|
20317
20521
|
const kind = item?.kind;
|
|
20318
20522
|
const properties = observationProperties(node);
|
|
20319
20523
|
const location = observationSource(node);
|
|
@@ -20380,7 +20584,7 @@ function javascriptFindings(job, artifact, evidenceId, parsed, summary) {
|
|
|
20380
20584
|
function nativeSearchFindings(job, artifact, evidenceId, parsed, kind) {
|
|
20381
20585
|
const values2 = Array.isArray(parsed.normalized_result) ? parsed.normalized_result : Array.isArray(parsed.raw_result) ? parsed.raw_result : [];
|
|
20382
20586
|
const createdAt = now();
|
|
20383
|
-
return values2.map((value) =>
|
|
20587
|
+
return values2.map((value) => record2(value)).filter((value) => Boolean(value?.value)).map((value) => ({
|
|
20384
20588
|
id: (0, import_node_crypto.randomUUID)(),
|
|
20385
20589
|
targetId: artifact.targetId,
|
|
20386
20590
|
artifactId: artifact.id,
|
|
@@ -20415,16 +20619,16 @@ function nativeRiskFindings(job, artifact, evidenceId, encryption) {
|
|
|
20415
20619
|
];
|
|
20416
20620
|
}
|
|
20417
20621
|
function summarizeRea(parsed) {
|
|
20418
|
-
const normalized =
|
|
20419
|
-
const graph =
|
|
20420
|
-
const semantic =
|
|
20622
|
+
const normalized = record2(parsed.normalized_result);
|
|
20623
|
+
const graph = record2(normalized?.graph);
|
|
20624
|
+
const semantic = record2(normalized?.semantic_graph);
|
|
20421
20625
|
const limitations = Array.isArray(parsed.limitations) ? parsed.limitations.slice(0, 12) : [];
|
|
20422
|
-
const subject =
|
|
20423
|
-
const provider =
|
|
20424
|
-
const pseudocode = typeof
|
|
20626
|
+
const subject = record2(parsed.subject);
|
|
20627
|
+
const provider = record2(parsed.provider);
|
|
20628
|
+
const pseudocode = typeof record2(parsed.raw_result)?.value === "string" ? String(record2(parsed.raw_result)?.value) : void 0;
|
|
20425
20629
|
const graphNodes = Array.isArray(graph?.nodes) ? graph.nodes : [];
|
|
20426
20630
|
const endpointNodes = graphNodes.filter(
|
|
20427
|
-
(node) =>
|
|
20631
|
+
(node) => record2(node)?.kind === "endpoint"
|
|
20428
20632
|
);
|
|
20429
20633
|
const routeItems = endpointNodes.filter((node) => observationProperties(node).endpoint_kind === "route").map((node) => {
|
|
20430
20634
|
const properties = observationProperties(node);
|
|
@@ -20444,15 +20648,15 @@ function summarizeRea(parsed) {
|
|
|
20444
20648
|
(item) => typeof item.value === "string" && isNetworkEndpointValue(item.value)
|
|
20445
20649
|
);
|
|
20446
20650
|
const modulePaths = uniqueStrings(
|
|
20447
|
-
graphNodes.filter((node) =>
|
|
20651
|
+
graphNodes.filter((node) => record2(node)?.kind === "javascript-module").map((node) => observationProperties(node).path),
|
|
20448
20652
|
200
|
|
20449
20653
|
);
|
|
20450
20654
|
const assetPaths = uniqueStrings(
|
|
20451
|
-
graphNodes.filter((node) =>
|
|
20655
|
+
graphNodes.filter((node) => record2(node)?.kind === "javascript-asset").map((node) => observationProperties(node).path),
|
|
20452
20656
|
200
|
|
20453
20657
|
);
|
|
20454
20658
|
const storageItems = uniqueStrings(
|
|
20455
|
-
graphNodes.filter((node) =>
|
|
20659
|
+
graphNodes.filter((node) => record2(node)?.kind === "storage").map((node) => {
|
|
20456
20660
|
const properties = observationProperties(node);
|
|
20457
20661
|
return `${String(properties.storage_kind ?? "storage")}:${String(
|
|
20458
20662
|
properties.mechanism ?? properties.name ?? "unknown"
|
|
@@ -20471,11 +20675,11 @@ function summarizeRea(parsed) {
|
|
|
20471
20675
|
name: subject.name,
|
|
20472
20676
|
format: subject.format,
|
|
20473
20677
|
architecture: subject.architecture,
|
|
20474
|
-
sha256:
|
|
20678
|
+
sha256: record2(subject.digest)?.sha256
|
|
20475
20679
|
} : void 0,
|
|
20476
20680
|
provider: provider ? { id: provider.id, name: provider.name, version: provider.version } : void 0,
|
|
20477
20681
|
counts: {
|
|
20478
|
-
...compactCounts(
|
|
20682
|
+
...compactCounts(record2(normalized?.statistics) ?? normalized),
|
|
20479
20683
|
graphNodes: Array.isArray(graph?.nodes) ? graph.nodes.length : void 0,
|
|
20480
20684
|
graphEdges: Array.isArray(graph?.edges) ? graph.edges.length : void 0,
|
|
20481
20685
|
semanticNodes: Array.isArray(semantic?.nodes) ? semantic.nodes.length : void 0,
|
|
@@ -20518,15 +20722,15 @@ function encryptionState(inspection) {
|
|
|
20518
20722
|
};
|
|
20519
20723
|
}
|
|
20520
20724
|
function shortFailure(stderr, stdout) {
|
|
20521
|
-
const
|
|
20725
|
+
const text2 = `${stderr}
|
|
20522
20726
|
${stdout}`.split(/\r?\n/).map((line) => line.trim()).filter(Boolean).join("\n");
|
|
20523
|
-
return
|
|
20727
|
+
return text2.slice(-1200) || "\u5206\u6790\u5F15\u64CE\u6CA1\u6709\u8FD4\u56DE\u9519\u8BEF\u8BE6\u60C5\u3002";
|
|
20524
20728
|
}
|
|
20525
20729
|
function reaErrorMessage(parsed) {
|
|
20526
20730
|
if (!parsed) return void 0;
|
|
20527
|
-
const details =
|
|
20528
|
-
const diagnostics =
|
|
20529
|
-
const failureCause =
|
|
20731
|
+
const details = record2(parsed.details);
|
|
20732
|
+
const diagnostics = record2(details?.diagnostics);
|
|
20733
|
+
const failureCause = record2(details?.failure_cause);
|
|
20530
20734
|
for (const value of [
|
|
20531
20735
|
diagnostics?.message,
|
|
20532
20736
|
details?.failure_message,
|
|
@@ -20635,6 +20839,9 @@ var CapabilityJobRunner = class {
|
|
|
20635
20839
|
case "inspect:ipa":
|
|
20636
20840
|
await this.runInspect(job, target, artifact);
|
|
20637
20841
|
return;
|
|
20842
|
+
case "inspect:mac-app":
|
|
20843
|
+
await this.runInspectMacApp(job, target, artifact);
|
|
20844
|
+
return;
|
|
20638
20845
|
case "extract:app":
|
|
20639
20846
|
await this.runExtract(job, target, artifact);
|
|
20640
20847
|
return;
|
|
@@ -20699,10 +20906,36 @@ var CapabilityJobRunner = class {
|
|
|
20699
20906
|
warnings: inspection.warnings.length
|
|
20700
20907
|
});
|
|
20701
20908
|
}
|
|
20909
|
+
async runInspectMacApp(job, target, artifact) {
|
|
20910
|
+
if (!artifact) fail("ARTIFACT_REQUIRED", "Acquire an artifact first.");
|
|
20911
|
+
this.log(job, "info", "Inspecting the macOS app bundle.");
|
|
20912
|
+
this.patch(job, { progress: 25 });
|
|
20913
|
+
const inspection = await inspectMacApp(
|
|
20914
|
+
this.workspace.resolveStoredPath(artifact.path)
|
|
20915
|
+
);
|
|
20916
|
+
const updated = {
|
|
20917
|
+
...artifact,
|
|
20918
|
+
version: inspection.bundle.version ?? artifact.version,
|
|
20919
|
+
buildNumber: inspection.bundle.build ?? artifact.buildNumber,
|
|
20920
|
+
architecture: inspection.mainExecutable?.architectures.join(",") || artifact.architecture,
|
|
20921
|
+
inspection
|
|
20922
|
+
};
|
|
20923
|
+
this.store.insertArtifact(updated);
|
|
20924
|
+
this.workspace.saveArtifactMetadata(target, updated);
|
|
20925
|
+
this.patch(job, {
|
|
20926
|
+
status: "analyzed",
|
|
20927
|
+
progress: 100,
|
|
20928
|
+
result: { inspection },
|
|
20929
|
+
finishedAt: now()
|
|
20930
|
+
});
|
|
20931
|
+
this.log(job, "info", "macOS bundle inspection complete.", {
|
|
20932
|
+
warnings: inspection.warnings.length
|
|
20933
|
+
});
|
|
20934
|
+
}
|
|
20702
20935
|
async runExtract(job, target, artifact) {
|
|
20703
20936
|
if (!artifact) fail("ARTIFACT_REQUIRED", "\u8BF7\u5148\u83B7\u53D6 artifact\u3002");
|
|
20704
20937
|
this.log(job, "info", "\u5F00\u59CB\u89E3\u5305 .app\u3002");
|
|
20705
|
-
const outputDir =
|
|
20938
|
+
const outputDir = import_node_path5.default.join(
|
|
20706
20939
|
this.workspace.analysisDir(target),
|
|
20707
20940
|
"extract-app",
|
|
20708
20941
|
job.id
|
|
@@ -20716,7 +20949,7 @@ var CapabilityJobRunner = class {
|
|
|
20716
20949
|
progress: 100,
|
|
20717
20950
|
result: {
|
|
20718
20951
|
...extracted,
|
|
20719
|
-
outputDir:
|
|
20952
|
+
outputDir: import_node_path5.default.relative(this.workspace.root, extracted.outputDir)
|
|
20720
20953
|
},
|
|
20721
20954
|
finishedAt: now()
|
|
20722
20955
|
});
|
|
@@ -20728,7 +20961,7 @@ var CapabilityJobRunner = class {
|
|
|
20728
20961
|
if (!artifact) fail("ARTIFACT_REQUIRED", "\u8BF7\u5148\u83B7\u53D6 artifact\u3002");
|
|
20729
20962
|
const extraction = await this.ensureExtraction(job, target, artifact);
|
|
20730
20963
|
this.log(job, "info", "\u5BF9\u89E3\u5305\u76EE\u5F55\u8FD0\u884C JavaScript \u9759\u6001\u5206\u6790\u3002", {
|
|
20731
|
-
path:
|
|
20964
|
+
path: import_node_path5.default.relative(this.workspace.root, extraction.appRoot)
|
|
20732
20965
|
});
|
|
20733
20966
|
this.patch(job, { progress: 25 });
|
|
20734
20967
|
const rea = await this.runReaJson(
|
|
@@ -20767,7 +21000,7 @@ var CapabilityJobRunner = class {
|
|
|
20767
21000
|
result: {
|
|
20768
21001
|
...rea.summary,
|
|
20769
21002
|
evidenceId,
|
|
20770
|
-
outputDir:
|
|
21003
|
+
outputDir: import_node_path5.default.relative(this.workspace.root, extraction.appRoot),
|
|
20771
21004
|
evidencePath: rea.rawPath
|
|
20772
21005
|
},
|
|
20773
21006
|
finishedAt: now()
|
|
@@ -20811,7 +21044,7 @@ var CapabilityJobRunner = class {
|
|
|
20811
21044
|
result: {
|
|
20812
21045
|
...rea.summary,
|
|
20813
21046
|
evidenceId,
|
|
20814
|
-
binaryPath:
|
|
21047
|
+
binaryPath: import_node_path5.default.relative(this.workspace.root, prepared.binaryPath),
|
|
20815
21048
|
evidencePath: rea.rawPath,
|
|
20816
21049
|
encryption,
|
|
20817
21050
|
warning: encryption.encryptedSlices > 0 ? "\u4E3B\u7A0B\u5E8F\u5305\u542B\u58F0\u660E\u52A0\u5BC6\u7684\u5207\u7247\uFF1B\u4E0D\u8981\u628A\u52A0\u5BC6\u533A\u53CD\u7F16\u8BD1\u7ED3\u679C\u5F53\u4F5C\u53EF\u4FE1\u539F\u59CB\u5B9E\u73B0\u3002" : void 0
|
|
@@ -20862,7 +21095,7 @@ var CapabilityJobRunner = class {
|
|
|
20862
21095
|
);
|
|
20863
21096
|
this.persistEvidence(job, artifact, "native-search", rea, evidenceId, findings);
|
|
20864
21097
|
const rawMatches = Array.isArray(rea.parsed.normalized_result) ? rea.parsed.normalized_result : Array.isArray(rea.parsed.raw_result) ? rea.parsed.raw_result : [];
|
|
20865
|
-
const matches = rawMatches.map((item) =>
|
|
21098
|
+
const matches = rawMatches.map((item) => record2(item)).filter((item) => Boolean(item?.value)).slice(0, 100);
|
|
20866
21099
|
this.patch(job, {
|
|
20867
21100
|
status: "analyzed",
|
|
20868
21101
|
progress: 100,
|
|
@@ -20874,7 +21107,7 @@ var CapabilityJobRunner = class {
|
|
|
20874
21107
|
mode,
|
|
20875
21108
|
matchCount: rawMatches.length,
|
|
20876
21109
|
matches,
|
|
20877
|
-
binaryPath:
|
|
21110
|
+
binaryPath: import_node_path5.default.relative(this.workspace.root, prepared.binaryPath),
|
|
20878
21111
|
evidencePath: rea.rawPath,
|
|
20879
21112
|
limitations: Array.isArray(rea.parsed.limitations) ? rea.parsed.limitations : [],
|
|
20880
21113
|
encryption: encryptionState(prepared.inspection)
|
|
@@ -20919,7 +21152,7 @@ var CapabilityJobRunner = class {
|
|
|
20919
21152
|
result: {
|
|
20920
21153
|
...rea.summary,
|
|
20921
21154
|
functionName: input2.functionName,
|
|
20922
|
-
binaryPath:
|
|
21155
|
+
binaryPath: import_node_path5.default.relative(this.workspace.root, prepared.binaryPath),
|
|
20923
21156
|
evidencePath: rea.rawPath,
|
|
20924
21157
|
encryption
|
|
20925
21158
|
},
|
|
@@ -20934,7 +21167,7 @@ var CapabilityJobRunner = class {
|
|
|
20934
21167
|
this.log(job, "info", "\u6C47\u603B Target\u3001artifact \u548C\u4EFB\u52A1\u8BC1\u636E\u3002");
|
|
20935
21168
|
this.patch(job, { progress: 35 });
|
|
20936
21169
|
const generatedAt = now();
|
|
20937
|
-
const reportPath =
|
|
21170
|
+
const reportPath = import_node_path5.default.join(
|
|
20938
21171
|
this.workspace.targetDir(target),
|
|
20939
21172
|
"reports",
|
|
20940
21173
|
`${job.id}.md`
|
|
@@ -20953,7 +21186,7 @@ var CapabilityJobRunner = class {
|
|
|
20953
21186
|
generatedAt
|
|
20954
21187
|
});
|
|
20955
21188
|
this.workspace.writeText(reportPath, markdown);
|
|
20956
|
-
const relativePath =
|
|
21189
|
+
const relativePath = import_node_path5.default.relative(this.workspace.root, reportPath);
|
|
20957
21190
|
this.patch(job, {
|
|
20958
21191
|
status: "analyzed",
|
|
20959
21192
|
progress: 100,
|
|
@@ -20985,12 +21218,12 @@ var CapabilityJobRunner = class {
|
|
|
20985
21218
|
fail("MAIN_EXECUTABLE_NOT_FOUND", "IPA \u68C0\u67E5\u7ED3\u679C\u4E2D\u6CA1\u6709\u4E3B\u7A0B\u5E8F\u8DEF\u5F84\u3002");
|
|
20986
21219
|
}
|
|
20987
21220
|
const extraction = await this.ensureExtraction(job, target, current);
|
|
20988
|
-
const binaryPath =
|
|
20989
|
-
const root =
|
|
20990
|
-
if (binaryPath !== root && !binaryPath.startsWith(root +
|
|
21221
|
+
const binaryPath = import_node_path5.default.resolve(extraction.outputDir, executable);
|
|
21222
|
+
const root = import_node_path5.default.resolve(extraction.outputDir);
|
|
21223
|
+
if (binaryPath !== root && !binaryPath.startsWith(root + import_node_path5.default.sep)) {
|
|
20991
21224
|
fail("UNSAFE_ARTIFACT_PATH", "\u4E3B\u7A0B\u5E8F\u8DEF\u5F84\u8D8A\u51FA\u89E3\u5305\u76EE\u5F55\uFF0C\u5DF2\u62D2\u7EDD\u6267\u884C\u3002");
|
|
20992
21225
|
}
|
|
20993
|
-
if (!
|
|
21226
|
+
if (!import_node_fs5.default.existsSync(binaryPath)) {
|
|
20994
21227
|
fail("MAIN_EXECUTABLE_NOT_FOUND", `\u89E3\u5305\u76EE\u5F55\u4E2D\u6CA1\u6709\u4E3B\u7A0B\u5E8F\uFF1A${executable}`);
|
|
20995
21228
|
}
|
|
20996
21229
|
return { inspection, binaryPath };
|
|
@@ -20999,24 +21232,24 @@ var CapabilityJobRunner = class {
|
|
|
20999
21232
|
const previous = this.findExtraction(target.id, artifact.id);
|
|
21000
21233
|
if (previous) {
|
|
21001
21234
|
this.log(job, "info", "\u590D\u7528\u5DF2\u6709\u89E3\u5305\u76EE\u5F55\u3002", {
|
|
21002
|
-
path:
|
|
21235
|
+
path: import_node_path5.default.relative(this.workspace.root, previous.outputDir)
|
|
21003
21236
|
});
|
|
21004
21237
|
return previous;
|
|
21005
21238
|
}
|
|
21006
|
-
const outputDir =
|
|
21239
|
+
const outputDir = import_node_path5.default.join(
|
|
21007
21240
|
this.workspace.analysisDir(target),
|
|
21008
21241
|
"extracted",
|
|
21009
21242
|
artifact.id
|
|
21010
21243
|
);
|
|
21011
|
-
const existingApp =
|
|
21244
|
+
const existingApp = import_node_fs5.default.existsSync(outputDir) ? findAppPrefix(outputDir) : void 0;
|
|
21012
21245
|
if (existingApp) {
|
|
21013
21246
|
const location = {
|
|
21014
21247
|
outputDir,
|
|
21015
21248
|
prefix: existingApp,
|
|
21016
|
-
appRoot:
|
|
21249
|
+
appRoot: import_node_path5.default.join(outputDir, existingApp)
|
|
21017
21250
|
};
|
|
21018
21251
|
this.log(job, "info", "\u590D\u7528\u6309 artifact \u54C8\u5E0C\u5F52\u6863\u7684\u89E3\u5305\u76EE\u5F55\u3002", {
|
|
21019
|
-
path:
|
|
21252
|
+
path: import_node_path5.default.relative(this.workspace.root, outputDir)
|
|
21020
21253
|
});
|
|
21021
21254
|
return location;
|
|
21022
21255
|
}
|
|
@@ -21026,8 +21259,8 @@ var CapabilityJobRunner = class {
|
|
|
21026
21259
|
this.workspace.resolveStoredPath(artifact.path),
|
|
21027
21260
|
outputDir
|
|
21028
21261
|
);
|
|
21029
|
-
const appRoot =
|
|
21030
|
-
if (appRoot !== outputDir && !appRoot.startsWith(outputDir +
|
|
21262
|
+
const appRoot = import_node_path5.default.resolve(outputDir, extracted.prefix);
|
|
21263
|
+
if (appRoot !== outputDir && !appRoot.startsWith(outputDir + import_node_path5.default.sep)) {
|
|
21031
21264
|
fail("UNSAFE_ARTIFACT_PATH", "\u89E3\u5305\u524D\u7F00\u8D8A\u51FA\u8F93\u51FA\u76EE\u5F55\uFF0C\u5DF2\u62D2\u7EDD\u7EE7\u7EED\u3002");
|
|
21032
21265
|
}
|
|
21033
21266
|
return { outputDir, appRoot, prefix: extracted.prefix };
|
|
@@ -21042,8 +21275,8 @@ var CapabilityJobRunner = class {
|
|
|
21042
21275
|
if (typeof output !== "string" || typeof prefix !== "string") continue;
|
|
21043
21276
|
try {
|
|
21044
21277
|
const outputDir = this.workspace.resolveStoredPath(output);
|
|
21045
|
-
const appRoot =
|
|
21046
|
-
if (
|
|
21278
|
+
const appRoot = import_node_path5.default.resolve(outputDir, prefix);
|
|
21279
|
+
if (import_node_fs5.default.existsSync(appRoot) && (appRoot === outputDir || appRoot.startsWith(outputDir + import_node_path5.default.sep))) {
|
|
21047
21280
|
return { outputDir, appRoot, prefix };
|
|
21048
21281
|
}
|
|
21049
21282
|
} catch {
|
|
@@ -21052,11 +21285,11 @@ var CapabilityJobRunner = class {
|
|
|
21052
21285
|
return void 0;
|
|
21053
21286
|
}
|
|
21054
21287
|
async runReaJson(job, target, folder, args, timeoutMs) {
|
|
21055
|
-
const dir =
|
|
21056
|
-
const rawPath =
|
|
21057
|
-
const stderrPath =
|
|
21058
|
-
const commandPath =
|
|
21059
|
-
|
|
21288
|
+
const dir = import_node_path5.default.join(this.workspace.analysisDir(target), folder, job.id);
|
|
21289
|
+
const rawPath = import_node_path5.default.join(dir, "result.json");
|
|
21290
|
+
const stderrPath = import_node_path5.default.join(dir, "stderr.log");
|
|
21291
|
+
const commandPath = import_node_path5.default.join(dir, "command.json");
|
|
21292
|
+
import_node_fs5.default.mkdirSync(dir, { recursive: true, mode: 448 });
|
|
21060
21293
|
this.workspace.writeJson(commandPath, {
|
|
21061
21294
|
command: this.config.reaPath,
|
|
21062
21295
|
args,
|
|
@@ -21075,7 +21308,7 @@ var CapabilityJobRunner = class {
|
|
|
21075
21308
|
});
|
|
21076
21309
|
this.workspace.writeText(rawPath, result.stdout);
|
|
21077
21310
|
this.workspace.writeText(stderrPath, result.stderr);
|
|
21078
|
-
this.workspace.writeJson(
|
|
21311
|
+
this.workspace.writeJson(import_node_path5.default.join(dir, "status.json"), {
|
|
21079
21312
|
code: result.code,
|
|
21080
21313
|
timedOut: result.timedOut,
|
|
21081
21314
|
finishedAt: now()
|
|
@@ -21089,7 +21322,7 @@ var CapabilityJobRunner = class {
|
|
|
21089
21322
|
if (result.code !== 0) {
|
|
21090
21323
|
const parsed2 = parseJsonDocument(result.stdout);
|
|
21091
21324
|
this.log(job, "warn", "\u5206\u6790\u5F15\u64CE\u672A\u6210\u529F\u5B8C\u6210\uFF0C\u539F\u59CB\u8F93\u51FA\u5DF2\u4FDD\u7559\u3002", {
|
|
21092
|
-
evidencePath:
|
|
21325
|
+
evidencePath: import_node_path5.default.relative(this.workspace.root, rawPath)
|
|
21093
21326
|
});
|
|
21094
21327
|
const message = reaErrorMessage(parsed2) ?? shortFailure(result.stderr, result.stdout);
|
|
21095
21328
|
fail("ENGINE_FAILED", message);
|
|
@@ -21103,7 +21336,7 @@ var CapabilityJobRunner = class {
|
|
|
21103
21336
|
}
|
|
21104
21337
|
return {
|
|
21105
21338
|
parsed,
|
|
21106
|
-
rawPath:
|
|
21339
|
+
rawPath: import_node_path5.default.relative(this.workspace.root, rawPath),
|
|
21107
21340
|
sha256: hashText(result.stdout),
|
|
21108
21341
|
summary: summarizeRea(parsed)
|
|
21109
21342
|
};
|
|
@@ -21151,10 +21384,10 @@ var CapabilityJobRunner = class {
|
|
|
21151
21384
|
}
|
|
21152
21385
|
};
|
|
21153
21386
|
function findAppPrefix(outputDir) {
|
|
21154
|
-
const payload =
|
|
21155
|
-
if (!
|
|
21387
|
+
const payload = import_node_path5.default.join(outputDir, "Payload");
|
|
21388
|
+
if (!import_node_fs5.default.existsSync(payload)) return void 0;
|
|
21156
21389
|
try {
|
|
21157
|
-
const app =
|
|
21390
|
+
const app = import_node_fs5.default.readdirSync(payload, { withFileTypes: true }).find((entry) => entry.isDirectory() && entry.name.endsWith(".app"));
|
|
21158
21391
|
return app ? `Payload/${app.name}/` : void 0;
|
|
21159
21392
|
} catch {
|
|
21160
21393
|
return void 0;
|
|
@@ -21162,10 +21395,11 @@ function findAppPrefix(outputDir) {
|
|
|
21162
21395
|
}
|
|
21163
21396
|
|
|
21164
21397
|
// src/license.ts
|
|
21165
|
-
var
|
|
21398
|
+
var import_node_fs6 = __toESM(require("fs"));
|
|
21166
21399
|
var import_node_crypto2 = __toESM(require("crypto"));
|
|
21167
21400
|
var FREE_FEATURES = /* @__PURE__ */ new Set([
|
|
21168
21401
|
"inspect:ipa",
|
|
21402
|
+
"inspect:mac-app",
|
|
21169
21403
|
"extract:app",
|
|
21170
21404
|
"javascript:analyze",
|
|
21171
21405
|
"generate:report"
|
|
@@ -21181,7 +21415,7 @@ function verifyLicense(token) {
|
|
|
21181
21415
|
if (!encodedPayload || !encodedSignature) {
|
|
21182
21416
|
throw new Error("Invalid license token.");
|
|
21183
21417
|
}
|
|
21184
|
-
const publicKeyValue = process.env.APPTRACE_LICENSE_PUBLIC_KEY || (process.env.APPTRACE_LICENSE_PUBLIC_KEY_FILE ?
|
|
21418
|
+
const publicKeyValue = process.env.APPTRACE_LICENSE_PUBLIC_KEY || (process.env.APPTRACE_LICENSE_PUBLIC_KEY_FILE ? import_node_fs6.default.readFileSync(process.env.APPTRACE_LICENSE_PUBLIC_KEY_FILE, "utf8") : void 0);
|
|
21185
21419
|
if (!publicKeyValue) {
|
|
21186
21420
|
throw new Error("APPTRACE_LICENSE_PUBLIC_KEY is not configured.");
|
|
21187
21421
|
}
|
|
@@ -21238,8 +21472,8 @@ function compareVersionData(input2) {
|
|
|
21238
21472
|
}
|
|
21239
21473
|
|
|
21240
21474
|
// src/store.ts
|
|
21241
|
-
var
|
|
21242
|
-
var
|
|
21475
|
+
var import_node_fs7 = __toESM(require("fs"));
|
|
21476
|
+
var import_node_path6 = __toESM(require("path"));
|
|
21243
21477
|
var import_node_module = require("module");
|
|
21244
21478
|
var import_meta = {};
|
|
21245
21479
|
function openSqlite(databasePath) {
|
|
@@ -21492,7 +21726,7 @@ var SqliteStore = class {
|
|
|
21492
21726
|
kind = "sqlite";
|
|
21493
21727
|
db;
|
|
21494
21728
|
constructor(databasePath) {
|
|
21495
|
-
|
|
21729
|
+
import_node_fs7.default.mkdirSync(import_node_path6.default.dirname(databasePath), { recursive: true, mode: 448 });
|
|
21496
21730
|
const db = openSqlite(databasePath);
|
|
21497
21731
|
if (!db) throw new Error("node:sqlite is not available");
|
|
21498
21732
|
this.db = db;
|
|
@@ -21825,11 +22059,11 @@ var JsonStore = class {
|
|
|
21825
22059
|
data;
|
|
21826
22060
|
constructor(databasePath) {
|
|
21827
22061
|
this.filePath = databasePath.replace(/\.sqlite$/i, "") + ".json";
|
|
21828
|
-
|
|
22062
|
+
import_node_fs7.default.mkdirSync(import_node_path6.default.dirname(this.filePath), { recursive: true, mode: 448 });
|
|
21829
22063
|
this.data = this.load();
|
|
21830
22064
|
}
|
|
21831
22065
|
load() {
|
|
21832
|
-
if (!
|
|
22066
|
+
if (!import_node_fs7.default.existsSync(this.filePath)) {
|
|
21833
22067
|
return {
|
|
21834
22068
|
targets: [],
|
|
21835
22069
|
artifacts: [],
|
|
@@ -21841,7 +22075,7 @@ var JsonStore = class {
|
|
|
21841
22075
|
};
|
|
21842
22076
|
}
|
|
21843
22077
|
try {
|
|
21844
|
-
const parsed = JSON.parse(
|
|
22078
|
+
const parsed = JSON.parse(import_node_fs7.default.readFileSync(this.filePath, "utf8"));
|
|
21845
22079
|
return {
|
|
21846
22080
|
targets: parsed.targets ?? [],
|
|
21847
22081
|
artifacts: parsed.artifacts ?? [],
|
|
@@ -21865,8 +22099,8 @@ var JsonStore = class {
|
|
|
21865
22099
|
}
|
|
21866
22100
|
save() {
|
|
21867
22101
|
const temp = `${this.filePath}.${process.pid}.tmp`;
|
|
21868
|
-
|
|
21869
|
-
|
|
22102
|
+
import_node_fs7.default.writeFileSync(temp, JSON.stringify(this.data, null, 2), { mode: 384 });
|
|
22103
|
+
import_node_fs7.default.renameSync(temp, this.filePath);
|
|
21870
22104
|
}
|
|
21871
22105
|
listTargets() {
|
|
21872
22106
|
return [...this.data.targets].sort((a, b) => b.updatedAt.localeCompare(a.updatedAt));
|
|
@@ -22007,44 +22241,44 @@ function createStore(databasePath) {
|
|
|
22007
22241
|
}
|
|
22008
22242
|
|
|
22009
22243
|
// src/workspace.ts
|
|
22010
|
-
var
|
|
22011
|
-
var
|
|
22244
|
+
var import_node_fs8 = __toESM(require("fs"));
|
|
22245
|
+
var import_node_path7 = __toESM(require("path"));
|
|
22012
22246
|
var WorkspaceService = class {
|
|
22013
22247
|
root;
|
|
22014
22248
|
constructor(root) {
|
|
22015
|
-
this.root =
|
|
22016
|
-
|
|
22017
|
-
|
|
22018
|
-
|
|
22249
|
+
this.root = import_node_path7.default.resolve(root);
|
|
22250
|
+
import_node_fs8.default.mkdirSync(this.root, { recursive: true, mode: 448 });
|
|
22251
|
+
import_node_fs8.default.mkdirSync(import_node_path7.default.join(this.root, "targets"), { recursive: true, mode: 448 });
|
|
22252
|
+
import_node_fs8.default.mkdirSync(import_node_path7.default.join(this.root, "tmp"), { recursive: true, mode: 448 });
|
|
22019
22253
|
}
|
|
22020
22254
|
targetDir(target) {
|
|
22021
|
-
return
|
|
22255
|
+
return import_node_path7.default.join(
|
|
22022
22256
|
this.root,
|
|
22023
22257
|
"targets",
|
|
22024
22258
|
`${target.targetRef.platform}-${target.targetRef.sourceId}-${target.slug}-${target.id.slice(0, 8)}`
|
|
22025
22259
|
);
|
|
22026
22260
|
}
|
|
22027
22261
|
artifactDir(target) {
|
|
22028
|
-
return
|
|
22262
|
+
return import_node_path7.default.join(this.targetDir(target), "artifacts");
|
|
22029
22263
|
}
|
|
22030
22264
|
analysisDir(target) {
|
|
22031
|
-
return
|
|
22265
|
+
return import_node_path7.default.join(this.targetDir(target), "analysis");
|
|
22032
22266
|
}
|
|
22033
22267
|
ensureTarget(target) {
|
|
22034
22268
|
const dir = this.targetDir(target);
|
|
22035
22269
|
for (const subdir of ["", "artifacts", "analysis", "reports"]) {
|
|
22036
|
-
|
|
22270
|
+
import_node_fs8.default.mkdirSync(import_node_path7.default.join(dir, subdir), { recursive: true, mode: 448 });
|
|
22037
22271
|
}
|
|
22038
22272
|
}
|
|
22039
22273
|
saveResolvedTarget(target, rawSource) {
|
|
22040
22274
|
this.ensureTarget(target);
|
|
22041
22275
|
const dir = this.targetDir(target);
|
|
22042
|
-
this.writeJson(
|
|
22043
|
-
this.writeJson(
|
|
22276
|
+
this.writeJson(import_node_path7.default.join(dir, "meta.json"), target);
|
|
22277
|
+
this.writeJson(import_node_path7.default.join(dir, "source.json"), rawSource);
|
|
22044
22278
|
}
|
|
22045
22279
|
saveArtifactMetadata(target, artifact, extra = {}) {
|
|
22046
22280
|
const dir = this.targetDir(target);
|
|
22047
|
-
this.writeJson(
|
|
22281
|
+
this.writeJson(import_node_path7.default.join(dir, "artifact.json"), {
|
|
22048
22282
|
schemaVersion: 1,
|
|
22049
22283
|
target: {
|
|
22050
22284
|
id: target.id,
|
|
@@ -22068,7 +22302,7 @@ var WorkspaceService = class {
|
|
|
22068
22302
|
},
|
|
22069
22303
|
...extra
|
|
22070
22304
|
});
|
|
22071
|
-
this.writeJson(
|
|
22305
|
+
this.writeJson(import_node_path7.default.join(dir, "current.json"), {
|
|
22072
22306
|
artifactId: artifact.id,
|
|
22073
22307
|
path: artifact.path,
|
|
22074
22308
|
sha256: artifact.sha256,
|
|
@@ -22076,11 +22310,11 @@ var WorkspaceService = class {
|
|
|
22076
22310
|
});
|
|
22077
22311
|
}
|
|
22078
22312
|
artifactRelativePath(target, filePath) {
|
|
22079
|
-
return
|
|
22313
|
+
return import_node_path7.default.relative(this.root, filePath);
|
|
22080
22314
|
}
|
|
22081
22315
|
resolveStoredPath(relativePath) {
|
|
22082
|
-
const resolved =
|
|
22083
|
-
if (resolved !== this.root && !resolved.startsWith(this.root +
|
|
22316
|
+
const resolved = import_node_path7.default.resolve(this.root, relativePath);
|
|
22317
|
+
if (resolved !== this.root && !resolved.startsWith(this.root + import_node_path7.default.sep)) {
|
|
22084
22318
|
throw new Error(`Path escapes workspace: ${relativePath}`);
|
|
22085
22319
|
}
|
|
22086
22320
|
return resolved;
|
|
@@ -22090,10 +22324,10 @@ var WorkspaceService = class {
|
|
|
22090
22324
|
`);
|
|
22091
22325
|
}
|
|
22092
22326
|
writeText(filePath, value) {
|
|
22093
|
-
|
|
22327
|
+
import_node_fs8.default.mkdirSync(import_node_path7.default.dirname(filePath), { recursive: true, mode: 448 });
|
|
22094
22328
|
const temp = `${filePath}.${process.pid}.${Date.now()}.tmp`;
|
|
22095
|
-
|
|
22096
|
-
|
|
22329
|
+
import_node_fs8.default.writeFileSync(temp, value, { mode: 384 });
|
|
22330
|
+
import_node_fs8.default.renameSync(temp, filePath);
|
|
22097
22331
|
}
|
|
22098
22332
|
};
|
|
22099
22333
|
|
|
@@ -22159,12 +22393,12 @@ async function handle(line) {
|
|
|
22159
22393
|
});
|
|
22160
22394
|
return;
|
|
22161
22395
|
}
|
|
22162
|
-
const workspaceRoot =
|
|
22163
|
-
if (!
|
|
22396
|
+
const workspaceRoot = import_node_path8.default.resolve(request.workspacePath);
|
|
22397
|
+
if (!import_node_fs9.default.existsSync(workspaceRoot)) {
|
|
22164
22398
|
send({ id: request.id, ok: false, error: { code: "WORKSPACE_NOT_FOUND", message: workspaceRoot } });
|
|
22165
22399
|
return;
|
|
22166
22400
|
}
|
|
22167
|
-
const store = createStore(
|
|
22401
|
+
const store = createStore(import_node_path8.default.join(workspaceRoot, "workbench.sqlite"));
|
|
22168
22402
|
try {
|
|
22169
22403
|
if (request.capability === "compare:versions") {
|
|
22170
22404
|
send({
|