@appland/scanner 1.33.1

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.
Files changed (196) hide show
  1. package/LICENSE.txt +25 -0
  2. package/README.md +122 -0
  3. package/built/algorithms/dataStructures/graph/Graph.js +155 -0
  4. package/built/algorithms/dataStructures/graph/Graph.js.map +1 -0
  5. package/built/algorithms/dataStructures/graph/GraphEdge.js +27 -0
  6. package/built/algorithms/dataStructures/graph/GraphEdge.js.map +1 -0
  7. package/built/algorithms/dataStructures/graph/GraphVertex.js +79 -0
  8. package/built/algorithms/dataStructures/graph/GraphVertex.js.map +1 -0
  9. package/built/algorithms/dataStructures/linked-list/LinkedList.js +134 -0
  10. package/built/algorithms/dataStructures/linked-list/LinkedList.js.map +1 -0
  11. package/built/algorithms/dataStructures/linked-list/LinkedListNode.js +16 -0
  12. package/built/algorithms/dataStructures/linked-list/LinkedListNode.js.map +1 -0
  13. package/built/algorithms/graph/depth-first-search/index.js +49 -0
  14. package/built/algorithms/graph/depth-first-search/index.js.map +1 -0
  15. package/built/algorithms/graph/detect-cycle/index.js +77 -0
  16. package/built/algorithms/graph/detect-cycle/index.js.map +1 -0
  17. package/built/algorithms/utils/Comparator.js +35 -0
  18. package/built/algorithms/utils/Comparator.js.map +1 -0
  19. package/built/analyzer/recordSecrets.js +17 -0
  20. package/built/analyzer/recordSecrets.js.map +1 -0
  21. package/built/analyzer/secretsRegexes.js +13 -0
  22. package/built/analyzer/secretsRegexes.js.map +1 -0
  23. package/built/analyzer/secretsRegexesData.json +51 -0
  24. package/built/check.js +47 -0
  25. package/built/check.js.map +1 -0
  26. package/built/checkInstance.js +69 -0
  27. package/built/checkInstance.js.map +1 -0
  28. package/built/cli/ci/command.js +183 -0
  29. package/built/cli/ci/command.js.map +1 -0
  30. package/built/cli/ci/options.js +3 -0
  31. package/built/cli/ci/options.js.map +1 -0
  32. package/built/cli/exitCode.js +11 -0
  33. package/built/cli/exitCode.js.map +1 -0
  34. package/built/cli/progressReporter.js +16 -0
  35. package/built/cli/progressReporter.js.map +1 -0
  36. package/built/cli/resolveAppId.js +83 -0
  37. package/built/cli/resolveAppId.js.map +1 -0
  38. package/built/cli/scan/command.js +174 -0
  39. package/built/cli/scan/command.js.map +1 -0
  40. package/built/cli/scan/options.js +3 -0
  41. package/built/cli/scan/options.js.map +1 -0
  42. package/built/cli/scan/scanner.js +154 -0
  43. package/built/cli/scan/scanner.js.map +1 -0
  44. package/built/cli/scan.js +103 -0
  45. package/built/cli/scan.js.map +1 -0
  46. package/built/cli/scanArgs.js +26 -0
  47. package/built/cli/scanArgs.js.map +1 -0
  48. package/built/cli/scanOptions.js +3 -0
  49. package/built/cli/scanOptions.js.map +1 -0
  50. package/built/cli/upload/command.js +95 -0
  51. package/built/cli/upload/command.js.map +1 -0
  52. package/built/cli/upload/options.js +3 -0
  53. package/built/cli/upload/options.js.map +1 -0
  54. package/built/cli/validateFile.js +66 -0
  55. package/built/cli/validateFile.js.map +1 -0
  56. package/built/cli.js +32 -0
  57. package/built/cli.js.map +1 -0
  58. package/built/configuration/configurationProvider.js +169 -0
  59. package/built/configuration/configurationProvider.js.map +1 -0
  60. package/built/configuration/schema/match-pattern-config.json +32 -0
  61. package/built/configuration/schema/options.json +193 -0
  62. package/built/configuration/types/checkConfig.js +3 -0
  63. package/built/configuration/types/checkConfig.js.map +1 -0
  64. package/built/configuration/types/configuration.js +3 -0
  65. package/built/configuration/types/configuration.js.map +1 -0
  66. package/built/configuration/types/matchEventConfig.js +3 -0
  67. package/built/configuration/types/matchEventConfig.js.map +1 -0
  68. package/built/configuration/types/matchPatternConfig.js +3 -0
  69. package/built/configuration/types/matchPatternConfig.js.map +1 -0
  70. package/built/database/index.js +259 -0
  71. package/built/database/index.js.map +1 -0
  72. package/built/database/visit.js +80 -0
  73. package/built/database/visit.js.map +1 -0
  74. package/built/errors.js +35 -0
  75. package/built/errors.js.map +1 -0
  76. package/built/findings.js +15 -0
  77. package/built/findings.js.map +1 -0
  78. package/built/integration/appland/fetchStatus.js +51 -0
  79. package/built/integration/appland/fetchStatus.js.map +1 -0
  80. package/built/integration/appland/upload.js +193 -0
  81. package/built/integration/appland/upload.js.map +1 -0
  82. package/built/integration/github/commitStatus.js +19 -0
  83. package/built/integration/github/commitStatus.js.map +1 -0
  84. package/built/integration/vars.js +68 -0
  85. package/built/integration/vars.js.map +1 -0
  86. package/built/openapi/index.js +100 -0
  87. package/built/openapi/index.js.map +1 -0
  88. package/built/openapi/method.js +120 -0
  89. package/built/openapi/method.js.map +1 -0
  90. package/built/openapi/model.js +49 -0
  91. package/built/openapi/model.js.map +1 -0
  92. package/built/openapi/path.js +36 -0
  93. package/built/openapi/path.js.map +1 -0
  94. package/built/openapi/provider.js +133 -0
  95. package/built/openapi/provider.js.map +1 -0
  96. package/built/openapi/response.js +59 -0
  97. package/built/openapi/response.js.map +1 -0
  98. package/built/openapi/rpcRequest.js +130 -0
  99. package/built/openapi/rpcRequest.js.map +1 -0
  100. package/built/openapi/schema.js +42 -0
  101. package/built/openapi/schema.js.map +1 -0
  102. package/built/openapi/securitySchemes.js +32 -0
  103. package/built/openapi/securitySchemes.js.map +1 -0
  104. package/built/openapi/statusCodes.js +68 -0
  105. package/built/openapi/statusCodes.js.map +1 -0
  106. package/built/openapi/util.js +91 -0
  107. package/built/openapi/util.js.map +1 -0
  108. package/built/report/appMapMetadata.js +2 -0
  109. package/built/report/appMapMetadata.js.map +1 -0
  110. package/built/report/findingSummary.js +3 -0
  111. package/built/report/findingSummary.js.map +1 -0
  112. package/built/report/findingsReport.js +37 -0
  113. package/built/report/findingsReport.js.map +1 -0
  114. package/built/report/scanResults.js +103 -0
  115. package/built/report/scanResults.js.map +1 -0
  116. package/built/report/scanSummary.js +3 -0
  117. package/built/report/scanSummary.js.map +1 -0
  118. package/built/report/summaryReport.js +70 -0
  119. package/built/report/summaryReport.js.map +1 -0
  120. package/built/ruleChecker.js +260 -0
  121. package/built/ruleChecker.js.map +1 -0
  122. package/built/rules/authzBeforeAuthn.js +82 -0
  123. package/built/rules/authzBeforeAuthn.js.map +1 -0
  124. package/built/rules/circularDependency.js +227 -0
  125. package/built/rules/circularDependency.js.map +1 -0
  126. package/built/rules/http500.js +18 -0
  127. package/built/rules/http500.js.map +1 -0
  128. package/built/rules/illegalPackageDependency.js +38 -0
  129. package/built/rules/illegalPackageDependency.js.map +1 -0
  130. package/built/rules/incompatibleHttpClientRequest.js +96 -0
  131. package/built/rules/incompatibleHttpClientRequest.js.map +1 -0
  132. package/built/rules/insecureCompare.js +59 -0
  133. package/built/rules/insecureCompare.js.map +1 -0
  134. package/built/rules/jobNotCancelled.js +72 -0
  135. package/built/rules/jobNotCancelled.js.map +1 -0
  136. package/built/rules/lib/hasParameterOrReceiver.js +11 -0
  137. package/built/rules/lib/hasParameterOrReceiver.js.map +1 -0
  138. package/built/rules/lib/matchEvent.js +32 -0
  139. package/built/rules/lib/matchEvent.js.map +1 -0
  140. package/built/rules/lib/matchPattern.js +28 -0
  141. package/built/rules/lib/matchPattern.js.map +1 -0
  142. package/built/rules/lib/rpcWithoutProtection.js +40 -0
  143. package/built/rules/lib/rpcWithoutProtection.js.map +1 -0
  144. package/built/rules/missingAuthentication.js +65 -0
  145. package/built/rules/missingAuthentication.js.map +1 -0
  146. package/built/rules/missingContentType.js +27 -0
  147. package/built/rules/missingContentType.js.map +1 -0
  148. package/built/rules/nPlusOneQuery.js +84 -0
  149. package/built/rules/nPlusOneQuery.js.map +1 -0
  150. package/built/rules/queryFromInvalidPackage.js +37 -0
  151. package/built/rules/queryFromInvalidPackage.js.map +1 -0
  152. package/built/rules/queryFromView.js +29 -0
  153. package/built/rules/queryFromView.js.map +1 -0
  154. package/built/rules/rpcWithoutCircuitBreaker.js +97 -0
  155. package/built/rules/rpcWithoutCircuitBreaker.js.map +1 -0
  156. package/built/rules/saveWithoutValidation.js +27 -0
  157. package/built/rules/saveWithoutValidation.js.map +1 -0
  158. package/built/rules/secretInLog.js +76 -0
  159. package/built/rules/secretInLog.js.map +1 -0
  160. package/built/rules/slowFunctionCall.js +37 -0
  161. package/built/rules/slowFunctionCall.js.map +1 -0
  162. package/built/rules/slowHttpServerRequest.js +24 -0
  163. package/built/rules/slowHttpServerRequest.js.map +1 -0
  164. package/built/rules/slowQuery.js +23 -0
  165. package/built/rules/slowQuery.js.map +1 -0
  166. package/built/rules/tooManyJoins.js +77 -0
  167. package/built/rules/tooManyJoins.js.map +1 -0
  168. package/built/rules/tooManyUpdates.js +143 -0
  169. package/built/rules/tooManyUpdates.js.map +1 -0
  170. package/built/rules/unbatchedMaterializedQuery.js +65 -0
  171. package/built/rules/unbatchedMaterializedQuery.js.map +1 -0
  172. package/built/rules/updateInGetRequest.js +66 -0
  173. package/built/rules/updateInGetRequest.js.map +1 -0
  174. package/built/rules/util.js +102 -0
  175. package/built/rules/util.js.map +1 -0
  176. package/built/sampleConfig/bike_index.yml +10 -0
  177. package/built/sampleConfig/default.yml +19 -0
  178. package/built/sampleConfig/railsSampleApp6thEd.yml +29 -0
  179. package/built/sampleConfig/solidus.yml +31 -0
  180. package/built/scope/commandScope.js +156 -0
  181. package/built/scope/commandScope.js.map +1 -0
  182. package/built/scope/httpClientRequestScope.js +105 -0
  183. package/built/scope/httpClientRequestScope.js.map +1 -0
  184. package/built/scope/httpServerRequestScope.js +105 -0
  185. package/built/scope/httpServerRequestScope.js.map +1 -0
  186. package/built/scope/rootScope.js +105 -0
  187. package/built/scope/rootScope.js.map +1 -0
  188. package/built/scope/scopeImpl.js +88 -0
  189. package/built/scope/scopeImpl.js.map +1 -0
  190. package/built/scope/scopeIterator.js +21 -0
  191. package/built/scope/scopeIterator.js.map +1 -0
  192. package/built/scope/sqlTransactionScope.js +175 -0
  193. package/built/scope/sqlTransactionScope.js.map +1 -0
  194. package/built/wellKnownLabels.js +9 -0
  195. package/built/wellKnownLabels.js.map +1 -0
  196. package/package.json +89 -0
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __generator = (this && this.__generator) || function (thisArg, body) {
18
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
19
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
20
+ function verb(n) { return function (v) { return step([n, v]); }; }
21
+ function step(op) {
22
+ if (f) throw new TypeError("Generator is already executing.");
23
+ while (_) try {
24
+ 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;
25
+ if (y = 0, t) op = [op[0] & 2, t.value];
26
+ switch (op[0]) {
27
+ case 0: case 1: t = op; break;
28
+ case 4: _.label++; return { value: op[1], done: false };
29
+ case 5: _.label++; y = op[1]; op = [0]; continue;
30
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
31
+ default:
32
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
33
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
34
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
35
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
36
+ if (t[2]) _.ops.pop();
37
+ _.trys.pop(); continue;
38
+ }
39
+ op = body.call(thisArg, _);
40
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
41
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
42
+ }
43
+ };
44
+ var __values = (this && this.__values) || function(o) {
45
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
46
+ if (m) return m.call(o);
47
+ if (o && typeof o.length === "number") return {
48
+ next: function () {
49
+ if (o && i >= o.length) o = void 0;
50
+ return { value: o && o[i++], done: !o };
51
+ }
52
+ };
53
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
54
+ };
55
+ var __importDefault = (this && this.__importDefault) || function (mod) {
56
+ return (mod && mod.__esModule) ? mod : { "default": mod };
57
+ };
58
+ Object.defineProperty(exports, "__esModule", { value: true });
59
+ var scopeImpl_1 = __importDefault(require("./scopeImpl"));
60
+ var scopeIterator_1 = __importDefault(require("./scopeIterator"));
61
+ var RootScope = /** @class */ (function (_super) {
62
+ __extends(RootScope, _super);
63
+ function RootScope() {
64
+ return _super !== null && _super.apply(this, arguments) || this;
65
+ }
66
+ RootScope.prototype.scopes = function (events) {
67
+ var events_1, events_1_1, event, e_1_1;
68
+ var e_1, _a;
69
+ return __generator(this, function (_b) {
70
+ switch (_b.label) {
71
+ case 0:
72
+ _b.trys.push([0, 5, 6, 7]);
73
+ events_1 = __values(events), events_1_1 = events_1.next();
74
+ _b.label = 1;
75
+ case 1:
76
+ if (!!events_1_1.done) return [3 /*break*/, 4];
77
+ event = events_1_1.value;
78
+ if (!(event.isCall() && !event.parent)) return [3 /*break*/, 3];
79
+ return [4 /*yield*/, new scopeImpl_1.default(event)];
80
+ case 2:
81
+ _b.sent();
82
+ this.advanceToReturnEvent(event, events);
83
+ _b.label = 3;
84
+ case 3:
85
+ events_1_1 = events_1.next();
86
+ return [3 /*break*/, 1];
87
+ case 4: return [3 /*break*/, 7];
88
+ case 5:
89
+ e_1_1 = _b.sent();
90
+ e_1 = { error: e_1_1 };
91
+ return [3 /*break*/, 7];
92
+ case 6:
93
+ try {
94
+ if (events_1_1 && !events_1_1.done && (_a = events_1.return)) _a.call(events_1);
95
+ }
96
+ finally { if (e_1) throw e_1.error; }
97
+ return [7 /*endfinally*/];
98
+ case 7: return [2 /*return*/];
99
+ }
100
+ });
101
+ };
102
+ return RootScope;
103
+ }(scopeIterator_1.default));
104
+ exports.default = RootScope;
105
+ //# sourceMappingURL=rootScope.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rootScope.js","sourceRoot":"","sources":["../../src/scope/rootScope.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,0DAAoC;AACpC,kEAA4C;AAE5C;IAAuC,6BAAa;IAApD;;IAUA,CAAC;IATE,0BAAM,GAAP,UAAQ,MAAwB;;;;;;;oBACV,WAAA,SAAA,MAAM,CAAA;;;;oBAAf,KAAK;yBACV,CAAA,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAA,EAA/B,wBAA+B;oBACjC,qBAAM,IAAI,mBAAS,CAAC,KAAK,CAAC,EAAA;;oBAA1B,SAA0B,CAAC;oBAE3B,IAAI,CAAC,oBAAoB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;;;;;;;;;;;;;;;;;;;KAG9C;IACH,gBAAC;AAAD,CAAC,AAVD,CAAuC,uBAAa,GAUnD"}
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ var __generator = (this && this.__generator) || function (thisArg, body) {
3
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
4
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
5
+ function verb(n) { return function (v) { return step([n, v]); }; }
6
+ function step(op) {
7
+ if (f) throw new TypeError("Generator is already executing.");
8
+ while (_) try {
9
+ 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;
10
+ if (y = 0, t) op = [op[0] & 2, t.value];
11
+ switch (op[0]) {
12
+ case 0: case 1: t = op; break;
13
+ case 4: _.label++; return { value: op[1], done: false };
14
+ case 5: _.label++; y = op[1]; op = [0]; continue;
15
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
16
+ default:
17
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
18
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
19
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
20
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
21
+ if (t[2]) _.ops.pop();
22
+ _.trys.pop(); continue;
23
+ }
24
+ op = body.call(thisArg, _);
25
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
26
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
27
+ }
28
+ };
29
+ var __values = (this && this.__values) || function(o) {
30
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
31
+ if (m) return m.call(o);
32
+ if (o && typeof o.length === "number") return {
33
+ next: function () {
34
+ if (o && i >= o.length) o = void 0;
35
+ return { value: o && o[i++], done: !o };
36
+ }
37
+ };
38
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
39
+ };
40
+ Object.defineProperty(exports, "__esModule", { value: true });
41
+ var models_1 = require("@appland/models");
42
+ var ScopeImpl = /** @class */ (function () {
43
+ function ScopeImpl(event) {
44
+ this.scope = event;
45
+ this.descendants = new models_1.EventNavigator(event);
46
+ }
47
+ ScopeImpl.prototype.events = function () {
48
+ var _a, _b, event, e_1_1;
49
+ var e_1, _c;
50
+ return __generator(this, function (_d) {
51
+ switch (_d.label) {
52
+ case 0: return [4 /*yield*/, this.scope];
53
+ case 1:
54
+ _d.sent();
55
+ _d.label = 2;
56
+ case 2:
57
+ _d.trys.push([2, 7, 8, 9]);
58
+ _a = __values(this.descendants.descendants()), _b = _a.next();
59
+ _d.label = 3;
60
+ case 3:
61
+ if (!!_b.done) return [3 /*break*/, 6];
62
+ event = _b.value;
63
+ return [4 /*yield*/, event.event];
64
+ case 4:
65
+ _d.sent();
66
+ _d.label = 5;
67
+ case 5:
68
+ _b = _a.next();
69
+ return [3 /*break*/, 3];
70
+ case 6: return [3 /*break*/, 9];
71
+ case 7:
72
+ e_1_1 = _d.sent();
73
+ e_1 = { error: e_1_1 };
74
+ return [3 /*break*/, 9];
75
+ case 8:
76
+ try {
77
+ if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
78
+ }
79
+ finally { if (e_1) throw e_1.error; }
80
+ return [7 /*endfinally*/];
81
+ case 9: return [2 /*return*/];
82
+ }
83
+ });
84
+ };
85
+ return ScopeImpl;
86
+ }());
87
+ exports.default = ScopeImpl;
88
+ //# sourceMappingURL=scopeImpl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scopeImpl.js","sourceRoot":"","sources":["../../src/scope/scopeImpl.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAAwD;AAGxD;IAIE,mBAAY,KAAY;QACtB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,WAAW,GAAG,IAAI,uBAAc,CAAC,KAAK,CAAC,CAAC;IAC/C,CAAC;IAEA,0BAAM,GAAP;;;;;wBACE,qBAAM,IAAI,CAAC,KAAK,EAAA;;oBAAhB,SAAgB,CAAC;;;;oBAEG,KAAA,SAAA,IAAI,CAAC,WAAW,CAAC,WAAW,EAAE,CAAA;;;;oBAAvC,KAAK;oBACd,qBAAM,KAAK,CAAC,KAAK,EAAA;;oBAAjB,SAAiB,CAAC;;;;;;;;;;;;;;;;;;;KAErB;IACH,gBAAC;AAAD,CAAC,AAhBD,IAgBC"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var ScopeIterator = /** @class */ (function () {
4
+ function ScopeIterator() {
5
+ }
6
+ // Scan ahead past the return event of the yielded scope.
7
+ ScopeIterator.prototype.advanceToReturnEvent = function (scopeEvent, events) {
8
+ // Don't use for...of events here, it doesn't work with an outer for...of on the same events generator.
9
+ var eventResult = events.next();
10
+ while (!eventResult.done) {
11
+ var event = eventResult.value;
12
+ if (event.isReturn() && event.callEvent === scopeEvent) {
13
+ break;
14
+ }
15
+ eventResult = events.next();
16
+ }
17
+ };
18
+ return ScopeIterator;
19
+ }());
20
+ exports.default = ScopeIterator;
21
+ //# sourceMappingURL=scopeIterator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scopeIterator.js","sourceRoot":"","sources":["../../src/scope/scopeIterator.ts"],"names":[],"mappings":";;AAGA;IAAA;IAeA,CAAC;IAZC,yDAAyD;IAC/C,4CAAoB,GAA9B,UAA+B,UAAiB,EAAE,MAAwB;QACxE,uGAAuG;QACvG,IAAI,WAAW,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;QAChC,OAAO,CAAC,WAAW,CAAC,IAAI,EAAE;YACxB,IAAM,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC;YAChC,IAAI,KAAK,CAAC,QAAQ,EAAE,IAAI,KAAK,CAAC,SAAS,KAAK,UAAU,EAAE;gBACtD,MAAM;aACP;YACD,WAAW,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;SAC7B;IACH,CAAC;IACH,oBAAC;AAAD,CAAC,AAfD,IAeC"}
@@ -0,0 +1,175 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __generator = (this && this.__generator) || function (thisArg, body) {
18
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
19
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
20
+ function verb(n) { return function (v) { return step([n, v]); }; }
21
+ function step(op) {
22
+ if (f) throw new TypeError("Generator is already executing.");
23
+ while (_) try {
24
+ 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;
25
+ if (y = 0, t) op = [op[0] & 2, t.value];
26
+ switch (op[0]) {
27
+ case 0: case 1: t = op; break;
28
+ case 4: _.label++; return { value: op[1], done: false };
29
+ case 5: _.label++; y = op[1]; op = [0]; continue;
30
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
31
+ default:
32
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
33
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
34
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
35
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
36
+ if (t[2]) _.ops.pop();
37
+ _.trys.pop(); continue;
38
+ }
39
+ op = body.call(thisArg, _);
40
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
41
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
42
+ }
43
+ };
44
+ var __values = (this && this.__values) || function(o) {
45
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
46
+ if (m) return m.call(o);
47
+ if (o && typeof o.length === "number") return {
48
+ next: function () {
49
+ if (o && i >= o.length) o = void 0;
50
+ return { value: o && o[i++], done: !o };
51
+ }
52
+ };
53
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
54
+ };
55
+ var __importDefault = (this && this.__importDefault) || function (mod) {
56
+ return (mod && mod.__esModule) ? mod : { "default": mod };
57
+ };
58
+ Object.defineProperty(exports, "__esModule", { value: true });
59
+ exports.hasTransactionDetails = void 0;
60
+ var models_1 = require("@appland/models");
61
+ var scopeIterator_1 = __importDefault(require("./scopeIterator"));
62
+ function isBegin(ast) {
63
+ switch (ast.variant) {
64
+ case 'list':
65
+ return ast.statement.some(function (s) { return isBegin(s); });
66
+ case 'transaction':
67
+ return ast.action === 'begin';
68
+ default:
69
+ return false;
70
+ }
71
+ }
72
+ function isEnd(ast) {
73
+ var e_1, _a;
74
+ switch (ast.variant) {
75
+ case 'list':
76
+ try {
77
+ for (var _b = __values(ast.statement), _c = _b.next(); !_c.done; _c = _b.next()) {
78
+ var statement = _c.value;
79
+ var result = isEnd(statement);
80
+ if (result)
81
+ return result;
82
+ }
83
+ }
84
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
85
+ finally {
86
+ try {
87
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
88
+ }
89
+ finally { if (e_1) throw e_1.error; }
90
+ }
91
+ return undefined;
92
+ case 'transaction':
93
+ return ast.action === 'begin' ? undefined : ast;
94
+ default:
95
+ return undefined;
96
+ }
97
+ }
98
+ function hasTransactionDetails(event) {
99
+ return event.transaction !== undefined;
100
+ }
101
+ exports.hasTransactionDetails = hasTransactionDetails;
102
+ function iterateTransaction(begin, tail) {
103
+ // since we can only go through the tail once,
104
+ // we have to keep the list of events in the transaction
105
+ var transaction = [];
106
+ for (var next = tail.next(); !next.done; next = tail.next()) {
107
+ var event = next.value;
108
+ if (!event.isCall())
109
+ continue;
110
+ transaction.push(event);
111
+ if (!event.sql)
112
+ continue;
113
+ var sql = (0, models_1.buildQueryAST)(event.sql.sql);
114
+ if (!sql)
115
+ continue;
116
+ if (isBegin(sql))
117
+ throw new Error('Transaction started within a transaction.');
118
+ var end = isEnd(sql);
119
+ if (end) {
120
+ begin.transaction = { status: end.action, events: transaction };
121
+ break;
122
+ }
123
+ }
124
+ return {
125
+ scope: begin,
126
+ events: transaction[Symbol.iterator],
127
+ };
128
+ }
129
+ var SQLTransactionScope = /** @class */ (function (_super) {
130
+ __extends(SQLTransactionScope, _super);
131
+ function SQLTransactionScope() {
132
+ return _super !== null && _super.apply(this, arguments) || this;
133
+ }
134
+ SQLTransactionScope.prototype.scopes = function (events) {
135
+ var events_1, events_1_1, event, sql, e_2_1;
136
+ var e_2, _a;
137
+ return __generator(this, function (_b) {
138
+ switch (_b.label) {
139
+ case 0:
140
+ _b.trys.push([0, 5, 6, 7]);
141
+ events_1 = __values(events), events_1_1 = events_1.next();
142
+ _b.label = 1;
143
+ case 1:
144
+ if (!!events_1_1.done) return [3 /*break*/, 4];
145
+ event = events_1_1.value;
146
+ if (!event.isCall() || !event.sql)
147
+ return [3 /*break*/, 3];
148
+ sql = (0, models_1.buildQueryAST)(event.sql.sql);
149
+ if (!(sql && isBegin(sql) && !isEnd(sql))) return [3 /*break*/, 3];
150
+ return [4 /*yield*/, iterateTransaction(event, events)];
151
+ case 2:
152
+ _b.sent();
153
+ _b.label = 3;
154
+ case 3:
155
+ events_1_1 = events_1.next();
156
+ return [3 /*break*/, 1];
157
+ case 4: return [3 /*break*/, 7];
158
+ case 5:
159
+ e_2_1 = _b.sent();
160
+ e_2 = { error: e_2_1 };
161
+ return [3 /*break*/, 7];
162
+ case 6:
163
+ try {
164
+ if (events_1_1 && !events_1_1.done && (_a = events_1.return)) _a.call(events_1);
165
+ }
166
+ finally { if (e_2) throw e_2.error; }
167
+ return [7 /*endfinally*/];
168
+ case 7: return [2 /*return*/];
169
+ }
170
+ });
171
+ };
172
+ return SQLTransactionScope;
173
+ }(scopeIterator_1.default));
174
+ exports.default = SQLTransactionScope;
175
+ //# sourceMappingURL=sqlTransactionScope.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sqlTransactionScope.js","sourceRoot":"","sources":["../../src/scope/sqlTransactionScope.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var WellKnownLabels;
4
+ (function (WellKnownLabels) {
5
+ WellKnownLabels["JobCreate"] = "job.create";
6
+ WellKnownLabels["JobCancel"] = "job.cancel";
7
+ })(WellKnownLabels || (WellKnownLabels = {}));
8
+ exports.default = WellKnownLabels;
9
+ //# sourceMappingURL=wellKnownLabels.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wellKnownLabels.js","sourceRoot":"","sources":["../src/wellKnownLabels.ts"],"names":[],"mappings":";;AAAA,IAAK,eAGJ;AAHD,WAAK,eAAe;IAClB,2CAAwB,CAAA;IACxB,2CAAwB,CAAA;AAC1B,CAAC,EAHI,eAAe,KAAf,eAAe,QAGnB;AAED,kBAAe,eAAe,CAAC"}
package/package.json ADDED
@@ -0,0 +1,89 @@
1
+ {
2
+ "name": "@appland/scanner",
3
+ "version": "1.33.1",
4
+ "description": "",
5
+ "bin": "built/cli.js",
6
+ "files": [
7
+ "built"
8
+ ],
9
+ "scripts": {
10
+ "build": "mkdir -p built && cp -r src/sampleConfig built && tsc",
11
+ "build-native": "yarn build && ./bin/build-native",
12
+ "start": "ts-node src/cli.ts",
13
+ "schema": "./bin/schema",
14
+ "schema-up-to-date": "git diff --exit-code src/configuration/schema/options.json",
15
+ "lint": "eslint src --ext .ts",
16
+ "ci": "yarn lint && yarn build && yarn schema && yarn schema-up-to-date && yarn test",
17
+ "test": "jest",
18
+ "semantic-release": "semantic-release"
19
+ },
20
+ "author": "AppLand, Inc.",
21
+ "license": "Commons Clause + MIT",
22
+ "devDependencies": {
23
+ "@semantic-release/changelog": "^6.0.1",
24
+ "@semantic-release/git": "^10.0.1",
25
+ "@types/glob": "^7.1.4",
26
+ "@types/jest": "^27.0.1",
27
+ "@types/js-yaml": "^4.0.3",
28
+ "@types/node": "^16.7.10",
29
+ "@types/yargs": "^17.0.2",
30
+ "@typescript-eslint/eslint-plugin": "^4.30.0",
31
+ "@typescript-eslint/parser": "^4.30.0",
32
+ "eslint": "^7.32.0",
33
+ "eslint-config-prettier": "^8.3.0",
34
+ "eslint-plugin-node": "^11.1.0",
35
+ "eslint-plugin-prettier": "^3.4.1",
36
+ "jest": "^27.1.0",
37
+ "nock": "^13.2.1",
38
+ "openapi-types": "^9.3.0",
39
+ "pkg": "^5.5.1",
40
+ "prettier": "^2.3.2",
41
+ "semantic-release": "^18.0.0",
42
+ "sinon": "^11.1.2",
43
+ "ts-jest": "^27.0.5",
44
+ "ts-json-schema-generator": "^0.97.0",
45
+ "ts-node": "^10.2.1",
46
+ "typescript": "^4.4.2"
47
+ },
48
+ "dependencies": {
49
+ "@appland/client": "^1.1.1",
50
+ "@appland/models": "^1.10.1",
51
+ "@types/sinon": "^10.0.2",
52
+ "@types/tar-stream": "^2.2.2",
53
+ "ajv": "^8.8.2",
54
+ "ansi-escapes": "^5.0.0",
55
+ "chalk": "^4.1.2",
56
+ "form-data": "^4.0.0",
57
+ "js-yaml": "^4.1.0",
58
+ "minimatch": "^3.0.4",
59
+ "octokat": "^0.10.0",
60
+ "openapi-diff": "^0.23.5",
61
+ "semantic-release": "^18.0.0",
62
+ "supports-hyperlinks": "^2.2.0",
63
+ "tar-stream": "^2.2.0",
64
+ "yargs": "^17.1.1"
65
+ },
66
+ "repository": {
67
+ "type": "git",
68
+ "url": "https://github.com/applandinc/scanner.git"
69
+ },
70
+ "publishConfig": {
71
+ "access": "public"
72
+ },
73
+ "packageManager": "yarn@3.1.0",
74
+ "pkg": {
75
+ "targets": [
76
+ "node14-linux-x64",
77
+ "node14-win-x64",
78
+ "node14-macos-x64"
79
+ ],
80
+ "scripts": [
81
+ "built/scanner/*.js"
82
+ ],
83
+ "assets": [
84
+ "built/sampleConfig/*.yml",
85
+ "built/**/*.json"
86
+ ],
87
+ "outputPath": "dist"
88
+ }
89
+ }