Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Commit 1126655

Browse files
committed
[tests] added new test case for tsr-detect-non-literal-fs-filename rule
1 parent 770262d commit 1126655

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@ More information: https://blog.liftsecurity.io/2014/11/03/regular-expression-dos
105105

106106
Detects `require(variable)`, which might allow an attacker to load and run arbitrary code, or access arbitrary files on disk.
107107

108-
More information: http://www.bennadel.com/blog/2169-where-does-node-js-and-require-look-for-modules.htm
108+
More information:
109+
* http://www.bennadel.com/blog/2169-where-does-node-js-and-require-look-for-modules.htm
110+
* https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-dynamic-require.md
109111

110112
#### `tsr-detect-possible-timing-attacks`
111113

test/rules/tsr-detect-non-literal-fs-filename/default/test.ts.lint

+8-1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,11 @@ const s = 'test';
1717
const o = {
1818
open(a: string) {},
1919
};
20-
o.open(s);
20+
o.open(s);
21+
22+
const _ = require('lodash');
23+
require('lodash-exists');
24+
25+
if (_.exists(memberId)) {
26+
this.memberId = memberId;
27+
}

0 commit comments

Comments
 (0)