@appland/scanner 1.54.1 → 1.57.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +31 -0
- package/built/algorithms/dataStructures/graph/Graph.js +53 -62
- package/built/algorithms/dataStructures/graph/GraphEdge.js +13 -16
- package/built/algorithms/dataStructures/graph/GraphVertex.js +37 -42
- package/built/algorithms/dataStructures/linked-list/LinkedList.js +33 -38
- package/built/algorithms/dataStructures/linked-list/LinkedListNode.js +6 -10
- package/built/algorithms/graph/depth-first-search/index.js +7 -8
- package/built/algorithms/graph/detect-cycle/index.js +15 -16
- package/built/algorithms/utils/Comparator.js +19 -21
- package/built/analyzer/recordSecrets.js +7 -30
- package/built/analyzer/secretsRegexes.js +8 -9
- package/built/appMapIndex.js +18 -20
- package/built/check.js +16 -18
- package/built/checkInstance.js +26 -48
- package/built/cli/ci/command.js +61 -147
- package/built/cli/ci/options.js +0 -1
- package/built/cli/codeVersionArgs.js +0 -1
- package/built/cli/exitCode.js +0 -1
- package/built/cli/fail.js +2 -3
- package/built/cli/merge/command.js +21 -63
- package/built/cli/merge/options.js +0 -1
- package/built/cli/reportUploadURL.js +2 -3
- package/built/cli/resolveAppId.js +34 -85
- package/built/cli/scan/command.js +58 -233
- package/built/cli/scan/formatReport.js +44 -0
- package/built/cli/scan/options.js +0 -1
- package/built/cli/scan/scanner.js +38 -117
- package/built/cli/scan/singleScan.js +80 -0
- package/built/cli/scan/watchScan.js +84 -0
- package/built/cli/scan.js +39 -132
- package/built/cli/scanArgs.js +2 -4
- package/built/cli/scanOptions.js +0 -1
- package/built/cli/updateCommitStatus.js +10 -47
- package/built/cli/upload/command.js +21 -65
- package/built/cli/upload/options.js +0 -1
- package/built/cli/upload/pruneAppMap.js +16 -0
- package/built/cli/upload.js +91 -172
- package/built/cli/validateFile.js +13 -48
- package/built/cli.js +34 -21
- package/built/configuration/configurationProvider.js +148 -227
- package/built/configuration/schema/options.json +76 -76
- package/built/configuration/types/checkConfig.js +0 -1
- package/built/configuration/types/configuration.js +0 -1
- package/built/configuration/types/matchEventConfig.js +0 -1
- package/built/configuration/types/matchPatternConfig.js +0 -1
- package/built/database/index.js +33 -127
- package/built/database/visit.js +16 -66
- package/built/errors.js +4 -30
- package/built/eventUtil.js +10 -35
- package/built/findings.js +3 -4
- package/built/integration/appland/app/exists.js +33 -76
- package/built/integration/appland/app/listFindingStatus.js +5 -38
- package/built/integration/appland/appMap/create.js +38 -89
- package/built/integration/appland/location.js +0 -1
- package/built/integration/appland/mapset/create.js +34 -85
- package/built/integration/appland/retry.js +10 -11
- package/built/integration/appland/retryOptions.js +0 -1
- package/built/integration/appland/scannerJob/create.js +34 -84
- package/built/integration/appland/scannerJob/merge.js +28 -74
- package/built/integration/appland/scannerJob.js +0 -1
- package/built/integration/github/commitStatus.js +3 -4
- package/built/integration/vars.js +1 -2
- package/built/openapi/index.js +39 -83
- package/built/report/appMapMetadata.js +0 -1
- package/built/report/findingSummary.js +0 -1
- package/built/report/findingsReport.js +14 -16
- package/built/report/scanResults.js +18 -45
- package/built/report/scanSummary.js +0 -1
- package/built/report/summaryReport.js +12 -13
- package/built/ruleChecker.js +146 -297
- package/built/rules/authzBeforeAuthn.js +25 -59
- package/built/rules/circularDependency.js +69 -101
- package/built/rules/deserializationOfUntrustedData.js +29 -63
- package/built/rules/execOfUntrustedCommand.js +28 -62
- package/built/rules/http-500/metadata.js +0 -1
- package/built/rules/http-500/rule.js +2 -3
- package/built/rules/illegalPackageDependency.js +16 -18
- package/built/rules/incompatibleHttpClientRequest.js +30 -69
- package/built/rules/insecureCompare.js +12 -13
- package/built/rules/jobNotCancelled.js +13 -45
- package/built/rules/lib/hasParameterOrReceiver.js +4 -7
- package/built/rules/lib/matchEvent.js +12 -13
- package/built/rules/lib/matchPattern.js +6 -7
- package/built/rules/lib/metadata.js +0 -1
- package/built/rules/lib/parseRuleDescription.js +5 -6
- package/built/rules/lib/precedingEvents.js +7 -75
- package/built/rules/lib/rpcWithoutProtection.js +5 -28
- package/built/rules/lib/sanitizesData.js +0 -1
- package/built/rules/lib/util.js +48 -25
- package/built/rules/logoutWithoutSessionReset.js +24 -58
- package/built/rules/missingAuthentication.js +28 -28
- package/built/rules/missingContentType.js +8 -9
- package/built/rules/nPlusOneQuery.js +35 -87
- package/built/rules/queryFromInvalidPackage.js +17 -19
- package/built/rules/queryFromView.js +13 -16
- package/built/rules/rpcWithoutCircuitBreaker.js +14 -84
- package/built/rules/saveWithoutValidation.js +8 -9
- package/built/rules/secretInLog.js +30 -93
- package/built/rules/slowFunctionCall.js +16 -20
- package/built/rules/slowHttpServerRequest.js +9 -11
- package/built/rules/slowQuery.js +9 -12
- package/built/rules/tooManyJoins.js +26 -51
- package/built/rules/tooManyUpdates.js +25 -105
- package/built/rules/unbatchedMaterializedQuery.js +26 -30
- package/built/rules/updateInGetRequest.js +30 -45
- package/built/scope/commandScope.js +24 -144
- package/built/scope/httpClientRequestScope.js +11 -98
- package/built/scope/httpServerRequestScope.js +11 -98
- package/built/scope/rootScope.js +11 -98
- package/built/scope/scopeImpl.js +10 -82
- package/built/scope/scopeIterator.js +6 -10
- package/built/scope/sqlTransactionScope.js +24 -122
- package/built/sqlWarning.js +9 -35
- package/built/telemetry.js +215 -0
- package/built/wellKnownLabels.js +0 -1
- package/package.json +10 -4
- package/built/algorithms/dataStructures/graph/Graph.js.map +0 -1
- package/built/algorithms/dataStructures/graph/GraphEdge.js.map +0 -1
- package/built/algorithms/dataStructures/graph/GraphVertex.js.map +0 -1
- package/built/algorithms/dataStructures/linked-list/LinkedList.js.map +0 -1
- package/built/algorithms/dataStructures/linked-list/LinkedListNode.js.map +0 -1
- package/built/algorithms/graph/depth-first-search/index.js.map +0 -1
- package/built/algorithms/graph/detect-cycle/index.js.map +0 -1
- package/built/algorithms/utils/Comparator.js.map +0 -1
- package/built/analyzer/recordSecrets.js.map +0 -1
- package/built/analyzer/secretsRegexes.js.map +0 -1
- package/built/appMapIndex.js.map +0 -1
- package/built/check.js.map +0 -1
- package/built/checkInstance.js.map +0 -1
- package/built/cli/ci/command.js.map +0 -1
- package/built/cli/ci/options.js.map +0 -1
- package/built/cli/codeVersionArgs.js.map +0 -1
- package/built/cli/exitCode.js.map +0 -1
- package/built/cli/fail.js.map +0 -1
- package/built/cli/merge/command.js.map +0 -1
- package/built/cli/merge/options.js.map +0 -1
- package/built/cli/reportUploadURL.js.map +0 -1
- package/built/cli/resolveAppId.js.map +0 -1
- package/built/cli/scan/command.js.map +0 -1
- package/built/cli/scan/options.js.map +0 -1
- package/built/cli/scan/scanner.js.map +0 -1
- package/built/cli/scan.js.map +0 -1
- package/built/cli/scanArgs.js.map +0 -1
- package/built/cli/scanOptions.js.map +0 -1
- package/built/cli/updateCommitStatus.js.map +0 -1
- package/built/cli/upload/command.js.map +0 -1
- package/built/cli/upload/options.js.map +0 -1
- package/built/cli/upload.js.map +0 -1
- package/built/cli/validateFile.js.map +0 -1
- package/built/cli.js.map +0 -1
- package/built/configuration/configurationProvider.js.map +0 -1
- package/built/configuration/types/checkConfig.js.map +0 -1
- package/built/configuration/types/configuration.js.map +0 -1
- package/built/configuration/types/matchEventConfig.js.map +0 -1
- package/built/configuration/types/matchPatternConfig.js.map +0 -1
- package/built/database/index.js.map +0 -1
- package/built/database/visit.js.map +0 -1
- package/built/errors.js.map +0 -1
- package/built/eventUtil.js.map +0 -1
- package/built/findings.js.map +0 -1
- package/built/integration/appland/app/exists.js.map +0 -1
- package/built/integration/appland/app/listFindingStatus.js.map +0 -1
- package/built/integration/appland/appMap/create.js.map +0 -1
- package/built/integration/appland/location.js.map +0 -1
- package/built/integration/appland/mapset/create.js.map +0 -1
- package/built/integration/appland/retry.js.map +0 -1
- package/built/integration/appland/retryOptions.js.map +0 -1
- package/built/integration/appland/scannerJob/create.js.map +0 -1
- package/built/integration/appland/scannerJob/merge.js.map +0 -1
- package/built/integration/appland/scannerJob.js.map +0 -1
- package/built/integration/github/commitStatus.js.map +0 -1
- package/built/integration/vars.js.map +0 -1
- package/built/openapi/index.js.map +0 -1
- package/built/openapi/method.js +0 -120
- package/built/openapi/method.js.map +0 -1
- package/built/openapi/model.js +0 -49
- package/built/openapi/model.js.map +0 -1
- package/built/openapi/path.js +0 -36
- package/built/openapi/path.js.map +0 -1
- package/built/openapi/provider.js +0 -133
- package/built/openapi/provider.js.map +0 -1
- package/built/openapi/response.js +0 -59
- package/built/openapi/response.js.map +0 -1
- package/built/openapi/rpcRequest.js +0 -130
- package/built/openapi/rpcRequest.js.map +0 -1
- package/built/openapi/schema.js +0 -42
- package/built/openapi/schema.js.map +0 -1
- package/built/openapi/securitySchemes.js +0 -32
- package/built/openapi/securitySchemes.js.map +0 -1
- package/built/openapi/statusCodes.js +0 -68
- package/built/openapi/statusCodes.js.map +0 -1
- package/built/openapi/util.js +0 -91
- package/built/openapi/util.js.map +0 -1
- package/built/report/appMapMetadata.js.map +0 -1
- package/built/report/findingSummary.js.map +0 -1
- package/built/report/findingsReport.js.map +0 -1
- package/built/report/scanResults.js.map +0 -1
- package/built/report/scanSummary.js.map +0 -1
- package/built/report/summaryReport.js.map +0 -1
- package/built/ruleChecker.js.map +0 -1
- package/built/rules/authzBeforeAuthn.js.map +0 -1
- package/built/rules/circularDependency.js.map +0 -1
- package/built/rules/deserializationOfUntrustedData.js.map +0 -1
- package/built/rules/execOfUntrustedCommand.js.map +0 -1
- package/built/rules/http-500/metadata.js.map +0 -1
- package/built/rules/http-500/rule.js.map +0 -1
- package/built/rules/illegalPackageDependency.js.map +0 -1
- package/built/rules/incompatibleHttpClientRequest.js.map +0 -1
- package/built/rules/insecureCompare.js.map +0 -1
- package/built/rules/jobNotCancelled.js.map +0 -1
- package/built/rules/lib/hasParameterOrReceiver.js.map +0 -1
- package/built/rules/lib/matchEvent.js.map +0 -1
- package/built/rules/lib/matchPattern.js.map +0 -1
- package/built/rules/lib/metadata.js.map +0 -1
- package/built/rules/lib/parseRuleDescription.js.map +0 -1
- package/built/rules/lib/precedingEvents.js.map +0 -1
- package/built/rules/lib/rpcWithoutProtection.js.map +0 -1
- package/built/rules/lib/sanitizesData.js.map +0 -1
- package/built/rules/lib/util.js.map +0 -1
- package/built/rules/logoutWithoutSessionReset.js.map +0 -1
- package/built/rules/missingAuthentication.js.map +0 -1
- package/built/rules/missingContentType.js.map +0 -1
- package/built/rules/nPlusOneQuery.js.map +0 -1
- package/built/rules/queryFromInvalidPackage.js.map +0 -1
- package/built/rules/queryFromView.js.map +0 -1
- package/built/rules/rpcWithoutCircuitBreaker.js.map +0 -1
- package/built/rules/saveWithoutValidation.js.map +0 -1
- package/built/rules/secretInLog.js.map +0 -1
- package/built/rules/slowFunctionCall.js.map +0 -1
- package/built/rules/slowHttpServerRequest.js.map +0 -1
- package/built/rules/slowQuery.js.map +0 -1
- package/built/rules/tooManyJoins.js.map +0 -1
- package/built/rules/tooManyUpdates.js.map +0 -1
- package/built/rules/unbatchedMaterializedQuery.js.map +0 -1
- package/built/rules/updateInGetRequest.js.map +0 -1
- package/built/scope/commandScope.js.map +0 -1
- package/built/scope/httpClientRequestScope.js.map +0 -1
- package/built/scope/httpServerRequestScope.js.map +0 -1
- package/built/scope/rootScope.js.map +0 -1
- package/built/scope/scopeImpl.js.map +0 -1
- package/built/scope/scopeIterator.js.map +0 -1
- package/built/scope/sqlTransactionScope.js.map +0 -1
- package/built/sqlWarning.js.map +0 -1
- package/built/wellKnownLabels.js.map +0 -1
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -19,88 +8,49 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
19
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
9
|
});
|
|
21
10
|
};
|
|
22
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
-
function step(op) {
|
|
27
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (_) try {
|
|
29
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
-
switch (op[0]) {
|
|
32
|
-
case 0: case 1: t = op; break;
|
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
-
default:
|
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
-
if (t[2]) _.ops.pop();
|
|
42
|
-
_.trys.pop(); continue;
|
|
43
|
-
}
|
|
44
|
-
op = body.call(thisArg, _);
|
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
11
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
13
|
};
|
|
52
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
15
|
exports.create = void 0;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
function create(scanResults, mapsetId, appMapUUIDByFileName, createOptions, retryOptions) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
16
|
+
const url_1 = require("url");
|
|
17
|
+
const src_1 = require("@appland/client/dist/src");
|
|
18
|
+
const util_1 = require("../../../rules/lib/util");
|
|
19
|
+
const retry_1 = __importDefault(require("../retry"));
|
|
20
|
+
function create(scanResults, mapsetId, appMapUUIDByFileName, createOptions = {}, retryOptions = {}) {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
if ((0, util_1.verbose)())
|
|
23
|
+
console.warn('Uploading findings');
|
|
24
|
+
let uploadURL;
|
|
25
|
+
let request;
|
|
26
|
+
const retrier = (0, retry_1.default)(`Create scanner job`, retryOptions, makeRequest);
|
|
62
27
|
function makeRequest() {
|
|
63
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
headers: __assign({ 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) }, request.headers),
|
|
76
|
-
}, resolve);
|
|
77
|
-
req.on('error', (0, src_1.retryOnError)(retrier, resolve, reject));
|
|
78
|
-
req.write(payload);
|
|
79
|
-
req.end();
|
|
80
|
-
}).then((0, src_1.retryOn503)(retrier))];
|
|
81
|
-
}
|
|
82
|
-
});
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
const payload = JSON.stringify(Object.assign({ scan_results: scanResults, mapset: mapsetId, appmap_uuid_by_file_name: appMapUUIDByFileName }, { merge_key: createOptions.mergeKey }));
|
|
30
|
+
request = yield (0, src_1.buildRequest)('api/scanner_jobs');
|
|
31
|
+
return new Promise((resolve, reject) => {
|
|
32
|
+
const req = request.requestFunction(request.url, {
|
|
33
|
+
method: 'POST',
|
|
34
|
+
headers: Object.assign({ 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) }, request.headers),
|
|
35
|
+
}, resolve);
|
|
36
|
+
req.on('error', (0, src_1.retryOnError)(retrier, resolve, reject));
|
|
37
|
+
req.write(payload);
|
|
38
|
+
req.end();
|
|
39
|
+
}).then((0, src_1.retryOn503)(retrier));
|
|
83
40
|
});
|
|
84
41
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
return (0, src_1.reportJSON)(response);
|
|
97
|
-
})
|
|
98
|
-
.then(function (uploadResponse) {
|
|
99
|
-
uploadResponse.url = uploadURL;
|
|
100
|
-
return uploadResponse;
|
|
101
|
-
})];
|
|
42
|
+
return makeRequest()
|
|
43
|
+
.then(src_1.handleError)
|
|
44
|
+
.then((response) => {
|
|
45
|
+
if (response.headers.location) {
|
|
46
|
+
uploadURL = new url_1.URL(response.headers.location, request.url.href);
|
|
47
|
+
}
|
|
48
|
+
return (0, src_1.reportJSON)(response);
|
|
49
|
+
})
|
|
50
|
+
.then((uploadResponse) => {
|
|
51
|
+
uploadResponse.url = uploadURL;
|
|
52
|
+
return uploadResponse;
|
|
102
53
|
});
|
|
103
54
|
});
|
|
104
55
|
}
|
|
105
56
|
exports.create = create;
|
|
106
|
-
//# sourceMappingURL=create.js.map
|
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -19,74 +8,39 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
19
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
9
|
});
|
|
21
10
|
};
|
|
22
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
-
function step(op) {
|
|
27
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (_) try {
|
|
29
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
-
switch (op[0]) {
|
|
32
|
-
case 0: case 1: t = op; break;
|
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
-
default:
|
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
-
if (t[2]) _.ops.pop();
|
|
42
|
-
_.trys.pop(); continue;
|
|
43
|
-
}
|
|
44
|
-
op = body.call(thisArg, _);
|
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
12
|
exports.merge = void 0;
|
|
51
|
-
|
|
52
|
-
|
|
13
|
+
const src_1 = require("@appland/client/dist/src");
|
|
14
|
+
const url_1 = require("url");
|
|
53
15
|
function merge(appId, mergeKey) {
|
|
54
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
})
|
|
76
|
-
.then(src_1.handleError)
|
|
77
|
-
.then(function (response) {
|
|
78
|
-
if (response.headers.location) {
|
|
79
|
-
uploadURL = new url_1.URL(response.headers.location, request.url.href);
|
|
80
|
-
}
|
|
81
|
-
return (0, src_1.reportJSON)(response);
|
|
82
|
-
})
|
|
83
|
-
.then(function (uploadResponse) {
|
|
84
|
-
uploadResponse.url = uploadURL;
|
|
85
|
-
return uploadResponse;
|
|
86
|
-
})];
|
|
16
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
console.log(`Merging scan results in app ${appId} with merge key ${mergeKey}`);
|
|
18
|
+
const payload = JSON.stringify({
|
|
19
|
+
app: appId,
|
|
20
|
+
merge_key: mergeKey,
|
|
21
|
+
});
|
|
22
|
+
const request = yield (0, src_1.buildRequest)('api/scanner_jobs/merge');
|
|
23
|
+
let uploadURL;
|
|
24
|
+
return new Promise((resolve, reject) => {
|
|
25
|
+
const req = request.requestFunction(request.url, {
|
|
26
|
+
method: 'POST',
|
|
27
|
+
headers: Object.assign({ 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) }, request.headers),
|
|
28
|
+
}, resolve);
|
|
29
|
+
req.on('error', reject);
|
|
30
|
+
req.write(payload);
|
|
31
|
+
req.end();
|
|
32
|
+
})
|
|
33
|
+
.then(src_1.handleError)
|
|
34
|
+
.then((response) => {
|
|
35
|
+
if (response.headers.location) {
|
|
36
|
+
uploadURL = new url_1.URL(response.headers.location, request.url.href);
|
|
87
37
|
}
|
|
38
|
+
return (0, src_1.reportJSON)(response);
|
|
39
|
+
})
|
|
40
|
+
.then((uploadResponse) => {
|
|
41
|
+
uploadResponse.url = uploadURL;
|
|
42
|
+
return uploadResponse;
|
|
88
43
|
});
|
|
89
44
|
});
|
|
90
45
|
}
|
|
91
46
|
exports.merge = merge;
|
|
92
|
-
//# sourceMappingURL=merge.js.map
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
3
|
+
const vars_1 = require("../vars");
|
|
4
4
|
function postCommitStatus(state, description) {
|
|
5
5
|
(0, vars_1.validateToken)();
|
|
6
6
|
(0, vars_1.validateRepo)();
|
|
7
7
|
(0, vars_1.validateOwner)();
|
|
8
8
|
(0, vars_1.validateSha)();
|
|
9
9
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
const octokat = require('octokat');
|
|
11
|
+
const octo = new octokat({ token: (0, vars_1.token)() });
|
|
12
12
|
return octo.repos((0, vars_1.owner)(), (0, vars_1.repo)()).statuses((0, vars_1.sha)()).create({
|
|
13
13
|
state: state,
|
|
14
14
|
context: 'appland/scanner',
|
|
@@ -16,4 +16,3 @@ function postCommitStatus(state, description) {
|
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
18
|
exports.default = postCommitStatus;
|
|
19
|
-
//# sourceMappingURL=commitStatus.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.validatePullRequestNumber = exports.validateSha = exports.validateRepo = exports.validateOwner = exports.validateToken = exports.pullRequestNumber = exports.repo = exports.sha = exports.owner = exports.token = exports.branch = void 0;
|
|
4
|
-
|
|
4
|
+
const errors_1 = require("../errors");
|
|
5
5
|
function token() {
|
|
6
6
|
return process.env.GH_STATUS_TOKEN || process.env.GH_TOKEN;
|
|
7
7
|
}
|
|
@@ -74,4 +74,3 @@ function validateRepo() {
|
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
exports.validateRepo = validateRepo;
|
|
77
|
-
//# sourceMappingURL=vars.js.map
|
package/built/openapi/index.js
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
17
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
18
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -8,93 +22,35 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
22
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
23
|
});
|
|
10
24
|
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
25
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
27
|
};
|
|
41
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports.breakingChanges =
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
var forClientRequest = function (event) {
|
|
52
|
-
var rpcRequest = (0, rpcRequest_1.rpcRequestForEvent)(event);
|
|
53
|
-
if (!rpcRequest) {
|
|
54
|
-
return;
|
|
29
|
+
exports.breakingChanges = void 0;
|
|
30
|
+
const fs_1 = require("fs");
|
|
31
|
+
const openapi_diff_1 = __importDefault(require("openapi-diff"));
|
|
32
|
+
const util_1 = require("../rules/lib/util");
|
|
33
|
+
__exportStar(require("@appland/openapi"), exports);
|
|
34
|
+
const breakingChanges = (schemaHead, schemaBase) => __awaiter(void 0, void 0, void 0, function* () {
|
|
35
|
+
if ((0, util_1.verbose)()) {
|
|
36
|
+
(0, fs_1.writeFileSync)('openapi_head.json', JSON.stringify(schemaHead, null, 2));
|
|
37
|
+
(0, fs_1.writeFileSync)('openapi_base.json', JSON.stringify(schemaBase, null, 2));
|
|
55
38
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}); };
|
|
68
|
-
exports.forURL = forURL;
|
|
69
|
-
var breakingChanges = function (schemaHead, schemaBase) { return __awaiter(void 0, void 0, void 0, function () {
|
|
70
|
-
var result;
|
|
71
|
-
return __generator(this, function (_a) {
|
|
72
|
-
switch (_a.label) {
|
|
73
|
-
case 0:
|
|
74
|
-
if ((0, util_1.verbose)()) {
|
|
75
|
-
(0, fs_1.writeFileSync)('openapi_head.json', JSON.stringify(schemaHead, null, 2));
|
|
76
|
-
(0, fs_1.writeFileSync)('openapi_base.json', JSON.stringify(schemaBase, null, 2));
|
|
77
|
-
}
|
|
78
|
-
return [4 /*yield*/, openapi_diff_1.default.diffSpecs({
|
|
79
|
-
sourceSpec: {
|
|
80
|
-
content: JSON.stringify(schemaHead),
|
|
81
|
-
location: 'openapi_head.json',
|
|
82
|
-
format: 'openapi3',
|
|
83
|
-
},
|
|
84
|
-
destinationSpec: {
|
|
85
|
-
content: JSON.stringify(schemaBase),
|
|
86
|
-
location: 'openapi_base.json',
|
|
87
|
-
format: 'openapi3',
|
|
88
|
-
},
|
|
89
|
-
})];
|
|
90
|
-
case 1:
|
|
91
|
-
result = _a.sent();
|
|
92
|
-
if (result.breakingDifferencesFound) {
|
|
93
|
-
return [2 /*return*/, result.breakingDifferences];
|
|
94
|
-
}
|
|
95
|
-
return [2 /*return*/, []];
|
|
96
|
-
}
|
|
39
|
+
const result = yield openapi_diff_1.default.diffSpecs({
|
|
40
|
+
sourceSpec: {
|
|
41
|
+
content: JSON.stringify(schemaHead),
|
|
42
|
+
location: 'openapi_head.json',
|
|
43
|
+
format: 'openapi3',
|
|
44
|
+
},
|
|
45
|
+
destinationSpec: {
|
|
46
|
+
content: JSON.stringify(schemaBase),
|
|
47
|
+
location: 'openapi_base.json',
|
|
48
|
+
format: 'openapi3',
|
|
49
|
+
},
|
|
97
50
|
});
|
|
98
|
-
|
|
51
|
+
if (result.breakingDifferencesFound) {
|
|
52
|
+
return result.breakingDifferences;
|
|
53
|
+
}
|
|
54
|
+
return [];
|
|
55
|
+
});
|
|
99
56
|
exports.breakingChanges = breakingChanges;
|
|
100
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -3,10 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
function writeln(text) {
|
|
9
|
-
if (text === void 0) { text = ''; }
|
|
6
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
7
|
+
const util_1 = require("../rules/lib/util");
|
|
8
|
+
function writeln(text = '') {
|
|
10
9
|
process.stdout.write(text);
|
|
11
10
|
process.stdout.write('\n');
|
|
12
11
|
}
|
|
@@ -15,27 +14,26 @@ function default_1(findings, appMapMetadata, ide) {
|
|
|
15
14
|
return;
|
|
16
15
|
}
|
|
17
16
|
console.log();
|
|
18
|
-
findings.forEach(
|
|
19
|
-
|
|
17
|
+
findings.forEach((finding) => {
|
|
18
|
+
const filePath = ide && finding.appMapFile
|
|
20
19
|
? (0, util_1.ideLink)(finding.appMapFile, ide, finding.event.id)
|
|
21
20
|
: finding.appMapFile;
|
|
22
|
-
|
|
21
|
+
let eventMsg = `\tEvent:\t${finding.event.id} - ${finding.event.toString()}`;
|
|
23
22
|
if (finding.event.elapsedTime !== undefined) {
|
|
24
|
-
eventMsg +=
|
|
23
|
+
eventMsg += ` (${finding.event.elapsedTime}s)`;
|
|
25
24
|
}
|
|
26
|
-
|
|
25
|
+
const message = finding.message;
|
|
27
26
|
writeln(chalk_1.default.magenta(message));
|
|
28
|
-
writeln(
|
|
29
|
-
writeln(
|
|
30
|
-
writeln(
|
|
27
|
+
writeln(`\tLink:\t${chalk_1.default.blue(filePath)}`);
|
|
28
|
+
writeln(`\tRule:\t${finding.ruleId}`);
|
|
29
|
+
writeln(`\tAppMap name:\t${appMapMetadata[finding.appMapFile].name}`);
|
|
31
30
|
writeln(eventMsg);
|
|
32
|
-
writeln(
|
|
31
|
+
writeln(`\tScope:\t${finding.scope.id} - ${finding.scope.toString()}`);
|
|
33
32
|
if (finding.stack.length > 0) {
|
|
34
|
-
writeln(
|
|
35
|
-
finding.stack.forEach(
|
|
33
|
+
writeln(`\tStack trace:`);
|
|
34
|
+
finding.stack.forEach((frame) => console.log(`\t\t${frame}`));
|
|
36
35
|
}
|
|
37
36
|
writeln();
|
|
38
37
|
});
|
|
39
38
|
}
|
|
40
39
|
exports.default = default_1;
|
|
41
|
-
//# sourceMappingURL=findingsReport.js.map
|
|
@@ -1,54 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
3
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
4
|
-
if (!m) return o;
|
|
5
|
-
var i = m.call(o), r, ar = [], e;
|
|
6
|
-
try {
|
|
7
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
8
|
-
}
|
|
9
|
-
catch (error) { e = { error: error }; }
|
|
10
|
-
finally {
|
|
11
|
-
try {
|
|
12
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
13
|
-
}
|
|
14
|
-
finally { if (e) throw e.error; }
|
|
15
|
-
}
|
|
16
|
-
return ar;
|
|
17
|
-
};
|
|
18
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
19
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
20
|
-
if (ar || !(i in from)) {
|
|
21
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
22
|
-
ar[i] = from[i];
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
26
|
-
};
|
|
27
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
3
|
exports.ScanResults = void 0;
|
|
29
4
|
function collectMetadata(metadata) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
5
|
+
const uniqueApps = new Set();
|
|
6
|
+
const uniqueLabels = new Set();
|
|
7
|
+
const uniqueClients = new Set();
|
|
8
|
+
const uniqueFrameworks = new Set();
|
|
9
|
+
const uniqueGit = new Set();
|
|
10
|
+
const uniqueLanguages = new Set();
|
|
11
|
+
const uniqueRecorders = new Set();
|
|
12
|
+
const uniqueExceptions = new Set();
|
|
38
13
|
function pushDistinctItem(unique, members, item) {
|
|
39
14
|
if (item === undefined) {
|
|
40
15
|
return;
|
|
41
16
|
}
|
|
42
|
-
|
|
17
|
+
const key = JSON.stringify(item);
|
|
43
18
|
if (!unique.has(key)) {
|
|
44
19
|
unique.add(key);
|
|
45
20
|
members.push(item);
|
|
46
21
|
}
|
|
47
22
|
}
|
|
48
23
|
function pushDistinctItems(unique, members, items) {
|
|
49
|
-
(items || []).forEach(
|
|
24
|
+
(items || []).forEach((item) => pushDistinctItem(unique, members, item));
|
|
50
25
|
}
|
|
51
|
-
return metadata.reduce(
|
|
26
|
+
return metadata.reduce((memo, appMapMetadata) => {
|
|
52
27
|
pushDistinctItem(uniqueApps, memo.apps, appMapMetadata.app);
|
|
53
28
|
pushDistinctItems(uniqueLabels, memo.labels, appMapMetadata.labels);
|
|
54
29
|
pushDistinctItem(uniqueClients, memo.clients, appMapMetadata.client);
|
|
@@ -74,8 +49,8 @@ function collectMetadata(metadata) {
|
|
|
74
49
|
* ScannerSummary summarizes the results of the entire scan.
|
|
75
50
|
* It's used for printing a user-friendly summary report, it's not used for machine-readable program output.
|
|
76
51
|
*/
|
|
77
|
-
|
|
78
|
-
|
|
52
|
+
class ScanResults {
|
|
53
|
+
constructor(configuration, appMapMetadata, findings, checks) {
|
|
79
54
|
this.configuration = configuration;
|
|
80
55
|
this.appMapMetadata = appMapMetadata;
|
|
81
56
|
this.findings = findings;
|
|
@@ -83,16 +58,14 @@ var ScanResults = /** @class */ (function () {
|
|
|
83
58
|
this.summary = {
|
|
84
59
|
numAppMaps: Object.keys(appMapMetadata).length,
|
|
85
60
|
numChecks: checks.length * Object.keys(appMapMetadata).length,
|
|
86
|
-
rules:
|
|
87
|
-
ruleLabels:
|
|
61
|
+
rules: [...new Set(checks.map((check) => check.rule.id))].sort(),
|
|
62
|
+
ruleLabels: [...new Set(checks.map((check) => check.rule.labels || []).flat())].sort(),
|
|
88
63
|
numFindings: findings.length,
|
|
89
64
|
appMapMetadata: collectMetadata(Object.values(appMapMetadata)),
|
|
90
65
|
};
|
|
91
66
|
}
|
|
92
|
-
|
|
67
|
+
withFindings(findings) {
|
|
93
68
|
return new ScanResults(this.configuration, this.appMapMetadata, findings, this.checks);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
}());
|
|
69
|
+
}
|
|
70
|
+
}
|
|
97
71
|
exports.ScanResults = ScanResults;
|
|
98
|
-
//# sourceMappingURL=scanResults.js.map
|