@appland/scanner 1.56.0 → 1.59.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 +29 -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 +19 -21
- package/built/check.js +17 -21
- package/built/checkInstance.js +26 -48
- package/built/cli/ci/command.js +61 -156
- 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 +52 -94
- package/built/cli/scan/formatReport.js +16 -89
- package/built/cli/scan/options.js +0 -1
- package/built/cli/scan/scanner.js +38 -117
- package/built/cli/scan/singleScan.js +61 -109
- package/built/cli/scan/watchScan.js +53 -85
- package/built/cli/scan.js +39 -132
- package/built/cli/scanArgs.js +0 -1
- package/built/cli/scanOptions.js +0 -1
- package/built/cli/updateCommitStatus.js +10 -47
- package/built/cli/upload/command.js +20 -64
- package/built/cli/upload/options.js +0 -1
- package/built/cli/upload/pruneAppMap.js +20 -0
- package/built/cli/upload.js +93 -172
- package/built/cli/validateFile.js +13 -52
- package/built/cli.js +34 -21
- package/built/configuration/configurationProvider.js +151 -233
- 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 +35 -128
- package/built/database/visit.js +20 -68
- 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 +3 -36
- 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 +50 -72
- 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 +34 -73
- 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 +29 -92
- 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 +7 -3
- 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/formatReport.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/singleScan.js.map +0 -1
- package/built/cli/scan/watchScan.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,81 +1,61 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ScanResults = void 0;
|
|
4
|
+
class DistinctItems {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.members = {};
|
|
8
7
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
push(...items) {
|
|
9
|
+
for (const item of items) {
|
|
10
|
+
if (item === undefined)
|
|
11
|
+
continue;
|
|
12
|
+
const key = JSON.stringify(item);
|
|
13
|
+
if (!(key in this.members))
|
|
14
|
+
this.members[key] = item;
|
|
13
15
|
}
|
|
14
|
-
finally { if (e) throw e.error; }
|
|
15
16
|
}
|
|
16
|
-
|
|
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
|
-
}
|
|
17
|
+
[Symbol.iterator]() {
|
|
18
|
+
return Object.values(this.members)[Symbol.iterator]();
|
|
24
19
|
}
|
|
25
|
-
|
|
26
|
-
};
|
|
27
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
exports.ScanResults = void 0;
|
|
20
|
+
}
|
|
29
21
|
function collectMetadata(metadata) {
|
|
30
|
-
var
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
function pushDistinctItems(unique, members, items) {
|
|
49
|
-
(items || []).forEach(function (item) { return pushDistinctItem(unique, members, item); });
|
|
22
|
+
var _a, _b;
|
|
23
|
+
const uniqueApps = new DistinctItems();
|
|
24
|
+
const uniqueLabels = new DistinctItems();
|
|
25
|
+
const uniqueClients = new DistinctItems();
|
|
26
|
+
const uniqueFrameworks = new DistinctItems();
|
|
27
|
+
const uniqueGit = new DistinctItems();
|
|
28
|
+
const uniqueLanguages = new DistinctItems();
|
|
29
|
+
const uniqueRecorders = new DistinctItems();
|
|
30
|
+
const uniqueExceptions = new DistinctItems();
|
|
31
|
+
for (const item of metadata) {
|
|
32
|
+
uniqueApps.push(item.app);
|
|
33
|
+
uniqueLabels.push(...((_a = item.labels) !== null && _a !== void 0 ? _a : []));
|
|
34
|
+
uniqueClients.push(item.client);
|
|
35
|
+
uniqueFrameworks.push(...((_b = item.frameworks) !== null && _b !== void 0 ? _b : []));
|
|
36
|
+
uniqueGit.push(item.git);
|
|
37
|
+
uniqueLanguages.push(item.language);
|
|
38
|
+
uniqueRecorders.push(item.recorder);
|
|
39
|
+
uniqueExceptions.push(item.exception);
|
|
50
40
|
}
|
|
51
|
-
return
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
pushDistinctItem(uniqueExceptions, memo.recorders, appMapMetadata.exception);
|
|
60
|
-
return memo;
|
|
61
|
-
}, {
|
|
62
|
-
labels: [],
|
|
63
|
-
apps: [],
|
|
64
|
-
clients: [],
|
|
65
|
-
frameworks: [],
|
|
66
|
-
git: [],
|
|
67
|
-
languages: [],
|
|
68
|
-
recorders: [],
|
|
41
|
+
return {
|
|
42
|
+
labels: [...uniqueLabels],
|
|
43
|
+
apps: [...uniqueApps],
|
|
44
|
+
clients: [...uniqueClients],
|
|
45
|
+
frameworks: [...uniqueFrameworks],
|
|
46
|
+
git: [...uniqueGit],
|
|
47
|
+
languages: [...uniqueLanguages],
|
|
48
|
+
recorders: [...uniqueRecorders],
|
|
69
49
|
testStatuses: [],
|
|
70
|
-
exceptions: [],
|
|
71
|
-
}
|
|
50
|
+
exceptions: [...uniqueExceptions],
|
|
51
|
+
};
|
|
72
52
|
}
|
|
73
53
|
/**
|
|
74
54
|
* ScannerSummary summarizes the results of the entire scan.
|
|
75
55
|
* It's used for printing a user-friendly summary report, it's not used for machine-readable program output.
|
|
76
56
|
*/
|
|
77
|
-
|
|
78
|
-
|
|
57
|
+
class ScanResults {
|
|
58
|
+
constructor(configuration, appMapMetadata, findings, checks) {
|
|
79
59
|
this.configuration = configuration;
|
|
80
60
|
this.appMapMetadata = appMapMetadata;
|
|
81
61
|
this.findings = findings;
|
|
@@ -83,16 +63,14 @@ var ScanResults = /** @class */ (function () {
|
|
|
83
63
|
this.summary = {
|
|
84
64
|
numAppMaps: Object.keys(appMapMetadata).length,
|
|
85
65
|
numChecks: checks.length * Object.keys(appMapMetadata).length,
|
|
86
|
-
rules:
|
|
87
|
-
ruleLabels:
|
|
66
|
+
rules: [...new Set(checks.map((check) => check.rule.id))].sort(),
|
|
67
|
+
ruleLabels: [...new Set(checks.map((check) => check.rule.labels || []).flat())].sort(),
|
|
88
68
|
numFindings: findings.length,
|
|
89
69
|
appMapMetadata: collectMetadata(Object.values(appMapMetadata)),
|
|
90
70
|
};
|
|
91
71
|
}
|
|
92
|
-
|
|
72
|
+
withFindings(findings) {
|
|
93
73
|
return new ScanResults(this.configuration, this.appMapMetadata, findings, this.checks);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
}());
|
|
74
|
+
}
|
|
75
|
+
}
|
|
97
76
|
exports.ScanResults = ScanResults;
|
|
98
|
-
//# sourceMappingURL=scanResults.js.map
|
|
@@ -3,11 +3,11 @@ 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
|
-
|
|
6
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
7
|
+
const util_1 = require("../rules/lib/util");
|
|
8
8
|
function summarizeFindings(findings) {
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
const result = findings.reduce((memo, finding) => {
|
|
10
|
+
let findingSummary = memo[finding.ruleId];
|
|
11
11
|
if (findingSummary) {
|
|
12
12
|
findingSummary.findingTotal += 1;
|
|
13
13
|
if (!findingSummary.findingHashes.has(finding.hash)) {
|
|
@@ -27,24 +27,23 @@ function summarizeFindings(findings) {
|
|
|
27
27
|
}
|
|
28
28
|
return memo;
|
|
29
29
|
}, {});
|
|
30
|
-
Object.values(result).forEach(
|
|
30
|
+
Object.values(result).forEach((findingSummary) => (findingSummary.messages = findingSummary.messages.sort()));
|
|
31
31
|
return Object.values(result);
|
|
32
32
|
}
|
|
33
33
|
function default_1(summary, colorize) {
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
const matchedStr = `${summary.summary.numFindings} ${(0, util_1.pluralize)('finding', summary.summary.numFindings)} (${new Set(summary.findings.map((finding) => finding.hash)).size} unique)`;
|
|
35
|
+
const colouredMatchedStr = colorize ? chalk_1.default.stderr.magenta(matchedStr) : matchedStr;
|
|
36
36
|
console.log();
|
|
37
37
|
console.log(colouredMatchedStr);
|
|
38
38
|
summarizeFindings(summary.findings)
|
|
39
|
-
.sort(
|
|
40
|
-
.forEach(
|
|
41
|
-
|
|
39
|
+
.sort((a, b) => a.ruleTitle.localeCompare(b.ruleTitle))
|
|
40
|
+
.forEach((finding) => {
|
|
41
|
+
const casesStr = `\t- ${finding.ruleTitle} (${finding.ruleId}) : ${finding.findingTotal} ${(0, util_1.pluralize)('case', finding.findingTotal)} (${finding.findingHashes.size} unique)`;
|
|
42
42
|
console.log(colorize ? chalk_1.default.stderr.magenta(casesStr) : casesStr);
|
|
43
|
-
finding.messages.forEach(
|
|
44
|
-
|
|
43
|
+
finding.messages.forEach((message) => {
|
|
44
|
+
const messageStr = `\t\t${message}`;
|
|
45
45
|
console.log(colorize ? chalk_1.default.stderr.magenta(messageStr) : messageStr);
|
|
46
46
|
});
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
exports.default = default_1;
|
|
50
|
-
//# sourceMappingURL=summaryReport.js.map
|