eslint-plugin-crypto 1.0.0
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.
- package/AGENTS.md +110 -0
- package/CHANGELOG.md +68 -0
- package/LICENSE +21 -0
- package/README.md +144 -0
- package/package.json +80 -0
- package/src/index.d.ts +35 -0
- package/src/index.js +213 -0
- package/src/index.js.map +1 -0
- package/src/rules/no-cryptojs/index.d.ts +6 -0
- package/src/rules/no-cryptojs/index.js +99 -0
- package/src/rules/no-cryptojs/index.js.map +1 -0
- package/src/rules/no-cryptojs-weak-random/index.d.ts +6 -0
- package/src/rules/no-cryptojs-weak-random/index.js +107 -0
- package/src/rules/no-cryptojs-weak-random/index.js.map +1 -0
- package/src/rules/no-deprecated-cipher-method/index.d.ts +6 -0
- package/src/rules/no-deprecated-cipher-method/index.js +110 -0
- package/src/rules/no-deprecated-cipher-method/index.js.map +1 -0
- package/src/rules/no-ecb-mode/index.d.ts +6 -0
- package/src/rules/no-ecb-mode/index.js +108 -0
- package/src/rules/no-ecb-mode/index.js.map +1 -0
- package/src/rules/no-hardcoded-crypto-key/index.d.ts +6 -0
- package/src/rules/no-hardcoded-crypto-key/index.js +138 -0
- package/src/rules/no-hardcoded-crypto-key/index.js.map +1 -0
- package/src/rules/no-insecure-key-derivation/index.d.ts +6 -0
- package/src/rules/no-insecure-key-derivation/index.js +111 -0
- package/src/rules/no-insecure-key-derivation/index.js.map +1 -0
- package/src/rules/no-insecure-rsa-padding/index.d.ts +6 -0
- package/src/rules/no-insecure-rsa-padding/index.js +105 -0
- package/src/rules/no-insecure-rsa-padding/index.js.map +1 -0
- package/src/rules/no-key-reuse/index.d.ts +6 -0
- package/src/rules/no-key-reuse/index.js +106 -0
- package/src/rules/no-key-reuse/index.js.map +1 -0
- package/src/rules/no-math-random-crypto/index.d.ts +6 -0
- package/src/rules/no-math-random-crypto/index.js +178 -0
- package/src/rules/no-math-random-crypto/index.js.map +1 -0
- package/src/rules/no-numeric-only-tokens/index.d.ts +6 -0
- package/src/rules/no-numeric-only-tokens/index.js +126 -0
- package/src/rules/no-numeric-only-tokens/index.js.map +1 -0
- package/src/rules/no-predictable-salt/index.d.ts +6 -0
- package/src/rules/no-predictable-salt/index.js +134 -0
- package/src/rules/no-predictable-salt/index.js.map +1 -0
- package/src/rules/no-self-signed-certs/index.d.ts +6 -0
- package/src/rules/no-self-signed-certs/index.js +111 -0
- package/src/rules/no-self-signed-certs/index.js.map +1 -0
- package/src/rules/no-sha1-hash/index.d.ts +6 -0
- package/src/rules/no-sha1-hash/index.js +123 -0
- package/src/rules/no-sha1-hash/index.js.map +1 -0
- package/src/rules/no-static-iv/index.d.ts +6 -0
- package/src/rules/no-static-iv/index.js +142 -0
- package/src/rules/no-static-iv/index.js.map +1 -0
- package/src/rules/no-timing-unsafe-compare/index.d.ts +6 -0
- package/src/rules/no-timing-unsafe-compare/index.js +109 -0
- package/src/rules/no-timing-unsafe-compare/index.js.map +1 -0
- package/src/rules/no-weak-cipher-algorithm/index.d.ts +8 -0
- package/src/rules/no-weak-cipher-algorithm/index.js +185 -0
- package/src/rules/no-weak-cipher-algorithm/index.js.map +1 -0
- package/src/rules/no-weak-hash-algorithm/index.d.ts +8 -0
- package/src/rules/no-weak-hash-algorithm/index.js +213 -0
- package/src/rules/no-weak-hash-algorithm/index.js.map +1 -0
- package/src/rules/no-web-crypto-export/index.d.ts +6 -0
- package/src/rules/no-web-crypto-export/index.js +110 -0
- package/src/rules/no-web-crypto-export/index.js.map +1 -0
- package/src/rules/prefer-native-crypto/index.d.ts +6 -0
- package/src/rules/prefer-native-crypto/index.js +119 -0
- package/src/rules/prefer-native-crypto/index.js.map +1 -0
- package/src/rules/require-authenticated-encryption/index.d.ts +6 -0
- package/src/rules/require-authenticated-encryption/index.js +122 -0
- package/src/rules/require-authenticated-encryption/index.js.map +1 -0
- package/src/rules/require-key-length/index.d.ts +6 -0
- package/src/rules/require-key-length/index.js +108 -0
- package/src/rules/require-key-length/index.js.map +1 -0
- package/src/rules/require-random-iv/index.d.ts +6 -0
- package/src/rules/require-random-iv/index.js +161 -0
- package/src/rules/require-random-iv/index.js.map +1 -0
- package/src/rules/require-secure-pbkdf2-digest/index.d.ts +6 -0
- package/src/rules/require-secure-pbkdf2-digest/index.js +163 -0
- package/src/rules/require-secure-pbkdf2-digest/index.js.map +1 -0
- package/src/rules/require-sufficient-length/index.d.ts +6 -0
- package/src/rules/require-sufficient-length/index.js +122 -0
- package/src/rules/require-sufficient-length/index.js.map +1 -0
- package/src/types/index.d.ts +132 -0
- package/src/types/index.js +6 -0
- package/src/types/index.js.map +1 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for eslint-plugin-crypto rules
|
|
3
|
+
*/
|
|
4
|
+
export interface NoWeakHashAlgorithmOptions {
|
|
5
|
+
/** Additional weak algorithms to detect. Default: [] */
|
|
6
|
+
additionalWeakAlgorithms?: string[];
|
|
7
|
+
/** Allow weak crypto in test files. Default: false */
|
|
8
|
+
allowInTests?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface NoWeakCipherAlgorithmOptions {
|
|
11
|
+
/** Additional weak ciphers to detect. Default: [] */
|
|
12
|
+
additionalWeakCiphers?: string[];
|
|
13
|
+
/** Allow weak ciphers in test files. Default: false */
|
|
14
|
+
allowInTests?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface NoDeprecatedCipherMethodOptions {
|
|
17
|
+
/** Allow deprecated methods in test files. Default: false */
|
|
18
|
+
allowInTests?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface NoStaticIvOptions {
|
|
21
|
+
/** Allow static IVs in test files. Default: false */
|
|
22
|
+
allowInTests?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface NoInsecureKeyDerivationOptions {
|
|
25
|
+
/** Minimum PBKDF2 iterations. Default: 100000 */
|
|
26
|
+
minIterations?: number;
|
|
27
|
+
}
|
|
28
|
+
export interface NoHardcodedCryptoKeyOptions {
|
|
29
|
+
/** Allow hardcoded keys in test files. Default: false */
|
|
30
|
+
allowInTests?: boolean;
|
|
31
|
+
}
|
|
32
|
+
export interface RequireRandomIvOptions {
|
|
33
|
+
/** Allowed randomness sources. Default: ['randomBytes', 'getRandomValues'] */
|
|
34
|
+
allowedSources?: string[];
|
|
35
|
+
}
|
|
36
|
+
export interface NoEcbModeOptions {
|
|
37
|
+
/** Allow ECB in test files. Default: false */
|
|
38
|
+
allowInTests?: boolean;
|
|
39
|
+
}
|
|
40
|
+
export interface NoSha1HashOptions {
|
|
41
|
+
/** Allow SHA1 in test files. Default: false */
|
|
42
|
+
allowInTests?: boolean;
|
|
43
|
+
}
|
|
44
|
+
export interface RequireSufficientLengthOptions {
|
|
45
|
+
/** Minimum token length. Default: 32 */
|
|
46
|
+
minLength?: number;
|
|
47
|
+
}
|
|
48
|
+
export interface NoNumericOnlyTokensOptions {
|
|
49
|
+
/** Allow numeric tokens for specific contexts. Default: [] */
|
|
50
|
+
allowedContexts?: string[];
|
|
51
|
+
}
|
|
52
|
+
export interface NoCryptojsOptions {
|
|
53
|
+
/** Severity level. Default: 'warn' */
|
|
54
|
+
severity?: 'error' | 'warn';
|
|
55
|
+
}
|
|
56
|
+
export interface NoCryptojsWeakRandomOptions {
|
|
57
|
+
/** Allow in test files. Default: false */
|
|
58
|
+
allowInTests?: boolean;
|
|
59
|
+
}
|
|
60
|
+
export interface PreferNativeCryptoOptions {
|
|
61
|
+
/** Severity level. Default: 'warn' */
|
|
62
|
+
severity?: 'error' | 'warn';
|
|
63
|
+
}
|
|
64
|
+
export interface NoMathRandomCryptoOptions {
|
|
65
|
+
/** Allow Math.random() in test files. Default: false */
|
|
66
|
+
allowInTests?: boolean;
|
|
67
|
+
}
|
|
68
|
+
export interface NoInsecureRsaPaddingOptions {
|
|
69
|
+
/** Allow in test files. Default: false */
|
|
70
|
+
allowInTests?: boolean;
|
|
71
|
+
}
|
|
72
|
+
export interface RequireSecurePbkdf2DigestOptions {
|
|
73
|
+
/** Allowed digest algorithms. Default: ['sha256', 'sha384', 'sha512'] */
|
|
74
|
+
allowedDigests?: string[];
|
|
75
|
+
}
|
|
76
|
+
export interface NoPredictableSaltOptions {
|
|
77
|
+
/** Minimum salt length in bytes. Default: 16 */
|
|
78
|
+
minSaltLength?: number;
|
|
79
|
+
}
|
|
80
|
+
export interface RequireAuthenticatedEncryptionOptions {
|
|
81
|
+
/** Allow unauthenticated modes in test files. Default: false */
|
|
82
|
+
allowInTests?: boolean;
|
|
83
|
+
}
|
|
84
|
+
export interface NoKeyReuseOptions {
|
|
85
|
+
/** Allow in test files. Default: false */
|
|
86
|
+
allowInTests?: boolean;
|
|
87
|
+
}
|
|
88
|
+
export interface NoSelfSignedCertsOptions {
|
|
89
|
+
/** Allow in test/development files. Default: false */
|
|
90
|
+
allowInTests?: boolean;
|
|
91
|
+
}
|
|
92
|
+
export interface NoTimingUnsafeCompareOptions {
|
|
93
|
+
/** Variable name patterns that indicate secrets. Default: ['token', 'secret', 'key', ...] */
|
|
94
|
+
secretPatterns?: string[];
|
|
95
|
+
}
|
|
96
|
+
export interface RequireKeyLengthOptions {
|
|
97
|
+
/** Minimum AES key bits. Default: 256 */
|
|
98
|
+
minKeyBits?: number;
|
|
99
|
+
}
|
|
100
|
+
export interface NoWebCryptoExportOptions {
|
|
101
|
+
/** Allow key export in test files. Default: false */
|
|
102
|
+
allowInTests?: boolean;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Combined type for all rule options
|
|
106
|
+
*/
|
|
107
|
+
export type AllCryptoRulesOptions = {
|
|
108
|
+
'no-weak-hash-algorithm': NoWeakHashAlgorithmOptions;
|
|
109
|
+
'no-weak-cipher-algorithm': NoWeakCipherAlgorithmOptions;
|
|
110
|
+
'no-deprecated-cipher-method': NoDeprecatedCipherMethodOptions;
|
|
111
|
+
'no-static-iv': NoStaticIvOptions;
|
|
112
|
+
'no-insecure-key-derivation': NoInsecureKeyDerivationOptions;
|
|
113
|
+
'no-hardcoded-crypto-key': NoHardcodedCryptoKeyOptions;
|
|
114
|
+
'require-random-iv': RequireRandomIvOptions;
|
|
115
|
+
'no-ecb-mode': NoEcbModeOptions;
|
|
116
|
+
'no-sha1-hash': NoSha1HashOptions;
|
|
117
|
+
'require-sufficient-length': RequireSufficientLengthOptions;
|
|
118
|
+
'no-numeric-only-tokens': NoNumericOnlyTokensOptions;
|
|
119
|
+
'no-cryptojs': NoCryptojsOptions;
|
|
120
|
+
'no-cryptojs-weak-random': NoCryptojsWeakRandomOptions;
|
|
121
|
+
'prefer-native-crypto': PreferNativeCryptoOptions;
|
|
122
|
+
'no-math-random-crypto': NoMathRandomCryptoOptions;
|
|
123
|
+
'no-insecure-rsa-padding': NoInsecureRsaPaddingOptions;
|
|
124
|
+
'require-secure-pbkdf2-digest': RequireSecurePbkdf2DigestOptions;
|
|
125
|
+
'no-predictable-salt': NoPredictableSaltOptions;
|
|
126
|
+
'require-authenticated-encryption': RequireAuthenticatedEncryptionOptions;
|
|
127
|
+
'no-key-reuse': NoKeyReuseOptions;
|
|
128
|
+
'no-self-signed-certs': NoSelfSignedCertsOptions;
|
|
129
|
+
'no-timing-unsafe-compare': NoTimingUnsafeCompareOptions;
|
|
130
|
+
'require-key-length': RequireKeyLengthOptions;
|
|
131
|
+
'no-web-crypto-export': NoWebCryptoExportOptions;
|
|
132
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/eslint-plugin-crypto/src/types/index.ts"],"names":[],"mappings":";AAAA;;GAEG"}
|