Skip to content

Commit 9fcdf60

Browse files
author
Ksenia Peguero
committed
Updated Readme
1 parent b806074 commit 9fcdf60

File tree

5 files changed

+35
-43
lines changed

5 files changed

+35
-43
lines changed

README.md

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,45 +4,46 @@ These simple linting rules flag points of interest where a security problem may
44

55
## Getting Started
66

7-
Use the compiled rules from `\dist\src` with your installation of TSLint. In the project that you plan to scan (target project), go to the `node_modules` folder and create a folder called `tslint-angular-security`.
8-
```
9-
git clone -q https://github.com/Synopsys-SIG/tslint-angular-security
10-
cd targetproject\node_modules && mkdir tslint-angular-security
11-
```
7+
TSLint must be installed locally in the target project. And the project must have tsconfig.json file in the root folder. Install `tslint-angular-security` from npm.
128

13-
Copy files from `\dist\src` in this project to the `node_modules\tslint-angular-security` folder in the target project.
149
```
15-
cp tslint-angular-security\dist\src\* targetproject\node_modules\tslint-angular-security
10+
cd targetproject
11+
npm init -y
12+
npm i tslint typescript
13+
npm i tslint-angular-security
14+
./node_modules/tslint/bin/tslint --init
1615
```
1716

1817
## Configuration
1918

20-
Copy the `tslint_custom_rules.json` configuration file from the root of this project to the root of the target project.
19+
Configure the target project `tslint.json` file to include the needed rules from the `tslint-angular-security` package.
20+
2121
```
22-
cp tslint-angular-security\tslint_custom_rules.json targetproject\
22+
{
23+
"rulesDirectory": [
24+
"node_modules/tslint-angular-security"
25+
],
26+
27+
"rules": {
28+
"flag-local-storage-angular-plugin": true,
29+
"no-bypass-security": true,
30+
"no-element-reference": true
31+
}
32+
}
2333
```
2434

25-
Alternatively, modify the `tslint.json` file in the project to include the rules you need from the tslint-angular-security package.
35+
See example configuration in `tslint_custom_rules.json`.
2636

27-
## Prerequisites
28-
29-
TSLint must be installed locally in the target project. And the project must have tsconfig.json file in the root folder.
30-
```
31-
cd targetproject
32-
npm init -y
33-
npm i tslint typescript
34-
npm i tslint-microsoft-contrib
35-
./node_modules/tslint/bin/tslint --init
36-
```
3737

3838
## Running
3939

4040
In the root of the target project run:
4141

4242
```
43-
./node_modules/.bin/tslint --project tsconfig.json --config tslint_custom_rules.json
43+
./node_modules/.bin/tslint --project tsconfig.json --config tslint.json
4444
```
45-
*Warning: this repository is a work-in-progress. Things may break while we transition this project to open source. This is not an officially supported Synopsys product.*
45+
46+
*Warning: This repository is a work-in-progress. Things may break while we transition this project to open source. This is not an officially supported Synopsys product.*
4647

4748
## Rules
4849

@@ -54,12 +55,12 @@ Rule Name | Description | Vulnerability | CWE
5455

5556
## Developing
5657

57-
Feel free to update/add new rules in your local version. After you update the .ts files in `src`, compile them using the [TypeScript compiler](https://www.npmjs.com/package/typescript) from the root folder:
58+
Feel free to update/add new rules in your local version. After you add/update the .ts, compile them using the [TypeScript compiler](https://www.npmjs.com/package/typescript) from the root folder:
5859

5960
```
6061
tsc
6162
```
62-
The compiled JavaScript files will be in `dist\src`. Copy them to `node_modules\tslint-angular-security` in the target project and use them there.
63+
The compiled JavaScript files will be in the root directory. Copy them to `node_modules\tslint-angular-security` in the target project and use them.
6364

6465
## Authors
6566

flagLocalStorageAngularPluginRule.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,9 @@
99
* may return false positives.
1010
*/
1111
var __extends = (this && this.__extends) || (function () {
12-
var extendStatics = function (d, b) {
13-
extendStatics = Object.setPrototypeOf ||
14-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
15-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
16-
return extendStatics(d, b);
17-
}
12+
var extendStatics = Object.setPrototypeOf ||
13+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
14+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
1815
return function (d, b) {
1916
extendStatics(d, b);
2017
function __() { this.constructor = d; }

noBypassSecurityRule.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,9 @@
55
* which may lead to XSS.
66
*/
77
var __extends = (this && this.__extends) || (function () {
8-
var extendStatics = function (d, b) {
9-
extendStatics = Object.setPrototypeOf ||
10-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
11-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
12-
return extendStatics(d, b);
13-
}
8+
var extendStatics = Object.setPrototypeOf ||
9+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
10+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
1411
return function (d, b) {
1512
extendStatics(d, b);
1613
function __() { this.constructor = d; }

noElementReferenceRule.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,9 @@
55
* allows access to the underlying DOM element.
66
*/
77
var __extends = (this && this.__extends) || (function () {
8-
var extendStatics = function (d, b) {
9-
extendStatics = Object.setPrototypeOf ||
10-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
11-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
12-
return extendStatics(d, b);
13-
}
8+
var extendStatics = Object.setPrototypeOf ||
9+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
10+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
1411
return function (d, b) {
1512
extendStatics(d, b);
1613
function __() { this.constructor = d; }

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)