eslint-plugin-secure-coding 3.4.0 → 3.4.1

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.
Files changed (64) hide show
  1. package/package.json +5 -18
  2. package/src/index.d.ts +17 -23
  3. package/src/index.js +2 -131
  4. package/src/oxlint.d.ts +17 -20
  5. package/src/oxlint.js +0 -18
  6. package/src/rules/detect-non-literal-regexp/index.js +5 -79
  7. package/src/rules/detect-object-injection/index.js +2 -221
  8. package/src/rules/detect-weak-password-validation/index.js +0 -12
  9. package/src/rules/no-directive-injection/index.js +0 -33
  10. package/src/rules/no-electron-security-issues/index.js +0 -41
  11. package/src/rules/no-format-string-injection/index.js +0 -82
  12. package/src/rules/no-graphql-injection/index.js +8 -133
  13. package/src/rules/no-hardcoded-credentials/index.js +3 -297
  14. package/src/rules/no-hardcoded-session-tokens/index.js +0 -11
  15. package/src/rules/no-improper-sanitization/index.js +0 -44
  16. package/src/rules/no-improper-type-validation/index.js +1 -51
  17. package/src/rules/no-insecure-comparison/index.js +2 -43
  18. package/src/rules/no-ldap-injection/index.js +8 -61
  19. package/src/rules/no-missing-authentication/index.js +2 -56
  20. package/src/rules/no-pii-in-logs/index.js +0 -13
  21. package/src/rules/no-privilege-escalation/index.js +2 -49
  22. package/src/rules/no-redos-vulnerable-regex/index.js +3 -49
  23. package/src/rules/no-sensitive-data-exposure/index.js +5 -29
  24. package/src/rules/no-template-injection/index.js +0 -6
  25. package/src/rules/no-unchecked-loop-condition/index.js +3 -99
  26. package/src/rules/no-unlimited-resource-allocation/index.js +2 -75
  27. package/src/rules/no-unsafe-deserialization/index.js +1 -111
  28. package/src/rules/no-unsafe-regex-construction/index.js +22 -62
  29. package/src/rules/no-weak-password-recovery/index.js +0 -43
  30. package/src/rules/no-xpath-injection/index.js +13 -75
  31. package/src/rules/no-xxe-injection/index.js +1 -47
  32. package/src/rules/require-backend-authorization/index.js +0 -10
  33. package/src/rules/require-secure-defaults/index.js +0 -10
  34. package/src/types/index.js +0 -5
  35. package/AGENTS.md +0 -131
  36. package/CHANGELOG.md +0 -379
  37. package/src/rules/detect-non-literal-regexp/index.d.ts +0 -28
  38. package/src/rules/detect-object-injection/index.d.ts +0 -35
  39. package/src/rules/detect-weak-password-validation/index.d.ts +0 -12
  40. package/src/rules/no-directive-injection/index.d.ts +0 -38
  41. package/src/rules/no-electron-security-issues/index.d.ts +0 -36
  42. package/src/rules/no-format-string-injection/index.d.ts +0 -44
  43. package/src/rules/no-graphql-injection/index.d.ts +0 -47
  44. package/src/rules/no-hardcoded-credentials/index.d.ts +0 -95
  45. package/src/rules/no-hardcoded-session-tokens/index.d.ts +0 -12
  46. package/src/rules/no-improper-sanitization/index.d.ts +0 -38
  47. package/src/rules/no-improper-type-validation/index.d.ts +0 -36
  48. package/src/rules/no-insecure-comparison/index.d.ts +0 -26
  49. package/src/rules/no-ldap-injection/index.d.ts +0 -53
  50. package/src/rules/no-missing-authentication/index.d.ts +0 -32
  51. package/src/rules/no-pii-in-logs/index.d.ts +0 -12
  52. package/src/rules/no-privilege-escalation/index.d.ts +0 -32
  53. package/src/rules/no-redos-vulnerable-regex/index.d.ts +0 -28
  54. package/src/rules/no-sensitive-data-exposure/index.d.ts +0 -30
  55. package/src/rules/no-template-injection/index.d.ts +0 -23
  56. package/src/rules/no-unchecked-loop-condition/index.d.ts +0 -38
  57. package/src/rules/no-unlimited-resource-allocation/index.d.ts +0 -38
  58. package/src/rules/no-unsafe-deserialization/index.d.ts +0 -40
  59. package/src/rules/no-unsafe-regex-construction/index.d.ts +0 -30
  60. package/src/rules/no-weak-password-recovery/index.d.ts +0 -38
  61. package/src/rules/no-xpath-injection/index.d.ts +0 -39
  62. package/src/rules/no-xxe-injection/index.d.ts +0 -36
  63. package/src/rules/require-backend-authorization/index.d.ts +0 -12
  64. package/src/rules/require-secure-defaults/index.d.ts +0 -12
@@ -1,95 +0,0 @@
1
- /**
2
- * Copyright (c) 2025 Ofri Peretz
3
- * Licensed under the MIT License. Use of this source code is governed by the
4
- * MIT license that can be found in the LICENSE file.
5
- */
6
- /**
7
- * ESLint Rule: no-hardcoded-credentials
8
- * Detects hardcoded passwords, API keys, tokens, and other sensitive credentials
9
- * CWE-798: Use of Hard-coded Credentials
10
- *
11
- * @see https://cwe.mitre.org/data/definitions/798.html
12
- */
13
- import type { TSESLint } from '@interlace/eslint-devkit';
14
- type MessageIds = 'useEnvironmentVariable' | 'useSecretManager' | 'strategyEnv' | 'strategyConfig' | 'strategyVault' | 'strategyAuto';
15
- export interface Options {
16
- /** Patterns to ignore (regex strings). Default: [] */
17
- ignorePatterns?: string[];
18
- /** Allow credentials in test files. Default: false */
19
- allowInTests?: boolean;
20
- /** Minimum length for credential detection. Default: 8 */
21
- minLength?: number;
22
- /** Detect API keys. Default: true */
23
- detectApiKeys?: boolean;
24
- /** Detect passwords. Default: true */
25
- detectPasswords?: boolean;
26
- /** Detect tokens. Default: true */
27
- detectTokens?: boolean;
28
- /** Detect database connection strings. Default: true */
29
- detectDatabaseStrings?: boolean;
30
- /** Custom credential patterns. Default: [] */
31
- customPatterns?: Array<{
32
- /** The type of credential (e.g., 'API key', 'token', 'password') */
33
- type: string;
34
- /** Regex pattern to match */
35
- pattern: string;
36
- }>;
37
- /** Strategy for fixing hardcoded credentials: 'env', 'config', 'vault', 'auto' */
38
- strategy?: 'env' | 'config' | 'vault' | 'auto';
39
- /** Skip self-evident placeholder values (`<your-secret-here>`, `changeme`, `xxxxxxxx`). Default: true */
40
- allowPlaceholders?: boolean;
41
- }
42
- type RuleOptions = [Options?];
43
- /**
44
- * True when the string is made purely of dictionary-ish words joined by word
45
- * separators or camelCase — i.e. an identifier, an i18n key, or an error
46
- * message constant. No digits, no symbols, every ≥3-character token
47
- * pronounceable.
48
- *
49
- * `incorrectPassword` → true (the corpus false positive)
50
- * `SessionCacheProvider` → true
51
- * `experimental_onToolExecutionStart` → true
52
- * `aaAA@123` → false (symbols + digits)
53
- * `qbp7LmCxYUTHFwKvHnxGW1aTyjSNU6ytN21etK89MaP2Dj2KZP` → false (digits)
54
- */
55
- export declare function isNaturalWordString(value: string): boolean;
56
- /**
57
- * High-confidence random blob: a contiguous alphanumeric token, mixed case,
58
- * containing digits, high per-character entropy, and not a charset constant.
59
- * That is the shape of a real committed API secret.
60
- *
61
- * The charset is deliberately strict (`[A-Za-z0-9]` only). Every non-secret
62
- * that reached this tier on the corpus failed exactly here: generated-code
63
- * strings (`installedChunkData[1](error);`), comma-separated keyword lists,
64
- * and Postgres constraint names (`PK_b36bcfe02fc8de3c57a8b2391c2`) all carry
65
- * punctuation that no API key does. JWTs and dotted identifiers are excluded
66
- * for the same reason and handled by their own, more specific tier.
67
- */
68
- export declare function looksRandom(value: string): boolean;
69
- /**
70
- * Shape gate for the "assigned to a credential-named binding" path. The name
71
- * says *what the slot is for*; this says *whether the value is plausibly a
72
- * secret rather than a message, label, or identifier*.
73
- */
74
- export declare function isSecretShaped(value: string, minLength: number): boolean;
75
- /**
76
- * True when the value is a self-evident stand-in rather than a secret.
77
- *
78
- * Three shapes, each unambiguous on its own:
79
- * 1. Bracketed template slots — `<your-secret-here>`, `{{API_KEY}}`,
80
- * `${SECRET}`, `[token]`. No real credential is delimited this way, and
81
- * the brackets are what push the string past `isSecretShaped`'s
82
- * two-character-class gate in the first place.
83
- * 2. A placeholder word standing as its own token — `changeme`,
84
- * `YOUR_API_KEY`, `example.com`. Substring matching is deliberately
85
- * avoided: a real key may contain `bar` by chance.
86
- * 3. One character repeated — `xxxxxxxxxxxx`, `********`, `00000000`.
87
- *
88
- * Verified against benchmarks/corpus/CWE-798/safe/test-placeholder-values.js,
89
- * where `secret: '<your-secret-here>'` was reported at CVSS 9.8.
90
- */
91
- export declare function isPlaceholderValue(value: string): boolean;
92
- export declare const noHardcodedCredentials: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
93
- name: string;
94
- };
95
- export {};
@@ -1,12 +0,0 @@
1
- /**
2
- * Copyright (c) 2025 Ofri Peretz
3
- * Licensed under the MIT License. Use of this source code is governed by the
4
- * MIT license that can be found in the LICENSE file.
5
- */
6
- export interface Options {
7
- }
8
- type RuleOptions = [Options?];
9
- export declare const noHardcodedSessionTokens: import("@typescript-eslint/utils/ts-eslint").RuleModule<"violationDetected", RuleOptions, unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
10
- name: string;
11
- };
12
- export {};
@@ -1,38 +0,0 @@
1
- /**
2
- * Copyright (c) 2025 Ofri Peretz
3
- * Licensed under the MIT License. Use of this source code is governed by the
4
- * MIT license that can be found in the LICENSE file.
5
- */
6
- /**
7
- * ESLint Rule: no-improper-sanitization
8
- * Detects improper sanitization of user input (CWE-94, CWE-79, CWE-116)
9
- *
10
- * Improper sanitization occurs when user input is not properly cleaned
11
- * before use in sensitive contexts. This can lead to injection attacks,
12
- * XSS, or other security vulnerabilities.
13
- *
14
- * False Positive Reduction:
15
- * This rule uses security utilities to reduce false positives by detecting:
16
- * - Known safe sanitization patterns
17
- * - Trusted sanitization libraries
18
- * - JSDoc annotations (@sanitized, @safe)
19
- * - Context-aware validation
20
- */
21
- import type { TSESLint } from '@interlace/eslint-devkit';
22
- import { type SecurityRuleOptions } from '@interlace/eslint-devkit';
23
- type MessageIds = 'improperSanitization' | 'insufficientXssProtection' | 'incompleteHtmlEscaping' | 'unsafeReplaceSanitization' | 'missingContextEncoding' | 'dangerousSanitizerUsage' | 'sqlInjectionSanitization' | 'commandInjectionSanitization' | 'useProperSanitization' | 'validateSanitization' | 'implementContextAware' | 'strategyDefenseInDepth' | 'strategyInputValidation' | 'strategyOutputEncoding';
24
- export interface Options extends SecurityRuleOptions {
25
- /** Safe sanitization functions */
26
- safeSanitizers?: string[];
27
- /** Characters that should be escaped */
28
- dangerousChars?: string[];
29
- /** Contexts that require different encoding */
30
- contexts?: string[];
31
- /** Trusted sanitization libraries */
32
- trustedLibraries?: string[];
33
- }
34
- type RuleOptions = [Options?];
35
- export declare const noImproperSanitization: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
36
- name: string;
37
- };
38
- export {};
@@ -1,36 +0,0 @@
1
- /**
2
- * Copyright (c) 2025 Ofri Peretz
3
- * Licensed under the MIT License. Use of this source code is governed by the
4
- * MIT license that can be found in the LICENSE file.
5
- */
6
- /**
7
- * ESLint Rule: no-improper-type-validation
8
- * Detects improper type validation in user input handling (CWE-1287)
9
- *
10
- * Improper type validation can lead to security vulnerabilities when
11
- * user input is not properly validated, allowing attackers to bypass
12
- * security checks or cause unexpected behavior.
13
- *
14
- * False Positive Reduction:
15
- * This rule uses security utilities to reduce false positives by detecting:
16
- * - Safe type checking patterns
17
- * - TypeScript type guards
18
- * - Proper validation functions
19
- * - JSDoc annotations (@validated, @type-checked)
20
- */
21
- import type { TSESLint } from '@interlace/eslint-devkit';
22
- import { type SecurityRuleOptions } from '@interlace/eslint-devkit';
23
- type MessageIds = 'improperTypeValidation' | 'unsafeTypeofCheck' | 'unsafeInstanceofUsage' | 'looseEqualityTypeCheck' | 'missingNullCheck' | 'unreliableConstructorCheck' | 'incompleteTypeValidation' | 'useTypeofCorrectly' | 'useProperTypeGuards' | 'validateUserInput' | 'strategyTypeGuards' | 'strategySchemaValidation' | 'strategyDefensiveProgramming';
24
- export interface Options extends SecurityRuleOptions {
25
- /** Variables that contain user input and should be validated */
26
- userInputVariables?: string[];
27
- /** Safe type checking functions */
28
- safeTypeCheckFunctions?: string[];
29
- /** Whether to allow instanceof in same-realm contexts */
30
- allowInstanceofSameRealm?: boolean;
31
- }
32
- type RuleOptions = [Options?];
33
- export declare const noImproperTypeValidation: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
34
- name: string;
35
- };
36
- export {};
@@ -1,26 +0,0 @@
1
- /**
2
- * Copyright (c) 2025 Ofri Peretz
3
- * Licensed under the MIT License. Use of this source code is governed by the
4
- * MIT license that can be found in the LICENSE file.
5
- */
6
- /**
7
- * ESLint Rule: no-insecure-comparison
8
- * Detects insecure comparison operators (==, !=) that can lead to type coercion vulnerabilities
9
- * CWE-697: Incorrect Comparison
10
- *
11
- * @see https://cwe.mitre.org/data/definitions/697.html
12
- * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Equality_comparisons_and_sameness
13
- */
14
- import type { TSESLint } from '@interlace/eslint-devkit';
15
- type MessageIds = 'insecureComparison' | 'useStrictEquality' | 'timingUnsafeComparison';
16
- export interface Options {
17
- /** Allow insecure comparison in test files. Default: false */
18
- allowInTests?: boolean;
19
- /** Additional patterns to ignore. Default: [] */
20
- ignorePatterns?: string[];
21
- }
22
- type RuleOptions = [Options?];
23
- export declare const noInsecureComparison: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
24
- name: string;
25
- };
26
- export {};
@@ -1,53 +0,0 @@
1
- /**
2
- * Copyright (c) 2025 Ofri Peretz
3
- * Licensed under the MIT License. Use of this source code is governed by the
4
- * MIT license that can be found in the LICENSE file.
5
- */
6
- /**
7
- * ESLint Rule: no-ldap-injection
8
- * Detects LDAP injection vulnerabilities (CWE-90)
9
- *
10
- * LDAP injection occurs when user input is improperly inserted into LDAP
11
- * queries, allowing attackers to:
12
- * - Bypass authentication and authorization
13
- * - Extract sensitive directory information
14
- * - Perform unauthorized LDAP operations
15
- * - Enumerate users through blind injection techniques
16
- *
17
- * False Positive Reduction:
18
- * This rule uses security utilities to reduce false positives by detecting:
19
- * - Safe LDAP libraries with built-in escaping
20
- * - Input validation and sanitization functions
21
- * - JSDoc annotations (@ldap-safe, @escaped)
22
- * - Parameterized LDAP query construction
23
- */
24
- import type { TSESLint } from '@interlace/eslint-devkit';
25
- import { type SecurityRuleOptions } from '@interlace/eslint-devkit';
26
- type MessageIds = 'ldapInjection' | 'unsafeLdapFilter' | 'unescapedLdapInput' | 'dangerousLdapOperation' | 'useLdapEscaping' | 'validateLdapInput' | 'useParameterizedLdap' | 'strategyInputValidation' | 'strategySafeLibraries' | 'strategyFilterConstruction';
27
- export interface Options extends SecurityRuleOptions {
28
- /** LDAP-related function names to check */
29
- ldapFunctions?: string[];
30
- /** Functions that safely escape LDAP input */
31
- ldapEscapeFunctions?: string[];
32
- /** Functions that validate LDAP input */
33
- ldapValidationFunctions?: string[];
34
- }
35
- type RuleOptions = [Options?];
36
- /**
37
- * Check if LDAP filter contains dangerous patterns.
38
- *
39
- * Extracted to module scope (from inside `create()`) for direct unit
40
- * testability — this function is pure and captures no closure state.
41
- */
42
- export declare function containsDangerousLdapFilter(filterText: string): boolean;
43
- /**
44
- * Check if string contains LDAP filter interpolation.
45
- *
46
- * Extracted to module scope (from inside `create()`) for direct unit
47
- * testability — this function is pure and captures no closure state.
48
- */
49
- export declare function containsLdapInterpolation(text: string): boolean;
50
- export declare const noLdapInjection: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
51
- name: string;
52
- };
53
- export {};
@@ -1,32 +0,0 @@
1
- /**
2
- * Copyright (c) 2025 Ofri Peretz
3
- * Licensed under the MIT License. Use of this source code is governed by the
4
- * MIT license that can be found in the LICENSE file.
5
- */
6
- /**
7
- * ESLint Rule: no-missing-authentication
8
- * Detects missing authentication checks in route handlers
9
- * CWE-287: Improper Authentication
10
- *
11
- * @see https://cwe.mitre.org/data/definitions/287.html
12
- * @see https://owasp.org/www-community/vulnerabilities/Improper_Authentication
13
- */
14
- import type { TSESLint } from '@interlace/eslint-devkit';
15
- type MessageIds = 'missingAuthentication' | 'addAuthentication';
16
- export interface Options {
17
- /** Allow missing authentication in test files. Default: false */
18
- allowInTests?: boolean;
19
- /** Test file pattern regex string. Default: '\\.(test|spec)\\.(ts|tsx|js|jsx)$' */
20
- testFilePattern?: string;
21
- /** Authentication middleware patterns to recognize. Default: ['authenticate', 'auth', 'requireAuth', 'isAuthenticated'] */
22
- authMiddlewarePatterns?: string[];
23
- /** Route handler patterns to check. Default: ['get', 'post', 'put', 'delete', 'patch', 'all'] */
24
- routeHandlerPatterns?: string[];
25
- /** Additional patterns to ignore. Default: [] */
26
- ignorePatterns?: string[];
27
- }
28
- type RuleOptions = [Options?];
29
- export declare const noMissingAuthentication: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
30
- name: string;
31
- };
32
- export {};
@@ -1,12 +0,0 @@
1
- /**
2
- * Copyright (c) 2025 Ofri Peretz
3
- * Licensed under the MIT License. Use of this source code is governed by the
4
- * MIT license that can be found in the LICENSE file.
5
- */
6
- export interface Options {
7
- }
8
- type RuleOptions = [Options?];
9
- export declare const noPiiInLogs: import("@typescript-eslint/utils/ts-eslint").RuleModule<"violationDetected", RuleOptions, unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
10
- name: string;
11
- };
12
- export {};
@@ -1,32 +0,0 @@
1
- /**
2
- * Copyright (c) 2025 Ofri Peretz
3
- * Licensed under the MIT License. Use of this source code is governed by the
4
- * MIT license that can be found in the LICENSE file.
5
- */
6
- /**
7
- * ESLint Rule: no-privilege-escalation
8
- * Detects potential privilege escalation vulnerabilities
9
- * CWE-269: Improper Privilege Management
10
- *
11
- * @see https://cwe.mitre.org/data/definitions/269.html
12
- * @see https://owasp.org/www-community/vulnerabilities/Improper_Access_Control
13
- */
14
- import type { TSESLint } from '@interlace/eslint-devkit';
15
- type MessageIds = 'privilegeEscalation' | 'addRoleCheck';
16
- export interface Options {
17
- /** Allow privilege escalation patterns in test files. Default: false */
18
- allowInTests?: boolean;
19
- /** Test file pattern regex string. Default: '\\.(test|spec)\\.(ts|tsx|js|jsx)$' */
20
- testFilePattern?: string;
21
- /** Role check patterns to recognize. Default: ['hasRole', 'checkRole', 'isAdmin', 'isAuthorized'] */
22
- roleCheckPatterns?: string[];
23
- /** User input patterns that should be validated. Default: ['req.body', 'req.query', 'req.params'] */
24
- userInputPatterns?: string[];
25
- /** Additional patterns to ignore. Default: [] */
26
- ignorePatterns?: string[];
27
- }
28
- type RuleOptions = [Options?];
29
- export declare const noPrivilegeEscalation: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
30
- name: string;
31
- };
32
- export {};
@@ -1,28 +0,0 @@
1
- /**
2
- * Copyright (c) 2025 Ofri Peretz
3
- * Licensed under the MIT License. Use of this source code is governed by the
4
- * MIT license that can be found in the LICENSE file.
5
- */
6
- /**
7
- * ESLint Rule: no-redos-vulnerable-regex
8
- * Detects ReDoS-vulnerable regex patterns in literal regex patterns
9
- * CWE-400: Uncontrolled Resource Consumption
10
- *
11
- * Complements detect-non-literal-regexp by checking literal regex patterns
12
- *
13
- * @see https://cwe.mitre.org/data/definitions/400.html
14
- * @see https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
15
- */
16
- import type { TSESLint } from '@interlace/eslint-devkit';
17
- type MessageIds = 'redosVulnerable' | 'useAtomicGroups' | 'usePossessiveQuantifiers' | 'restructureRegex' | 'useSafeLibrary';
18
- export interface Options {
19
- /** Allow certain common patterns. Default: false */
20
- allowCommonPatterns?: boolean;
21
- /** Maximum pattern length to analyze. Default: 500 */
22
- maxPatternLength?: number;
23
- }
24
- type RuleOptions = [Options?];
25
- export declare const noRedosVulnerableRegex: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
26
- name: string;
27
- };
28
- export {};
@@ -1,30 +0,0 @@
1
- /**
2
- * Copyright (c) 2025 Ofri Peretz
3
- * Licensed under the MIT License. Use of this source code is governed by the
4
- * MIT license that can be found in the LICENSE file.
5
- */
6
- /**
7
- * ESLint Rule: no-sensitive-data-exposure
8
- * Detects PII/credentials in logs, responses, or error messages
9
- * Priority 5: Security with Data Flow Analysis
10
- * CWE-532: Information Exposure Through Log Files
11
- *
12
- * @see https://cwe.mitre.org/data/definitions/532.html
13
- */
14
- import type { TSESLint } from '@interlace/eslint-devkit';
15
- type MessageIds = 'sensitiveDataExposure' | 'redactData' | 'useMasking' | 'removeFromLogs';
16
- export interface Options {
17
- /** Sensitive data patterns. Default: ['password', 'secret', 'token', 'key', 'ssn', 'credit', 'card'] */
18
- sensitivePatterns?: string[];
19
- /** Check console.log statements. Default: true */
20
- checkConsoleLog?: boolean;
21
- /** Check error messages. Default: true */
22
- checkErrorMessages?: boolean;
23
- /** Check API responses. Default: true */
24
- checkApiResponses?: boolean;
25
- }
26
- type RuleOptions = [Options?];
27
- export declare const noSensitiveDataExposure: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
28
- name: string;
29
- };
30
- export {};
@@ -1,23 +0,0 @@
1
- /**
2
- * Copyright (c) 2025 Ofri Peretz
3
- * Licensed under the MIT License.
4
- */
5
- /**
6
- * ESLint Rule: no-template-injection
7
- * CWE-94: Improper Control of Generation of Code (Code Injection via Templates)
8
- *
9
- * Detects server-side template engine calls where the template argument is
10
- * dynamic (not a string literal). An attacker who controls the template
11
- * string can execute arbitrary server-side code.
12
- *
13
- * Detection: structural-api.
14
- * Handlebars.compile(userInput) — fires (dynamic first arg)
15
- * Handlebars.compile('<h1>{{t}}</h1>') — silent (string literal)
16
- *
17
- * Covered engines: Handlebars, EJS, Pug/Jade, Mustache, Nunjucks, Swig,
18
- * Dust, doT, and their common aliases.
19
- */
20
- import type { TSESLint } from '@interlace/eslint-devkit';
21
- export declare const noTemplateInjection: TSESLint.RuleModule<"templateInjection", [], unknown, TSESLint.RuleListener> & {
22
- name: string;
23
- };
@@ -1,38 +0,0 @@
1
- /**
2
- * Copyright (c) 2025 Ofri Peretz
3
- * Licensed under the MIT License. Use of this source code is governed by the
4
- * MIT license that can be found in the LICENSE file.
5
- */
6
- /**
7
- * ESLint Rule: no-unchecked-loop-condition
8
- * Detects unchecked loop conditions that could cause DoS (CWE-400, CWE-606)
9
- *
10
- * Loops with unchecked conditions can cause denial of service by consuming
11
- * excessive CPU time or memory. This includes infinite loops, loops with
12
- * user-controlled bounds, and loops without proper termination conditions.
13
- *
14
- * False Positive Reduction:
15
- * This rule uses security utilities to reduce false positives by detecting:
16
- * - Safe loop patterns with clear termination
17
- * - Development/debugging loops
18
- * - JSDoc annotations (@safe-loop, @intentional)
19
- * - Timeout protections
20
- */
21
- import type { TSESLint } from '@interlace/eslint-devkit';
22
- import { type SecurityRuleOptions } from '@interlace/eslint-devkit';
23
- type MessageIds = 'uncheckedLoopCondition' | 'infiniteLoop' | 'userControlledLoopBound' | 'missingLoopTermination' | 'largeLoopBound' | 'unsafeRecursion' | 'limitLoopIterations';
24
- export interface Options extends SecurityRuleOptions {
25
- /** Maximum allowed loop iterations for static analysis */
26
- maxStaticIterations?: number;
27
- /** Variables that contain user input */
28
- userInputVariables?: string[];
29
- /** Allow while(true) loops with breaks */
30
- allowWhileTrueWithBreak?: boolean;
31
- /** Maximum recursion depth to allow */
32
- maxRecursionDepth?: number;
33
- }
34
- type RuleOptions = [Options?];
35
- export declare const noUncheckedLoopCondition: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
36
- name: string;
37
- };
38
- export {};
@@ -1,38 +0,0 @@
1
- /**
2
- * Copyright (c) 2025 Ofri Peretz
3
- * Licensed under the MIT License. Use of this source code is governed by the
4
- * MIT license that can be found in the LICENSE file.
5
- */
6
- /**
7
- * ESLint Rule: no-unlimited-resource-allocation
8
- * Detects unlimited resource allocation vulnerabilities (CWE-770)
9
- *
10
- * Unlimited resource allocation can cause denial of service by exhausting
11
- * system resources like memory, file handles, or network connections.
12
- * This rule detects patterns where resources are allocated without limits.
13
- *
14
- * False Positive Reduction:
15
- * This rule uses security utilities to reduce false positives by detecting:
16
- * - Safe resource allocation patterns
17
- * - Proper resource limits
18
- * - JSDoc annotations (@limited-resource, @safe-allocation)
19
- * - Resource cleanup patterns
20
- */
21
- import type { TSESLint } from '@interlace/eslint-devkit';
22
- import { type SecurityRuleOptions } from '@interlace/eslint-devkit';
23
- type MessageIds = 'unlimitedResourceAllocation' | 'unlimitedBufferAllocation' | 'unlimitedFileOperations' | 'unlimitedNetworkConnections' | 'unlimitedMemoryAllocation' | 'userControlledResourceSize' | 'missingResourceLimits' | 'resourceAllocationInLoop' | 'implementResourceLimits' | 'validateResourceSize' | 'useResourcePools' | 'strategyResourceManagement' | 'strategyRateLimiting' | 'strategyResourceCleanup';
24
- export interface Options extends SecurityRuleOptions {
25
- /** Maximum allowed resource size for static analysis */
26
- maxResourceSize?: number;
27
- /** Variables that contain user input */
28
- userInputVariables?: string[];
29
- /** Safe resource allocation functions */
30
- safeResourceFunctions?: string[];
31
- /** Require resource validation */
32
- requireResourceValidation?: boolean;
33
- }
34
- type RuleOptions = [Options?];
35
- export declare const noUnlimitedResourceAllocation: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
36
- name: string;
37
- };
38
- export {};
@@ -1,40 +0,0 @@
1
- /**
2
- * Copyright (c) 2025 Ofri Peretz
3
- * Licensed under the MIT License. Use of this source code is governed by the
4
- * MIT license that can be found in the LICENSE file.
5
- */
6
- /**
7
- * ESLint Rule: no-unsafe-deserialization
8
- * Detects unsafe deserialization of untrusted data (CWE-502)
9
- *
10
- * Unsafe deserialization occurs when untrusted data is deserialized in a way that
11
- * allows attackers to execute arbitrary code or manipulate application logic.
12
- * This includes:
13
- * - Using dangerous deserialization libraries
14
- * - eval() or Function() on untrusted data
15
- * - YAML/XML parsers that can execute code
16
- * - Unsafe use of serialization libraries
17
- *
18
- * False Positive Reduction:
19
- * This rule uses security utilities to reduce false positives by detecting:
20
- * - Safe deserialization patterns
21
- * - Input validation and sanitization
22
- * - JSDoc annotations (@safe, @validated)
23
- * - Trusted deserialization libraries
24
- */
25
- import type { TSESLint } from '@interlace/eslint-devkit';
26
- import { type SecurityRuleOptions } from '@interlace/eslint-devkit';
27
- type MessageIds = 'unsafeDeserialization' | 'dangerousEvalUsage' | 'unsafeYamlParsing' | 'dangerousFunctionConstructor' | 'untrustedDeserializationInput' | 'useSafeDeserializer' | 'validateBeforeDeserialization' | 'avoidEval' | 'strategySafeLibraries' | 'strategyInputValidation' | 'strategySandboxing';
28
- export interface Options extends SecurityRuleOptions {
29
- /** Dangerous deserialization functions to detect */
30
- dangerousFunctions?: string[];
31
- /** Safe deserialization libraries */
32
- safeLibraries?: string[];
33
- /** Functions that validate input before deserialization */
34
- validationFunctions?: string[];
35
- }
36
- type RuleOptions = [Options?];
37
- export declare const noUnsafeDeserialization: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
38
- name: string;
39
- };
40
- export {};
@@ -1,30 +0,0 @@
1
- /**
2
- * Copyright (c) 2025 Ofri Peretz
3
- * Licensed under the MIT License. Use of this source code is governed by the
4
- * MIT license that can be found in the LICENSE file.
5
- */
6
- /**
7
- * ESLint Rule: no-unsafe-regex-construction
8
- * Detects unsafe regex construction patterns (user input without escaping, dynamic flags)
9
- * CWE-400: Uncontrolled Resource Consumption
10
- *
11
- * Extends detect-non-literal-regexp with pattern analysis
12
- *
13
- * @see https://cwe.mitre.org/data/definitions/400.html
14
- * @see https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
15
- */
16
- import type { TSESLint } from '@interlace/eslint-devkit';
17
- type MessageIds = 'unsafeRegexConstruction' | 'escapeUserInput' | 'validatePattern' | 'useSafeLibrary' | 'avoidDynamicFlags';
18
- export interface Options {
19
- /** Allow literal string patterns. Default: false */
20
- allowLiterals?: boolean;
21
- /** Trusted functions that escape input. Default: ['escapeRegex', 'escape', 'sanitize'] */
22
- trustedEscapingFunctions?: string[];
23
- /** Maximum pattern length for dynamic regex. Default: 100 */
24
- maxPatternLength?: number;
25
- }
26
- type RuleOptions = [Options?];
27
- export declare const noUnsafeRegexConstruction: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
28
- name: string;
29
- };
30
- export {};
@@ -1,38 +0,0 @@
1
- /**
2
- * Copyright (c) 2025 Ofri Peretz
3
- * Licensed under the MIT License. Use of this source code is governed by the
4
- * MIT license that can be found in the LICENSE file.
5
- */
6
- /**
7
- * ESLint Rule: no-weak-password-recovery
8
- * Detects weak password recovery mechanisms (CWE-640)
9
- *
10
- * Weak password recovery mechanisms can allow attackers to reset passwords
11
- * for other users, gain unauthorized access, or perform account takeover.
12
- * This rule detects obvious vulnerabilities in password recovery logic.
13
- *
14
- * False Positive Reduction:
15
- * This rule uses security utilities to reduce false positives by detecting:
16
- * - Proper recovery implementations
17
- * - Rate limiting mechanisms
18
- * - Secure token generation
19
- * - JSDoc annotations (@secure-recovery, @rate-limited)
20
- */
21
- import type { TSESLint } from '@interlace/eslint-devkit';
22
- import { type SecurityRuleOptions } from '@interlace/eslint-devkit';
23
- type MessageIds = 'weakPasswordRecovery' | 'missingRateLimit' | 'predictableRecoveryToken' | 'unlimitedRecoveryAttempts' | 'insufficientTokenEntropy' | 'missingTokenExpiration' | 'recoveryLoggingSensitiveData' | 'weakRecoveryVerification' | 'tokenReuseVulnerability' | 'implementRateLimiting' | 'useCryptographicallySecureTokens' | 'implementTokenExpiration' | 'secureRecoveryFlow' | 'strategyMultiFactor' | 'strategyOutOfBandVerification' | 'strategyTimeBoundTokens';
24
- export interface Options extends SecurityRuleOptions {
25
- /** Minimum token entropy bits */
26
- minTokenEntropy?: number;
27
- /** Maximum token lifetime in hours */
28
- maxTokenLifetimeHours?: number;
29
- /** Recovery-related keywords */
30
- recoveryKeywords?: string[];
31
- /** Secure token generation functions */
32
- secureTokenFunctions?: string[];
33
- }
34
- type RuleOptions = [Options?];
35
- export declare const noWeakPasswordRecovery: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
36
- name: string;
37
- };
38
- export {};