-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patheslint.security.config.js
More file actions
66 lines (63 loc) · 2.3 KB
/
eslint.security.config.js
File metadata and controls
66 lines (63 loc) · 2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import tsPlugin from '@typescript-eslint/eslint-plugin';
import tsParser from '@typescript-eslint/parser';
import securityPlugin from 'eslint-plugin-security';
export default [
{
files: ['**/*.ts', '**/*.tsx'],
languageOptions: {
parser: tsParser,
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
},
plugins: {
'@typescript-eslint': tsPlugin,
'security': securityPlugin,
},
rules: {
// Security plugin rules - focusing on the most critical ones
'security/detect-object-injection': 'error',
'security/detect-non-literal-regexp': 'error',
'security/detect-unsafe-regex': 'error',
'security/detect-buffer-noassert': 'error',
'security/detect-child-process': 'error',
'security/detect-disable-mustache-escape': 'error',
'security/detect-eval-with-expression': 'error',
'security/detect-no-csrf-before-method-override': 'error',
'security/detect-non-literal-fs-filename': 'error',
'security/detect-non-literal-require': 'error',
'security/detect-possible-timing-attacks': 'error',
'security/detect-pseudoRandomBytes': 'error',
'security/detect-bidi-characters': 'error',
// General security-conscious rules
'no-eval': 'error',
'no-implied-eval': 'error',
'no-new-func': 'error',
'no-script-url': 'error',
'no-debugger': 'error',
'no-console': 'warn', // Allow for logging library but warn about it
// Prevent dangerous patterns
'no-proto': 'error',
'no-caller': 'error',
'no-extend-native': 'error',
'no-with': 'error',
},
},
// Relaxed rules for test files
{
files: ['**/__tests__/**/*.ts', '**/*.test.ts', '**/*test-utils.ts'],
rules: {
'security/detect-non-literal-fs-filename': 'off', // Allow dynamic file paths in tests
'security/detect-object-injection': 'warn', // Warn instead of error in tests
'no-console': 'off', // Allow console in test files
},
},
// Relaxed security rules for advanced-outputs.ts - comprehensive path validation implemented
{
files: ['**/advanced-outputs.ts'],
rules: {
'security/detect-non-literal-fs-filename': 'off', // Disabled: comprehensive path validation and security checks implemented
},
},
];