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 (b.hasOwnProperty(p)) d[p] = b[p]; };
|
7 | return extendStatics(d, b);
|
8 | }
|
9 | return function (d, b) {
|
10 | extendStatics(d, b);
|
11 | function __() { this.constructor = d; }
|
12 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
13 | };
|
14 | })();
|
15 | Object.defineProperty(exports, "__esModule", { value: true });
|
16 | var Lint = require("tslint");
|
17 | var BannedTermWalker_1 = require("./utils/BannedTermWalker");
|
18 | var TypeGuard_1 = require("./utils/TypeGuard");
|
19 | var Rule = (function (_super) {
|
20 | __extends(Rule, _super);
|
21 | function Rule() {
|
22 | return _super !== null && _super.apply(this, arguments) || this;
|
23 | }
|
24 | Rule.prototype.apply = function (sourceFile) {
|
25 | return this.applyWithFunction(sourceFile, BannedTermWalker_1.bannedTermWalker, this.parseOptions(this.getOptions()));
|
26 | };
|
27 | Rule.prototype.parseOptions = function (options) {
|
28 | var allowQuotedProperties = false;
|
29 | if (options.ruleArguments instanceof Array) {
|
30 | options.ruleArguments.forEach(function (opt) {
|
31 | if (TypeGuard_1.isObject(opt)) {
|
32 | allowQuotedProperties = opt['allow-quoted-properties'] === true;
|
33 | }
|
34 | });
|
35 | }
|
36 | return {
|
37 | failureString: Rule.FAILURE_STRING,
|
38 | bannedTerms: Rule.BANNED_TERMS,
|
39 | allowQuotedProperties: allowQuotedProperties
|
40 | };
|
41 | };
|
42 | Rule.metadata = {
|
43 | ruleName: 'no-banned-terms',
|
44 | type: 'maintainability',
|
45 | description: 'Do not use banned terms: caller, callee, eval, arguments.',
|
46 | options: null,
|
47 | optionsDescription: '',
|
48 | typescriptOnly: true,
|
49 | issueClass: 'SDL',
|
50 | issueType: 'Error',
|
51 | severity: 'Critical',
|
52 | level: 'Mandatory',
|
53 | group: 'Security',
|
54 | commonWeaknessEnumeration: '676, 242, 116'
|
55 | };
|
56 | Rule.FAILURE_STRING = 'Forbidden reference to banned term: ';
|
57 | Rule.BANNED_TERMS = ['caller', 'callee', 'arguments', 'eval'];
|
58 | return Rule;
|
59 | }(Lint.Rules.AbstractRule));
|
60 | exports.Rule = Rule;
|
61 |
|
\ | No newline at end of file |