eslint-plugin-secure-coding 2.3.2 → 2.3.3
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/README.md +1 -0
- package/package.json +3 -10
- package/src/index.ts +605 -0
- package/src/rules/__tests__/integration-demo.test.ts +290 -0
- package/src/rules/__tests__/integration-llm.test.ts +89 -0
- package/src/rules/database-injection/database-injection.test.ts +456 -0
- package/src/rules/database-injection/index.ts +488 -0
- package/src/rules/detect-child-process/detect-child-process.test.ts +207 -0
- package/src/rules/detect-child-process/index.ts +634 -0
- package/src/rules/detect-eval-with-expression/detect-eval-with-expression.test.ts +416 -0
- package/src/rules/detect-eval-with-expression/index.ts +463 -0
- package/src/rules/detect-mixed-content/detect-mixed-content.test.ts +28 -0
- package/src/rules/detect-mixed-content/index.ts +52 -0
- package/src/rules/detect-non-literal-fs-filename/detect-non-literal-fs-filename.test.ts +269 -0
- package/src/rules/detect-non-literal-fs-filename/index.ts +551 -0
- package/src/rules/detect-non-literal-regexp/detect-non-literal-regexp.test.ts +189 -0
- package/src/rules/detect-non-literal-regexp/index.ts +490 -0
- package/src/rules/detect-object-injection/detect-object-injection.test.ts +440 -0
- package/src/rules/detect-object-injection/index.ts +674 -0
- package/src/rules/detect-suspicious-dependencies/detect-suspicious-dependencies.test.ts +32 -0
- package/src/rules/detect-suspicious-dependencies/index.ts +84 -0
- package/src/rules/detect-weak-password-validation/detect-weak-password-validation.test.ts +31 -0
- package/src/rules/detect-weak-password-validation/index.ts +68 -0
- package/src/rules/no-allow-arbitrary-loads/index.ts +54 -0
- package/src/rules/no-allow-arbitrary-loads/no-allow-arbitrary-loads.test.ts +28 -0
- package/src/rules/no-arbitrary-file-access/index.ts +238 -0
- package/src/rules/no-arbitrary-file-access/no-arbitrary-file-access.test.ts +119 -0
- package/src/rules/no-buffer-overread/index.ts +724 -0
- package/src/rules/no-buffer-overread/no-buffer-overread.test.ts +313 -0
- package/src/rules/no-clickjacking/index.ts +481 -0
- package/src/rules/no-clickjacking/no-clickjacking.test.ts +253 -0
- package/src/rules/no-client-side-auth-logic/index.ts +81 -0
- package/src/rules/no-client-side-auth-logic/no-client-side-auth-logic.test.ts +33 -0
- package/src/rules/no-credentials-in-query-params/index.ts +69 -0
- package/src/rules/no-credentials-in-query-params/no-credentials-in-query-params.test.ts +33 -0
- package/src/rules/no-credentials-in-storage-api/index.ts +64 -0
- package/src/rules/no-credentials-in-storage-api/no-credentials-in-storage-api.test.ts +31 -0
- package/src/rules/no-data-in-temp-storage/index.ts +75 -0
- package/src/rules/no-data-in-temp-storage/no-data-in-temp-storage.test.ts +33 -0
- package/src/rules/no-debug-code-in-production/index.ts +59 -0
- package/src/rules/no-debug-code-in-production/no-debug-code-in-production.test.ts +26 -0
- package/src/rules/no-directive-injection/index.ts +551 -0
- package/src/rules/no-directive-injection/no-directive-injection.test.ts +305 -0
- package/src/rules/no-disabled-certificate-validation/index.ts +72 -0
- package/src/rules/no-disabled-certificate-validation/no-disabled-certificate-validation.test.ts +33 -0
- package/src/rules/no-document-cookie/index.ts +113 -0
- package/src/rules/no-document-cookie/no-document-cookie.test.ts +382 -0
- package/src/rules/no-dynamic-dependency-loading/index.ts +60 -0
- package/src/rules/no-dynamic-dependency-loading/no-dynamic-dependency-loading.test.ts +27 -0
- package/src/rules/no-electron-security-issues/index.ts +504 -0
- package/src/rules/no-electron-security-issues/no-electron-security-issues.test.ts +324 -0
- package/src/rules/no-exposed-debug-endpoints/index.ts +73 -0
- package/src/rules/no-exposed-debug-endpoints/no-exposed-debug-endpoints.test.ts +40 -0
- package/src/rules/no-exposed-sensitive-data/index.ts +428 -0
- package/src/rules/no-exposed-sensitive-data/no-exposed-sensitive-data.test.ts +75 -0
- package/src/rules/no-format-string-injection/index.ts +801 -0
- package/src/rules/no-format-string-injection/no-format-string-injection.test.ts +437 -0
- package/src/rules/no-graphql-injection/index.ts +508 -0
- package/src/rules/no-graphql-injection/no-graphql-injection.test.ts +371 -0
- package/src/rules/no-hardcoded-credentials/index.ts +478 -0
- package/src/rules/no-hardcoded-credentials/no-hardcoded-credentials.test.ts +639 -0
- package/src/rules/no-hardcoded-session-tokens/index.ts +69 -0
- package/src/rules/no-hardcoded-session-tokens/no-hardcoded-session-tokens.test.ts +42 -0
- package/src/rules/no-http-urls/index.ts +131 -0
- package/src/rules/no-http-urls/no-http-urls.test.ts +60 -0
- package/src/rules/no-improper-sanitization/index.ts +502 -0
- package/src/rules/no-improper-sanitization/no-improper-sanitization.test.ts +156 -0
- package/src/rules/no-improper-type-validation/index.ts +572 -0
- package/src/rules/no-improper-type-validation/no-improper-type-validation.test.ts +372 -0
- package/src/rules/no-insecure-comparison/index.ts +232 -0
- package/src/rules/no-insecure-comparison/no-insecure-comparison.test.ts +218 -0
- package/src/rules/no-insecure-cookie-settings/index.ts +391 -0
- package/src/rules/no-insecure-cookie-settings/no-insecure-cookie-settings.test.ts +409 -0
- package/src/rules/no-insecure-jwt/index.ts +467 -0
- package/src/rules/no-insecure-jwt/no-insecure-jwt.test.ts +259 -0
- package/src/rules/no-insecure-redirects/index.ts +267 -0
- package/src/rules/no-insecure-redirects/no-insecure-redirects.test.ts +108 -0
- package/src/rules/no-insecure-websocket/index.ts +72 -0
- package/src/rules/no-insecure-websocket/no-insecure-websocket.test.ts +42 -0
- package/src/rules/no-insufficient-postmessage-validation/index.ts +497 -0
- package/src/rules/no-insufficient-postmessage-validation/no-insufficient-postmessage-validation.test.ts +360 -0
- package/src/rules/no-insufficient-random/index.ts +288 -0
- package/src/rules/no-insufficient-random/no-insufficient-random.test.ts +246 -0
- package/src/rules/no-ldap-injection/index.ts +547 -0
- package/src/rules/no-ldap-injection/no-ldap-injection.test.ts +317 -0
- package/src/rules/no-missing-authentication/index.ts +408 -0
- package/src/rules/no-missing-authentication/no-missing-authentication.test.ts +350 -0
- package/src/rules/no-missing-cors-check/index.ts +453 -0
- package/src/rules/no-missing-cors-check/no-missing-cors-check.test.ts +392 -0
- package/src/rules/no-missing-csrf-protection/index.ts +229 -0
- package/src/rules/no-missing-csrf-protection/no-missing-csrf-protection.test.ts +222 -0
- package/src/rules/no-missing-security-headers/index.ts +266 -0
- package/src/rules/no-missing-security-headers/no-missing-security-headers.test.ts +98 -0
- package/src/rules/no-password-in-url/index.ts +64 -0
- package/src/rules/no-password-in-url/no-password-in-url.test.ts +27 -0
- package/src/rules/no-permissive-cors/index.ts +78 -0
- package/src/rules/no-permissive-cors/no-permissive-cors.test.ts +28 -0
- package/src/rules/no-pii-in-logs/index.ts +83 -0
- package/src/rules/no-pii-in-logs/no-pii-in-logs.test.ts +26 -0
- package/src/rules/no-postmessage-origin-wildcard/index.ts +67 -0
- package/src/rules/no-postmessage-origin-wildcard/no-postmessage-origin-wildcard.test.ts +27 -0
- package/src/rules/no-privilege-escalation/index.ts +403 -0
- package/src/rules/no-privilege-escalation/no-privilege-escalation.test.ts +306 -0
- package/src/rules/no-redos-vulnerable-regex/index.ts +379 -0
- package/src/rules/no-redos-vulnerable-regex/no-redos-vulnerable-regex.test.ts +83 -0
- package/src/rules/no-sensitive-data-exposure/index.ts +294 -0
- package/src/rules/no-sensitive-data-exposure/no-sensitive-data-exposure.test.ts +262 -0
- package/src/rules/no-sensitive-data-in-analytics/index.ts +73 -0
- package/src/rules/no-sensitive-data-in-analytics/no-sensitive-data-in-analytics.test.ts +42 -0
- package/src/rules/no-sensitive-data-in-cache/index.ts +59 -0
- package/src/rules/no-sensitive-data-in-cache/no-sensitive-data-in-cache.test.ts +32 -0
- package/src/rules/no-sql-injection/index.ts +424 -0
- package/src/rules/no-sql-injection/no-sql-injection.test.ts +303 -0
- package/src/rules/no-timing-attack/index.ts +552 -0
- package/src/rules/no-timing-attack/no-timing-attack.test.ts +348 -0
- package/src/rules/no-toctou-vulnerability/index.ts +250 -0
- package/src/rules/no-toctou-vulnerability/no-toctou-vulnerability.test.ts +60 -0
- package/src/rules/no-tracking-without-consent/index.ts +78 -0
- package/src/rules/no-tracking-without-consent/no-tracking-without-consent.test.ts +34 -0
- package/src/rules/no-unchecked-loop-condition/index.ts +781 -0
- package/src/rules/no-unchecked-loop-condition/no-unchecked-loop-condition.test.ts +459 -0
- package/src/rules/no-unencrypted-local-storage/index.ts +73 -0
- package/src/rules/no-unencrypted-local-storage/no-unencrypted-local-storage.test.ts +41 -0
- package/src/rules/no-unencrypted-transmission/index.ts +296 -0
- package/src/rules/no-unencrypted-transmission/no-unencrypted-transmission.test.ts +287 -0
- package/src/rules/no-unescaped-url-parameter/index.ts +424 -0
- package/src/rules/no-unescaped-url-parameter/no-unescaped-url-parameter.test.ts +263 -0
- package/src/rules/no-unlimited-resource-allocation/index.ts +767 -0
- package/src/rules/no-unlimited-resource-allocation/no-unlimited-resource-allocation.test.ts +544 -0
- package/src/rules/no-unsafe-deserialization/index.ts +593 -0
- package/src/rules/no-unsafe-deserialization/no-unsafe-deserialization.test.ts +310 -0
- package/src/rules/no-unsafe-dynamic-require/index.ts +125 -0
- package/src/rules/no-unsafe-dynamic-require/no-unsafe-dynamic-require.test.ts +151 -0
- package/src/rules/no-unsafe-regex-construction/index.ts +370 -0
- package/src/rules/no-unsafe-regex-construction/no-unsafe-regex-construction.test.ts +181 -0
- package/src/rules/no-unsanitized-html/index.ts +400 -0
- package/src/rules/no-unsanitized-html/no-unsanitized-html.test.ts +488 -0
- package/src/rules/no-unvalidated-deeplinks/index.ts +73 -0
- package/src/rules/no-unvalidated-deeplinks/no-unvalidated-deeplinks.test.ts +29 -0
- package/src/rules/no-unvalidated-user-input/index.ts +498 -0
- package/src/rules/no-unvalidated-user-input/no-unvalidated-user-input.test.ts +463 -0
- package/src/rules/no-verbose-error-messages/index.ts +83 -0
- package/src/rules/no-verbose-error-messages/no-verbose-error-messages.test.ts +34 -0
- package/src/rules/no-weak-crypto/index.ts +447 -0
- package/src/rules/no-weak-crypto/no-weak-crypto.test.ts +297 -0
- package/src/rules/no-weak-password-recovery/index.ts +509 -0
- package/src/rules/no-weak-password-recovery/no-weak-password-recovery.test.ts +184 -0
- package/src/rules/no-xpath-injection/index.ts +596 -0
- package/src/rules/no-xpath-injection/no-xpath-injection.test.ts +405 -0
- package/src/rules/no-xxe-injection/index.ts +342 -0
- package/src/rules/no-xxe-injection/no-xxe-injection.test.ts +122 -0
- package/src/rules/no-zip-slip/index.ts +526 -0
- package/src/rules/no-zip-slip/no-zip-slip.test.ts +305 -0
- package/src/rules/require-backend-authorization/index.ts +71 -0
- package/src/rules/require-backend-authorization/require-backend-authorization.test.ts +31 -0
- package/src/rules/require-code-minification/index.ts +54 -0
- package/src/rules/require-code-minification/require-code-minification.test.ts +30 -0
- package/src/rules/require-csp-headers/index.ts +74 -0
- package/src/rules/require-csp-headers/require-csp-headers.test.ts +34 -0
- package/src/rules/require-data-minimization/index.ts +65 -0
- package/src/rules/require-data-minimization/require-data-minimization.test.ts +31 -0
- package/src/rules/require-dependency-integrity/index.ts +78 -0
- package/src/rules/require-dependency-integrity/require-dependency-integrity.test.ts +44 -0
- package/src/rules/require-https-only/index.ts +75 -0
- package/src/rules/require-https-only/require-https-only.test.ts +26 -0
- package/src/rules/require-mime-type-validation/index.ts +77 -0
- package/src/rules/require-mime-type-validation/require-mime-type-validation.test.ts +32 -0
- package/src/rules/require-network-timeout/index.ts +58 -0
- package/src/rules/require-network-timeout/require-network-timeout.test.ts +26 -0
- package/src/rules/require-package-lock/index.ts +75 -0
- package/src/rules/require-package-lock/require-package-lock.test.ts +27 -0
- package/src/rules/require-secure-credential-storage/index.ts +60 -0
- package/src/rules/require-secure-credential-storage/require-secure-credential-storage.test.ts +26 -0
- package/src/rules/require-secure-defaults/index.ts +54 -0
- package/src/rules/require-secure-defaults/require-secure-defaults.test.ts +26 -0
- package/src/rules/require-secure-deletion/index.ts +52 -0
- package/src/rules/require-secure-deletion/require-secure-deletion.test.ts +29 -0
- package/src/rules/require-storage-encryption/index.ts +60 -0
- package/src/rules/require-storage-encryption/require-storage-encryption.test.ts +26 -0
- package/src/rules/require-url-validation/index.ts +85 -0
- package/src/rules/require-url-validation/require-url-validation.test.ts +32 -0
- package/src/types/{index.d.ts → index.ts} +157 -53
- package/src/index.d.ts +0 -32
- package/src/index.js +0 -465
- package/src/rules/database-injection/index.d.ts +0 -13
- package/src/rules/database-injection/index.js +0 -406
- package/src/rules/detect-child-process/index.d.ts +0 -11
- package/src/rules/detect-child-process/index.js +0 -529
- package/src/rules/detect-eval-with-expression/index.d.ts +0 -9
- package/src/rules/detect-eval-with-expression/index.js +0 -392
- package/src/rules/detect-mixed-content/index.d.ts +0 -8
- package/src/rules/detect-mixed-content/index.js +0 -44
- package/src/rules/detect-non-literal-fs-filename/index.d.ts +0 -7
- package/src/rules/detect-non-literal-fs-filename/index.js +0 -454
- package/src/rules/detect-non-literal-regexp/index.d.ts +0 -9
- package/src/rules/detect-non-literal-regexp/index.js +0 -403
- package/src/rules/detect-object-injection/index.d.ts +0 -11
- package/src/rules/detect-object-injection/index.js +0 -560
- package/src/rules/detect-suspicious-dependencies/index.d.ts +0 -8
- package/src/rules/detect-suspicious-dependencies/index.js +0 -71
- package/src/rules/detect-weak-password-validation/index.d.ts +0 -6
- package/src/rules/detect-weak-password-validation/index.js +0 -58
- package/src/rules/no-allow-arbitrary-loads/index.d.ts +0 -8
- package/src/rules/no-allow-arbitrary-loads/index.js +0 -47
- package/src/rules/no-arbitrary-file-access/index.d.ts +0 -13
- package/src/rules/no-arbitrary-file-access/index.js +0 -195
- package/src/rules/no-buffer-overread/index.d.ts +0 -29
- package/src/rules/no-buffer-overread/index.js +0 -606
- package/src/rules/no-clickjacking/index.d.ts +0 -10
- package/src/rules/no-clickjacking/index.js +0 -396
- package/src/rules/no-client-side-auth-logic/index.d.ts +0 -6
- package/src/rules/no-client-side-auth-logic/index.js +0 -69
- package/src/rules/no-credentials-in-query-params/index.d.ts +0 -8
- package/src/rules/no-credentials-in-query-params/index.js +0 -57
- package/src/rules/no-credentials-in-storage-api/index.d.ts +0 -6
- package/src/rules/no-credentials-in-storage-api/index.js +0 -54
- package/src/rules/no-data-in-temp-storage/index.d.ts +0 -6
- package/src/rules/no-data-in-temp-storage/index.js +0 -64
- package/src/rules/no-debug-code-in-production/index.d.ts +0 -8
- package/src/rules/no-debug-code-in-production/index.js +0 -51
- package/src/rules/no-directive-injection/index.d.ts +0 -12
- package/src/rules/no-directive-injection/index.js +0 -457
- package/src/rules/no-disabled-certificate-validation/index.d.ts +0 -6
- package/src/rules/no-disabled-certificate-validation/index.js +0 -61
- package/src/rules/no-document-cookie/index.d.ts +0 -5
- package/src/rules/no-document-cookie/index.js +0 -89
- package/src/rules/no-dynamic-dependency-loading/index.d.ts +0 -8
- package/src/rules/no-dynamic-dependency-loading/index.js +0 -51
- package/src/rules/no-electron-security-issues/index.d.ts +0 -10
- package/src/rules/no-electron-security-issues/index.js +0 -423
- package/src/rules/no-exposed-debug-endpoints/index.d.ts +0 -6
- package/src/rules/no-exposed-debug-endpoints/index.js +0 -62
- package/src/rules/no-exposed-sensitive-data/index.d.ts +0 -11
- package/src/rules/no-exposed-sensitive-data/index.js +0 -340
- package/src/rules/no-format-string-injection/index.d.ts +0 -17
- package/src/rules/no-format-string-injection/index.js +0 -660
- package/src/rules/no-graphql-injection/index.d.ts +0 -12
- package/src/rules/no-graphql-injection/index.js +0 -411
- package/src/rules/no-hardcoded-credentials/index.d.ts +0 -26
- package/src/rules/no-hardcoded-credentials/index.js +0 -376
- package/src/rules/no-hardcoded-session-tokens/index.d.ts +0 -6
- package/src/rules/no-hardcoded-session-tokens/index.js +0 -59
- package/src/rules/no-http-urls/index.d.ts +0 -12
- package/src/rules/no-http-urls/index.js +0 -114
- package/src/rules/no-improper-sanitization/index.d.ts +0 -12
- package/src/rules/no-improper-sanitization/index.js +0 -411
- package/src/rules/no-improper-type-validation/index.d.ts +0 -10
- package/src/rules/no-improper-type-validation/index.js +0 -475
- package/src/rules/no-insecure-comparison/index.d.ts +0 -7
- package/src/rules/no-insecure-comparison/index.js +0 -193
- package/src/rules/no-insecure-cookie-settings/index.d.ts +0 -9
- package/src/rules/no-insecure-cookie-settings/index.js +0 -306
- package/src/rules/no-insecure-jwt/index.d.ts +0 -10
- package/src/rules/no-insecure-jwt/index.js +0 -380
- package/src/rules/no-insecure-redirects/index.d.ts +0 -7
- package/src/rules/no-insecure-redirects/index.js +0 -216
- package/src/rules/no-insecure-websocket/index.d.ts +0 -6
- package/src/rules/no-insecure-websocket/index.js +0 -61
- package/src/rules/no-insufficient-postmessage-validation/index.d.ts +0 -14
- package/src/rules/no-insufficient-postmessage-validation/index.js +0 -392
- package/src/rules/no-insufficient-random/index.d.ts +0 -9
- package/src/rules/no-insufficient-random/index.js +0 -208
- package/src/rules/no-ldap-injection/index.d.ts +0 -10
- package/src/rules/no-ldap-injection/index.js +0 -455
- package/src/rules/no-missing-authentication/index.d.ts +0 -13
- package/src/rules/no-missing-authentication/index.js +0 -333
- package/src/rules/no-missing-cors-check/index.d.ts +0 -9
- package/src/rules/no-missing-cors-check/index.js +0 -399
- package/src/rules/no-missing-csrf-protection/index.d.ts +0 -11
- package/src/rules/no-missing-csrf-protection/index.js +0 -180
- package/src/rules/no-missing-security-headers/index.d.ts +0 -7
- package/src/rules/no-missing-security-headers/index.js +0 -218
- package/src/rules/no-password-in-url/index.d.ts +0 -8
- package/src/rules/no-password-in-url/index.js +0 -54
- package/src/rules/no-permissive-cors/index.d.ts +0 -8
- package/src/rules/no-permissive-cors/index.js +0 -65
- package/src/rules/no-pii-in-logs/index.d.ts +0 -8
- package/src/rules/no-pii-in-logs/index.js +0 -70
- package/src/rules/no-postmessage-origin-wildcard/index.d.ts +0 -8
- package/src/rules/no-postmessage-origin-wildcard/index.js +0 -56
- package/src/rules/no-privilege-escalation/index.d.ts +0 -13
- package/src/rules/no-privilege-escalation/index.js +0 -321
- package/src/rules/no-redos-vulnerable-regex/index.d.ts +0 -7
- package/src/rules/no-redos-vulnerable-regex/index.js +0 -306
- package/src/rules/no-sensitive-data-exposure/index.d.ts +0 -11
- package/src/rules/no-sensitive-data-exposure/index.js +0 -250
- package/src/rules/no-sensitive-data-in-analytics/index.d.ts +0 -8
- package/src/rules/no-sensitive-data-in-analytics/index.js +0 -62
- package/src/rules/no-sensitive-data-in-cache/index.d.ts +0 -8
- package/src/rules/no-sensitive-data-in-cache/index.js +0 -52
- package/src/rules/no-sql-injection/index.d.ts +0 -10
- package/src/rules/no-sql-injection/index.js +0 -335
- package/src/rules/no-timing-attack/index.d.ts +0 -10
- package/src/rules/no-timing-attack/index.js +0 -447
- package/src/rules/no-toctou-vulnerability/index.d.ts +0 -7
- package/src/rules/no-toctou-vulnerability/index.js +0 -208
- package/src/rules/no-tracking-without-consent/index.d.ts +0 -6
- package/src/rules/no-tracking-without-consent/index.js +0 -67
- package/src/rules/no-unchecked-loop-condition/index.d.ts +0 -12
- package/src/rules/no-unchecked-loop-condition/index.js +0 -646
- package/src/rules/no-unencrypted-local-storage/index.d.ts +0 -8
- package/src/rules/no-unencrypted-local-storage/index.js +0 -61
- package/src/rules/no-unencrypted-transmission/index.d.ts +0 -11
- package/src/rules/no-unencrypted-transmission/index.js +0 -236
- package/src/rules/no-unescaped-url-parameter/index.d.ts +0 -9
- package/src/rules/no-unescaped-url-parameter/index.js +0 -355
- package/src/rules/no-unlimited-resource-allocation/index.d.ts +0 -12
- package/src/rules/no-unlimited-resource-allocation/index.js +0 -643
- package/src/rules/no-unsafe-deserialization/index.d.ts +0 -10
- package/src/rules/no-unsafe-deserialization/index.js +0 -491
- package/src/rules/no-unsafe-dynamic-require/index.d.ts +0 -5
- package/src/rules/no-unsafe-dynamic-require/index.js +0 -106
- package/src/rules/no-unsafe-regex-construction/index.d.ts +0 -9
- package/src/rules/no-unsafe-regex-construction/index.js +0 -291
- package/src/rules/no-unsanitized-html/index.d.ts +0 -9
- package/src/rules/no-unsanitized-html/index.js +0 -335
- package/src/rules/no-unvalidated-deeplinks/index.d.ts +0 -6
- package/src/rules/no-unvalidated-deeplinks/index.js +0 -62
- package/src/rules/no-unvalidated-user-input/index.d.ts +0 -9
- package/src/rules/no-unvalidated-user-input/index.js +0 -420
- package/src/rules/no-verbose-error-messages/index.d.ts +0 -8
- package/src/rules/no-verbose-error-messages/index.js +0 -68
- package/src/rules/no-weak-crypto/index.d.ts +0 -11
- package/src/rules/no-weak-crypto/index.js +0 -351
- package/src/rules/no-weak-password-recovery/index.d.ts +0 -12
- package/src/rules/no-weak-password-recovery/index.js +0 -424
- package/src/rules/no-xpath-injection/index.d.ts +0 -10
- package/src/rules/no-xpath-injection/index.js +0 -487
- package/src/rules/no-xxe-injection/index.d.ts +0 -7
- package/src/rules/no-xxe-injection/index.js +0 -266
- package/src/rules/no-zip-slip/index.d.ts +0 -9
- package/src/rules/no-zip-slip/index.js +0 -445
- package/src/rules/require-backend-authorization/index.d.ts +0 -6
- package/src/rules/require-backend-authorization/index.js +0 -60
- package/src/rules/require-code-minification/index.d.ts +0 -8
- package/src/rules/require-code-minification/index.js +0 -47
- package/src/rules/require-csp-headers/index.d.ts +0 -6
- package/src/rules/require-csp-headers/index.js +0 -64
- package/src/rules/require-data-minimization/index.d.ts +0 -8
- package/src/rules/require-data-minimization/index.js +0 -53
- package/src/rules/require-dependency-integrity/index.d.ts +0 -6
- package/src/rules/require-dependency-integrity/index.js +0 -64
- package/src/rules/require-https-only/index.d.ts +0 -8
- package/src/rules/require-https-only/index.js +0 -62
- package/src/rules/require-mime-type-validation/index.d.ts +0 -6
- package/src/rules/require-mime-type-validation/index.js +0 -66
- package/src/rules/require-network-timeout/index.d.ts +0 -8
- package/src/rules/require-network-timeout/index.js +0 -50
- package/src/rules/require-package-lock/index.d.ts +0 -8
- package/src/rules/require-package-lock/index.js +0 -63
- package/src/rules/require-secure-credential-storage/index.d.ts +0 -8
- package/src/rules/require-secure-credential-storage/index.js +0 -50
- package/src/rules/require-secure-defaults/index.d.ts +0 -8
- package/src/rules/require-secure-defaults/index.js +0 -47
- package/src/rules/require-secure-deletion/index.d.ts +0 -8
- package/src/rules/require-secure-deletion/index.js +0 -44
- package/src/rules/require-storage-encryption/index.d.ts +0 -8
- package/src/rules/require-storage-encryption/index.js +0 -50
- package/src/rules/require-url-validation/index.d.ts +0 -6
- package/src/rules/require-url-validation/index.js +0 -72
- package/src/types/index.js +0 -17
package/README.md
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
[](https://www.npmjs.com/package/eslint-plugin-secure-coding)
|
|
7
7
|
[](https://opensource.org/licenses/MIT)
|
|
8
8
|
[](https://app.codecov.io/gh/ofri-peretz/eslint/components?components%5B0%5D=secure_coding)
|
|
9
|
+
[](https://github.com/ofri-peretz/eslint)
|
|
9
10
|
|
|
10
11
|
> **A complete security standard:** This plugin provides **full mitigation** for both **OWASP Top 10 Web (2021)** AND **OWASP Mobile Top 10 (2024)**.
|
|
11
12
|
> With **78 active rules** (+ 11 deprecated) mapped to CWE and CVSS, it transforms your linter into an enterprise-grade security auditor that AI assistants can understand and fix.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-secure-coding",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.3",
|
|
4
4
|
"description": "Security-focused ESLint plugin with 89 AI-parseable rules for detecting and preventing vulnerabilities. OWASP Top 10 2021 + Mobile Top 10 2024 coverage, CWE references, and AI-assisted fix guidance.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -72,15 +72,8 @@
|
|
|
72
72
|
"@interlace/eslint-devkit": "^1.2.1",
|
|
73
73
|
"tslib": "^2.3.0"
|
|
74
74
|
},
|
|
75
|
-
"scripts": {
|
|
76
|
-
"test": "vitest run",
|
|
77
|
-
"test:watch": "vitest watch",
|
|
78
|
-
"test:coverage": "vitest run --coverage"
|
|
79
|
-
},
|
|
80
75
|
"devDependencies": {
|
|
81
76
|
"@typescript-eslint/parser": "^8.46.2",
|
|
82
|
-
"@typescript-eslint/rule-tester": "^8.46.2"
|
|
83
|
-
"@vitest/coverage-v8": "^4.0.6",
|
|
84
|
-
"vitest": "^4.0.6"
|
|
77
|
+
"@typescript-eslint/rule-tester": "^8.46.2"
|
|
85
78
|
}
|
|
86
|
-
}
|
|
79
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,605 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* eslint-plugin-secure-coding
|
|
3
|
+
*
|
|
4
|
+
* A comprehensive security-focused ESLint plugin with 48+ rules
|
|
5
|
+
* for detecting and preventing security vulnerabilities in JavaScript/TypeScript code.
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - LLM-optimized error messages with CWE references
|
|
9
|
+
* - OWASP Top 10 coverage
|
|
10
|
+
* - Auto-fix capabilities where safe
|
|
11
|
+
* - Structured context for AI assistants
|
|
12
|
+
*
|
|
13
|
+
* @see https://github.com/ofri-peretz/eslint#readme
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
// Security rules - Injection
|
|
18
|
+
import { noSqlInjection } from './rules/no-sql-injection';
|
|
19
|
+
import { databaseInjection } from './rules/database-injection';
|
|
20
|
+
import { detectEvalWithExpression } from './rules/detect-eval-with-expression';
|
|
21
|
+
import { detectChildProcess } from './rules/detect-child-process';
|
|
22
|
+
import { noUnsafeDynamicRequire } from './rules/no-unsafe-dynamic-require';
|
|
23
|
+
import { noGraphqlInjection } from './rules/no-graphql-injection';
|
|
24
|
+
import { noXxeInjection } from './rules/no-xxe-injection';
|
|
25
|
+
import { noXpathInjection } from './rules/no-xpath-injection';
|
|
26
|
+
import { noLdapInjection } from './rules/no-ldap-injection';
|
|
27
|
+
import { noDirectiveInjection } from './rules/no-directive-injection';
|
|
28
|
+
import { noFormatStringInjection } from './rules/no-format-string-injection';
|
|
29
|
+
|
|
30
|
+
// Security rules - Path & File
|
|
31
|
+
import { detectNonLiteralFsFilename } from './rules/detect-non-literal-fs-filename';
|
|
32
|
+
import { noZipSlip } from './rules/no-zip-slip';
|
|
33
|
+
import { noToctouVulnerability } from './rules/no-toctou-vulnerability';
|
|
34
|
+
|
|
35
|
+
// Security rules - Regex
|
|
36
|
+
import { detectNonLiteralRegexp } from './rules/detect-non-literal-regexp';
|
|
37
|
+
import { noRedosVulnerableRegex } from './rules/no-redos-vulnerable-regex';
|
|
38
|
+
import { noUnsafeRegexConstruction } from './rules/no-unsafe-regex-construction';
|
|
39
|
+
|
|
40
|
+
// Security rules - Object & Prototype
|
|
41
|
+
import { detectObjectInjection } from './rules/detect-object-injection';
|
|
42
|
+
import { noUnsafeDeserialization } from './rules/no-unsafe-deserialization';
|
|
43
|
+
|
|
44
|
+
// Security rules - Credentials & Crypto
|
|
45
|
+
import { noHardcodedCredentials } from './rules/no-hardcoded-credentials';
|
|
46
|
+
import { noWeakCrypto } from './rules/no-weak-crypto';
|
|
47
|
+
import { noInsufficientRandom } from './rules/no-insufficient-random';
|
|
48
|
+
import { noTimingAttack } from './rules/no-timing-attack';
|
|
49
|
+
import { noInsecureComparison } from './rules/no-insecure-comparison';
|
|
50
|
+
import { noInsecureJwt } from './rules/no-insecure-jwt';
|
|
51
|
+
|
|
52
|
+
// Security rules - Input Validation & XSS
|
|
53
|
+
import { noUnvalidatedUserInput } from './rules/no-unvalidated-user-input';
|
|
54
|
+
import { noUnsanitizedHtml } from './rules/no-unsanitized-html';
|
|
55
|
+
import { noUnescapedUrlParameter } from './rules/no-unescaped-url-parameter';
|
|
56
|
+
import { noImproperSanitization } from './rules/no-improper-sanitization';
|
|
57
|
+
import { noImproperTypeValidation } from './rules/no-improper-type-validation';
|
|
58
|
+
|
|
59
|
+
// Security rules - Authentication & Authorization
|
|
60
|
+
import { noMissingAuthentication } from './rules/no-missing-authentication';
|
|
61
|
+
import { noPrivilegeEscalation } from './rules/no-privilege-escalation';
|
|
62
|
+
import { noWeakPasswordRecovery } from './rules/no-weak-password-recovery';
|
|
63
|
+
|
|
64
|
+
// Security rules - Session & Cookies
|
|
65
|
+
import { noInsecureCookieSettings } from './rules/no-insecure-cookie-settings';
|
|
66
|
+
import { noMissingCsrfProtection } from './rules/no-missing-csrf-protection';
|
|
67
|
+
import { noDocumentCookie } from './rules/no-document-cookie';
|
|
68
|
+
|
|
69
|
+
// Security rules - Network & Headers
|
|
70
|
+
import { noMissingCorsCheck } from './rules/no-missing-cors-check';
|
|
71
|
+
import { noMissingSecurityHeaders } from './rules/no-missing-security-headers';
|
|
72
|
+
import { noInsecureRedirects } from './rules/no-insecure-redirects';
|
|
73
|
+
import { noUnencryptedTransmission } from './rules/no-unencrypted-transmission';
|
|
74
|
+
import { noClickjacking } from './rules/no-clickjacking';
|
|
75
|
+
|
|
76
|
+
// Security rules - Data Exposure
|
|
77
|
+
import { noExposedSensitiveData } from './rules/no-exposed-sensitive-data';
|
|
78
|
+
import { noSensitiveDataExposure } from './rules/no-sensitive-data-exposure';
|
|
79
|
+
|
|
80
|
+
// Security rules - Buffer & Memory
|
|
81
|
+
import { noBufferOverread } from './rules/no-buffer-overread';
|
|
82
|
+
|
|
83
|
+
// Security rules - Resource & DoS
|
|
84
|
+
import { noUnlimitedResourceAllocation } from './rules/no-unlimited-resource-allocation';
|
|
85
|
+
import { noUncheckedLoopCondition } from './rules/no-unchecked-loop-condition';
|
|
86
|
+
|
|
87
|
+
// Security rules - Platform Specific
|
|
88
|
+
import { noElectronSecurityIssues } from './rules/no-electron-security-issues';
|
|
89
|
+
import { noInsufficientPostmessageValidation } from './rules/no-insufficient-postmessage-validation';
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
// OWASP Mobile Top 10 2023/2024 - Mobile Security Rules (40 rules)
|
|
93
|
+
// M1: Improper Credential Usage (3 rules)
|
|
94
|
+
import { noCredentialsInStorageApi } from './rules/no-credentials-in-storage-api';
|
|
95
|
+
import { noCredentialsInQueryParams } from './rules/no-credentials-in-query-params';
|
|
96
|
+
import { requireSecureCredentialStorage } from './rules/require-secure-credential-storage';
|
|
97
|
+
|
|
98
|
+
// M2: Inadequate Supply Chain Security (4 rules)
|
|
99
|
+
import { requireDependencyIntegrity } from './rules/require-dependency-integrity';
|
|
100
|
+
import { detectSuspiciousDependencies } from './rules/detect-suspicious-dependencies';
|
|
101
|
+
import { noDynamicDependencyLoading } from './rules/no-dynamic-dependency-loading';
|
|
102
|
+
import { requirePackageLock } from './rules/require-package-lock';
|
|
103
|
+
|
|
104
|
+
// M3: Insecure Authentication/Authorization (5 rules)
|
|
105
|
+
import { noClientSideAuthLogic } from './rules/no-client-side-auth-logic';
|
|
106
|
+
import { requireBackendAuthorization } from './rules/require-backend-authorization';
|
|
107
|
+
import { noHardcodedSessionTokens } from './rules/no-hardcoded-session-tokens';
|
|
108
|
+
import { detectWeakPasswordValidation } from './rules/detect-weak-password-validation';
|
|
109
|
+
import { noPasswordInUrl } from './rules/no-password-in-url';
|
|
110
|
+
|
|
111
|
+
// M4: Insufficient Input/Output Validation (6 rules)
|
|
112
|
+
import { noUnvalidatedDeeplinks } from './rules/no-unvalidated-deeplinks';
|
|
113
|
+
import { requireUrlValidation } from './rules/require-url-validation';
|
|
114
|
+
import { noArbitraryFileAccess } from './rules/no-arbitrary-file-access';
|
|
115
|
+
import { requireMimeTypeValidation } from './rules/require-mime-type-validation';
|
|
116
|
+
import { noPostmessageOriginWildcard } from './rules/no-postmessage-origin-wildcard';
|
|
117
|
+
import { requireCspHeaders } from './rules/require-csp-headers';
|
|
118
|
+
|
|
119
|
+
// M5: Insecure Communication (7 rules)
|
|
120
|
+
import { noHttpUrls } from './rules/no-http-urls';
|
|
121
|
+
import { noDisabledCertificateValidation } from './rules/no-disabled-certificate-validation';
|
|
122
|
+
import { requireHttpsOnly } from './rules/require-https-only';
|
|
123
|
+
import { noInsecureWebsocket } from './rules/no-insecure-websocket';
|
|
124
|
+
import { detectMixedContent } from './rules/detect-mixed-content';
|
|
125
|
+
import { noAllowArbitraryLoads } from './rules/no-allow-arbitrary-loads';
|
|
126
|
+
import { requireNetworkTimeout } from './rules/require-network-timeout';
|
|
127
|
+
|
|
128
|
+
// M6: Inadequate Privacy Controls (4 rules)
|
|
129
|
+
import { noPiiInLogs } from './rules/no-pii-in-logs';
|
|
130
|
+
import { noTrackingWithoutConsent } from './rules/no-tracking-without-consent';
|
|
131
|
+
import { requireDataMinimization } from './rules/require-data-minimization';
|
|
132
|
+
import { noSensitiveDataInAnalytics } from './rules/no-sensitive-data-in-analytics';
|
|
133
|
+
|
|
134
|
+
// M7: Insufficient Binary Protections (2 rules)
|
|
135
|
+
import { noDebugCodeInProduction } from './rules/no-debug-code-in-production';
|
|
136
|
+
import { requireCodeMinification } from './rules/require-code-minification';
|
|
137
|
+
|
|
138
|
+
// M8: Security Misconfiguration (4 rules)
|
|
139
|
+
import { noVerboseErrorMessages } from './rules/no-verbose-error-messages';
|
|
140
|
+
import { noExposedDebugEndpoints } from './rules/no-exposed-debug-endpoints';
|
|
141
|
+
import { requireSecureDefaults } from './rules/require-secure-defaults';
|
|
142
|
+
import { noPermissiveCors } from './rules/no-permissive-cors';
|
|
143
|
+
|
|
144
|
+
// M9: Insecure Data Storage (5 rules)
|
|
145
|
+
import { noUnencryptedLocalStorage } from './rules/no-unencrypted-local-storage';
|
|
146
|
+
import { noSensitiveDataInCache } from './rules/no-sensitive-data-in-cache';
|
|
147
|
+
import { requireStorageEncryption } from './rules/require-storage-encryption';
|
|
148
|
+
import { noDataInTempStorage } from './rules/no-data-in-temp-storage';
|
|
149
|
+
import { requireSecureDeletion } from './rules/require-secure-deletion';
|
|
150
|
+
|
|
151
|
+
import { TSESLint } from '@interlace/eslint-devkit';
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Collection of all security ESLint rules
|
|
155
|
+
*/
|
|
156
|
+
export const rules: Record<string, TSESLint.RuleModule<string, readonly unknown[]>> = {
|
|
157
|
+
// Flat rule names (recommended usage)
|
|
158
|
+
'no-sql-injection': noSqlInjection,
|
|
159
|
+
'database-injection': databaseInjection,
|
|
160
|
+
'detect-eval-with-expression': detectEvalWithExpression,
|
|
161
|
+
'detect-child-process': detectChildProcess,
|
|
162
|
+
'no-unsafe-dynamic-require': noUnsafeDynamicRequire,
|
|
163
|
+
'no-graphql-injection': noGraphqlInjection,
|
|
164
|
+
'no-xxe-injection': noXxeInjection,
|
|
165
|
+
'no-xpath-injection': noXpathInjection,
|
|
166
|
+
'no-ldap-injection': noLdapInjection,
|
|
167
|
+
'no-directive-injection': noDirectiveInjection,
|
|
168
|
+
'no-format-string-injection': noFormatStringInjection,
|
|
169
|
+
'detect-non-literal-fs-filename': detectNonLiteralFsFilename,
|
|
170
|
+
'no-zip-slip': noZipSlip,
|
|
171
|
+
'no-toctou-vulnerability': noToctouVulnerability,
|
|
172
|
+
'detect-non-literal-regexp': detectNonLiteralRegexp,
|
|
173
|
+
'no-redos-vulnerable-regex': noRedosVulnerableRegex,
|
|
174
|
+
'no-unsafe-regex-construction': noUnsafeRegexConstruction,
|
|
175
|
+
'detect-object-injection': detectObjectInjection,
|
|
176
|
+
'no-unsafe-deserialization': noUnsafeDeserialization,
|
|
177
|
+
'no-hardcoded-credentials': noHardcodedCredentials,
|
|
178
|
+
'no-weak-crypto': noWeakCrypto,
|
|
179
|
+
'no-insufficient-random': noInsufficientRandom,
|
|
180
|
+
'no-timing-attack': noTimingAttack,
|
|
181
|
+
'no-insecure-comparison': noInsecureComparison,
|
|
182
|
+
'no-insecure-jwt': noInsecureJwt,
|
|
183
|
+
'no-unvalidated-user-input': noUnvalidatedUserInput,
|
|
184
|
+
'no-unsanitized-html': noUnsanitizedHtml,
|
|
185
|
+
'no-unescaped-url-parameter': noUnescapedUrlParameter,
|
|
186
|
+
'no-improper-sanitization': noImproperSanitization,
|
|
187
|
+
'no-improper-type-validation': noImproperTypeValidation,
|
|
188
|
+
'no-missing-authentication': noMissingAuthentication,
|
|
189
|
+
'no-privilege-escalation': noPrivilegeEscalation,
|
|
190
|
+
'no-weak-password-recovery': noWeakPasswordRecovery,
|
|
191
|
+
'no-insecure-cookie-settings': noInsecureCookieSettings,
|
|
192
|
+
'no-missing-csrf-protection': noMissingCsrfProtection,
|
|
193
|
+
'no-document-cookie': noDocumentCookie,
|
|
194
|
+
'no-missing-cors-check': noMissingCorsCheck,
|
|
195
|
+
'no-missing-security-headers': noMissingSecurityHeaders,
|
|
196
|
+
'no-insecure-redirects': noInsecureRedirects,
|
|
197
|
+
'no-unencrypted-transmission': noUnencryptedTransmission,
|
|
198
|
+
'no-clickjacking': noClickjacking,
|
|
199
|
+
'no-exposed-sensitive-data': noExposedSensitiveData,
|
|
200
|
+
'no-sensitive-data-exposure': noSensitiveDataExposure,
|
|
201
|
+
'no-buffer-overread': noBufferOverread,
|
|
202
|
+
'no-unlimited-resource-allocation': noUnlimitedResourceAllocation,
|
|
203
|
+
'no-unchecked-loop-condition': noUncheckedLoopCondition,
|
|
204
|
+
'no-electron-security-issues': noElectronSecurityIssues,
|
|
205
|
+
'no-insufficient-postmessage-validation': noInsufficientPostmessageValidation,
|
|
206
|
+
|
|
207
|
+
// OWASP Mobile Top 10 2023/2024 rules (40 rules)
|
|
208
|
+
// M1: Improper Credential Usage (3 rules)
|
|
209
|
+
'no-credentials-in-storage-api': noCredentialsInStorageApi,
|
|
210
|
+
'no-credentials-in-query-params': noCredentialsInQueryParams,
|
|
211
|
+
'require-secure-credential-storage': requireSecureCredentialStorage,
|
|
212
|
+
|
|
213
|
+
// M2: Inadequate Supply Chain Security (4 rules)
|
|
214
|
+
'require-dependency-integrity': requireDependencyIntegrity,
|
|
215
|
+
'detect-suspicious-dependencies': detectSuspiciousDependencies,
|
|
216
|
+
'no-dynamic-dependency-loading': noDynamicDependencyLoading,
|
|
217
|
+
'require-package-lock': requirePackageLock,
|
|
218
|
+
|
|
219
|
+
// M3: Insecure Authentication/Authorization (5 rules)
|
|
220
|
+
'no-client-side-auth-logic': noClientSideAuthLogic,
|
|
221
|
+
'require-backend-authorization': requireBackendAuthorization,
|
|
222
|
+
'no-hardcoded-session-tokens': noHardcodedSessionTokens,
|
|
223
|
+
'detect-weak-password-validation': detectWeakPasswordValidation,
|
|
224
|
+
'no-password-in-url': noPasswordInUrl,
|
|
225
|
+
|
|
226
|
+
// M4: Insufficient Input/Output Validation (6 rules)
|
|
227
|
+
'no-unvalidated-deeplinks': noUnvalidatedDeeplinks,
|
|
228
|
+
'require-url-validation': requireUrlValidation,
|
|
229
|
+
'no-arbitrary-file-access': noArbitraryFileAccess,
|
|
230
|
+
'require-mime-type-validation': requireMimeTypeValidation,
|
|
231
|
+
'no-postmessage-origin-wildcard': noPostmessageOriginWildcard,
|
|
232
|
+
'require-csp-headers': requireCspHeaders,
|
|
233
|
+
|
|
234
|
+
// M5: Insecure Communication (7 rules)
|
|
235
|
+
'no-http-urls': noHttpUrls,
|
|
236
|
+
'no-disabled-certificate-validation': noDisabledCertificateValidation,
|
|
237
|
+
'require-https-only': requireHttpsOnly,
|
|
238
|
+
'no-insecure-websocket': noInsecureWebsocket,
|
|
239
|
+
'detect-mixed-content': detectMixedContent,
|
|
240
|
+
'no-allow-arbitrary-loads': noAllowArbitraryLoads,
|
|
241
|
+
'require-network-timeout': requireNetworkTimeout,
|
|
242
|
+
|
|
243
|
+
// M6: Inadequate Privacy Controls (4 rules)
|
|
244
|
+
'no-pii-in-logs': noPiiInLogs,
|
|
245
|
+
'no-tracking-without-consent': noTrackingWithoutConsent,
|
|
246
|
+
'require-data-minimization': requireDataMinimization,
|
|
247
|
+
'no-sensitive-data-in-analytics': noSensitiveDataInAnalytics,
|
|
248
|
+
|
|
249
|
+
// M7: Insufficient Binary Protections (2 rules)
|
|
250
|
+
'no-debug-code-in-production': noDebugCodeInProduction,
|
|
251
|
+
'require-code-minification': requireCodeMinification,
|
|
252
|
+
|
|
253
|
+
// M8: Security Misconfiguration (4 rules)
|
|
254
|
+
'no-verbose-error-messages': noVerboseErrorMessages,
|
|
255
|
+
'no-exposed-debug-endpoints': noExposedDebugEndpoints,
|
|
256
|
+
'require-secure-defaults': requireSecureDefaults,
|
|
257
|
+
'no-permissive-cors': noPermissiveCors,
|
|
258
|
+
|
|
259
|
+
// M9: Insecure Data Storage (5 rules)
|
|
260
|
+
'no-unencrypted-local-storage': noUnencryptedLocalStorage,
|
|
261
|
+
'no-sensitive-data-in-cache': noSensitiveDataInCache,
|
|
262
|
+
'require-storage-encryption': requireStorageEncryption,
|
|
263
|
+
'no-data-in-temp-storage': noDataInTempStorage,
|
|
264
|
+
'require-secure-deletion': requireSecureDeletion,
|
|
265
|
+
} satisfies Record<string, TSESLint.RuleModule<string, readonly unknown[]>>;
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* ESLint Plugin object
|
|
269
|
+
*/
|
|
270
|
+
export const plugin: TSESLint.FlatConfig.Plugin = {
|
|
271
|
+
meta: {
|
|
272
|
+
name: 'eslint-plugin-secure-coding',
|
|
273
|
+
version: '1.0.0',
|
|
274
|
+
},
|
|
275
|
+
rules,
|
|
276
|
+
} satisfies TSESLint.FlatConfig.Plugin;
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Preset configurations for security rules
|
|
280
|
+
*/
|
|
281
|
+
const recommendedRules: Record<string, TSESLint.FlatConfig.RuleEntry> = {
|
|
282
|
+
// Critical - Injection vulnerabilities (OWASP A03)
|
|
283
|
+
'secure-coding/no-sql-injection': 'error',
|
|
284
|
+
'secure-coding/database-injection': 'error',
|
|
285
|
+
'secure-coding/detect-eval-with-expression': 'error',
|
|
286
|
+
'secure-coding/detect-child-process': 'error',
|
|
287
|
+
'secure-coding/no-unsafe-dynamic-require': 'error',
|
|
288
|
+
'secure-coding/no-graphql-injection': 'error',
|
|
289
|
+
'secure-coding/no-xxe-injection': 'error',
|
|
290
|
+
'secure-coding/no-xpath-injection': 'error',
|
|
291
|
+
'secure-coding/no-ldap-injection': 'error',
|
|
292
|
+
'secure-coding/no-directive-injection': 'error',
|
|
293
|
+
'secure-coding/no-format-string-injection': 'error',
|
|
294
|
+
|
|
295
|
+
// Critical - Path traversal & file operations
|
|
296
|
+
'secure-coding/detect-non-literal-fs-filename': 'error',
|
|
297
|
+
'secure-coding/no-zip-slip': 'error',
|
|
298
|
+
'secure-coding/no-toctou-vulnerability': 'error',
|
|
299
|
+
|
|
300
|
+
// Critical - Deserialization
|
|
301
|
+
'secure-coding/no-unsafe-deserialization': 'error',
|
|
302
|
+
|
|
303
|
+
// High - Regex vulnerabilities
|
|
304
|
+
'secure-coding/detect-non-literal-regexp': 'warn',
|
|
305
|
+
'secure-coding/no-redos-vulnerable-regex': 'error',
|
|
306
|
+
'secure-coding/no-unsafe-regex-construction': 'warn',
|
|
307
|
+
|
|
308
|
+
// High - Prototype pollution
|
|
309
|
+
'secure-coding/detect-object-injection': 'warn',
|
|
310
|
+
|
|
311
|
+
// Critical - Cryptography (OWASP A02)
|
|
312
|
+
'secure-coding/no-hardcoded-credentials': 'error',
|
|
313
|
+
'secure-coding/no-weak-crypto': 'error',
|
|
314
|
+
'secure-coding/no-insufficient-random': 'warn',
|
|
315
|
+
'secure-coding/no-timing-attack': 'error',
|
|
316
|
+
'secure-coding/no-insecure-comparison': 'warn',
|
|
317
|
+
'secure-coding/no-insecure-jwt': 'error',
|
|
318
|
+
|
|
319
|
+
// Critical - XSS vulnerabilities (OWASP A03)
|
|
320
|
+
'secure-coding/no-unvalidated-user-input': 'warn',
|
|
321
|
+
'secure-coding/no-unsanitized-html': 'error',
|
|
322
|
+
'secure-coding/no-unescaped-url-parameter': 'warn',
|
|
323
|
+
'secure-coding/no-improper-sanitization': 'error',
|
|
324
|
+
'secure-coding/no-improper-type-validation': 'warn',
|
|
325
|
+
|
|
326
|
+
// High - Authentication & Authorization (OWASP A01, A07)
|
|
327
|
+
'secure-coding/no-missing-authentication': 'warn',
|
|
328
|
+
'secure-coding/no-privilege-escalation': 'warn',
|
|
329
|
+
'secure-coding/no-weak-password-recovery': 'error',
|
|
330
|
+
|
|
331
|
+
// High - Session & Cookies
|
|
332
|
+
'secure-coding/no-insecure-cookie-settings': 'warn',
|
|
333
|
+
'secure-coding/no-missing-csrf-protection': 'warn',
|
|
334
|
+
'secure-coding/no-document-cookie': 'warn',
|
|
335
|
+
|
|
336
|
+
// High - Network & Headers (OWASP A05)
|
|
337
|
+
'secure-coding/no-missing-cors-check': 'warn',
|
|
338
|
+
'secure-coding/no-missing-security-headers': 'warn',
|
|
339
|
+
'secure-coding/no-insecure-redirects': 'warn',
|
|
340
|
+
'secure-coding/no-unencrypted-transmission': 'warn',
|
|
341
|
+
'secure-coding/no-clickjacking': 'error',
|
|
342
|
+
|
|
343
|
+
// High - Data Exposure (OWASP A01)
|
|
344
|
+
'secure-coding/no-exposed-sensitive-data': 'error',
|
|
345
|
+
'secure-coding/no-sensitive-data-exposure': 'warn',
|
|
346
|
+
|
|
347
|
+
// Medium - Buffer & Memory
|
|
348
|
+
'secure-coding/no-buffer-overread': 'error',
|
|
349
|
+
|
|
350
|
+
// Medium - Resource & DoS
|
|
351
|
+
'secure-coding/no-unlimited-resource-allocation': 'error',
|
|
352
|
+
'secure-coding/no-unchecked-loop-condition': 'error',
|
|
353
|
+
|
|
354
|
+
// Medium - Platform specific
|
|
355
|
+
'secure-coding/no-electron-security-issues': 'error',
|
|
356
|
+
'secure-coding/no-insufficient-postmessage-validation': 'error',
|
|
357
|
+
|
|
358
|
+
// Mobile & General Security (OWASP Mobile)
|
|
359
|
+
'secure-coding/no-credentials-in-storage-api': 'error',
|
|
360
|
+
'secure-coding/no-credentials-in-query-params': 'error',
|
|
361
|
+
'secure-coding/no-http-urls': 'error',
|
|
362
|
+
'secure-coding/require-https-only': 'error',
|
|
363
|
+
'secure-coding/no-pii-in-logs': 'warn',
|
|
364
|
+
'secure-coding/no-verbose-error-messages': 'warn',
|
|
365
|
+
'secure-coding/no-hardcoded-session-tokens': 'error',
|
|
366
|
+
'secure-coding/detect-mixed-content': 'error',
|
|
367
|
+
'secure-coding/no-unvalidated-deeplinks': 'error',
|
|
368
|
+
'secure-coding/no-postmessage-origin-wildcard': 'error',
|
|
369
|
+
'secure-coding/no-insecure-websocket': 'error',
|
|
370
|
+
'secure-coding/detect-suspicious-dependencies': 'warn',
|
|
371
|
+
};
|
|
372
|
+
|
|
373
|
+
export const configs: Record<string, TSESLint.FlatConfig.Config> = {
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* Recommended security configuration
|
|
377
|
+
*
|
|
378
|
+
* Enables all security rules with sensible severity levels:
|
|
379
|
+
* - Critical injection vulnerabilities as errors
|
|
380
|
+
* - Important security issues as warnings
|
|
381
|
+
*/
|
|
382
|
+
recommended: {
|
|
383
|
+
plugins: {
|
|
384
|
+
'secure-coding': plugin,
|
|
385
|
+
},
|
|
386
|
+
rules: recommendedRules,
|
|
387
|
+
} satisfies TSESLint.FlatConfig.Config,
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* Strict security configuration
|
|
391
|
+
*
|
|
392
|
+
* All security rules set to 'error' for maximum protection
|
|
393
|
+
*/
|
|
394
|
+
strict: {
|
|
395
|
+
plugins: {
|
|
396
|
+
'secure-coding': plugin,
|
|
397
|
+
},
|
|
398
|
+
rules: Object.fromEntries(
|
|
399
|
+
Object.keys(rules).map(ruleName => [`secure-coding/${ruleName}`, 'error'])
|
|
400
|
+
),
|
|
401
|
+
} satisfies TSESLint.FlatConfig.Config,
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* OWASP Top 10 focused configuration
|
|
405
|
+
*
|
|
406
|
+
* Rules mapped to OWASP Top 10 2021 categories
|
|
407
|
+
*/
|
|
408
|
+
'owasp-top-10': {
|
|
409
|
+
plugins: {
|
|
410
|
+
'secure-coding': plugin,
|
|
411
|
+
},
|
|
412
|
+
rules: {
|
|
413
|
+
// A01:2021 – Broken Access Control
|
|
414
|
+
'secure-coding/no-missing-authentication': 'error',
|
|
415
|
+
'secure-coding/no-privilege-escalation': 'error',
|
|
416
|
+
'secure-coding/no-exposed-sensitive-data': 'error',
|
|
417
|
+
'secure-coding/no-insecure-redirects': 'error',
|
|
418
|
+
|
|
419
|
+
// A02:2021 – Cryptographic Failures
|
|
420
|
+
'secure-coding/no-hardcoded-credentials': 'error',
|
|
421
|
+
'secure-coding/no-weak-crypto': 'error',
|
|
422
|
+
'secure-coding/no-insufficient-random': 'error',
|
|
423
|
+
'secure-coding/no-insecure-jwt': 'error',
|
|
424
|
+
'secure-coding/no-unencrypted-transmission': 'error',
|
|
425
|
+
'secure-coding/no-sensitive-data-exposure': 'error',
|
|
426
|
+
|
|
427
|
+
// A03:2021 – Injection
|
|
428
|
+
'secure-coding/no-sql-injection': 'error',
|
|
429
|
+
'secure-coding/database-injection': 'error',
|
|
430
|
+
'secure-coding/detect-eval-with-expression': 'error',
|
|
431
|
+
'secure-coding/detect-child-process': 'error',
|
|
432
|
+
'secure-coding/no-graphql-injection': 'error',
|
|
433
|
+
'secure-coding/no-xxe-injection': 'error',
|
|
434
|
+
'secure-coding/no-xpath-injection': 'error',
|
|
435
|
+
'secure-coding/no-ldap-injection': 'error',
|
|
436
|
+
'secure-coding/no-unsanitized-html': 'error',
|
|
437
|
+
'secure-coding/no-unescaped-url-parameter': 'error',
|
|
438
|
+
|
|
439
|
+
// A04:2021 – Insecure Design
|
|
440
|
+
'secure-coding/no-weak-password-recovery': 'error',
|
|
441
|
+
'secure-coding/no-improper-type-validation': 'error',
|
|
442
|
+
|
|
443
|
+
// A05:2021 – Security Misconfiguration
|
|
444
|
+
'secure-coding/no-missing-security-headers': 'error',
|
|
445
|
+
'secure-coding/no-missing-cors-check': 'error',
|
|
446
|
+
'secure-coding/no-insecure-cookie-settings': 'error',
|
|
447
|
+
'secure-coding/no-clickjacking': 'error',
|
|
448
|
+
'secure-coding/no-electron-security-issues': 'error',
|
|
449
|
+
|
|
450
|
+
// A07:2021 – Identification and Authentication Failures
|
|
451
|
+
'secure-coding/no-timing-attack': 'error',
|
|
452
|
+
'secure-coding/no-insecure-comparison': 'error',
|
|
453
|
+
'secure-coding/no-missing-csrf-protection': 'error',
|
|
454
|
+
|
|
455
|
+
// A08:2021 – Software and Data Integrity Failures
|
|
456
|
+
'secure-coding/no-unsafe-deserialization': 'error',
|
|
457
|
+
'secure-coding/no-unsafe-dynamic-require': 'error',
|
|
458
|
+
},
|
|
459
|
+
} satisfies TSESLint.FlatConfig.Config,
|
|
460
|
+
|
|
461
|
+
/**
|
|
462
|
+
* OWASP Mobile Top 10 focused configuration
|
|
463
|
+
*
|
|
464
|
+
* Rules mapped to OWASP Mobile Top 10 2024 categories
|
|
465
|
+
*/
|
|
466
|
+
'owasp-mobile-top-10': {
|
|
467
|
+
plugins: {
|
|
468
|
+
'secure-coding': plugin,
|
|
469
|
+
},
|
|
470
|
+
rules: {
|
|
471
|
+
// M1: Improper Credential Usage
|
|
472
|
+
'secure-coding/no-credentials-in-storage-api': 'error',
|
|
473
|
+
'secure-coding/no-credentials-in-query-params': 'error',
|
|
474
|
+
'secure-coding/require-secure-credential-storage': 'error',
|
|
475
|
+
'secure-coding/no-hardcoded-credentials': 'error',
|
|
476
|
+
|
|
477
|
+
// M2: Inadequate Supply Chain Security
|
|
478
|
+
'secure-coding/require-dependency-integrity': 'error',
|
|
479
|
+
'secure-coding/detect-suspicious-dependencies': 'error',
|
|
480
|
+
'secure-coding/no-dynamic-dependency-loading': 'error',
|
|
481
|
+
'secure-coding/require-package-lock': 'error',
|
|
482
|
+
|
|
483
|
+
// M3: Insecure Authentication/Authorization
|
|
484
|
+
'secure-coding/no-client-side-auth-logic': 'error',
|
|
485
|
+
'secure-coding/require-backend-authorization': 'error',
|
|
486
|
+
'secure-coding/no-hardcoded-session-tokens': 'error',
|
|
487
|
+
'secure-coding/detect-weak-password-validation': 'error',
|
|
488
|
+
'secure-coding/no-password-in-url': 'error',
|
|
489
|
+
|
|
490
|
+
// M4: Insufficient Input/Output Validation
|
|
491
|
+
'secure-coding/no-unvalidated-deeplinks': 'error',
|
|
492
|
+
'secure-coding/require-url-validation': 'error',
|
|
493
|
+
'secure-coding/no-arbitrary-file-access': 'error',
|
|
494
|
+
'secure-coding/require-mime-type-validation': 'error',
|
|
495
|
+
'secure-coding/no-postmessage-origin-wildcard': 'error',
|
|
496
|
+
'secure-coding/require-csp-headers': 'error',
|
|
497
|
+
|
|
498
|
+
// M5: Insecure Communication
|
|
499
|
+
'secure-coding/no-http-urls': 'error',
|
|
500
|
+
'secure-coding/no-disabled-certificate-validation': 'error',
|
|
501
|
+
'secure-coding/require-https-only': 'error',
|
|
502
|
+
'secure-coding/no-insecure-websocket': 'error',
|
|
503
|
+
'secure-coding/detect-mixed-content': 'error',
|
|
504
|
+
'secure-coding/no-allow-arbitrary-loads': 'error',
|
|
505
|
+
'secure-coding/require-network-timeout': 'error',
|
|
506
|
+
|
|
507
|
+
// M6: Inadequate Privacy Controls
|
|
508
|
+
'secure-coding/no-pii-in-logs': 'error',
|
|
509
|
+
'secure-coding/no-tracking-without-consent': 'error',
|
|
510
|
+
'secure-coding/require-data-minimization': 'error',
|
|
511
|
+
'secure-coding/no-sensitive-data-in-analytics': 'error',
|
|
512
|
+
|
|
513
|
+
// M7: Insufficient Binary Protections
|
|
514
|
+
'secure-coding/no-debug-code-in-production': 'error',
|
|
515
|
+
'secure-coding/require-code-minification': 'error',
|
|
516
|
+
|
|
517
|
+
// M8: Security Misconfiguration
|
|
518
|
+
'secure-coding/no-verbose-error-messages': 'error',
|
|
519
|
+
'secure-coding/no-exposed-debug-endpoints': 'error',
|
|
520
|
+
'secure-coding/require-secure-defaults': 'error',
|
|
521
|
+
'secure-coding/no-permissive-cors': 'error',
|
|
522
|
+
|
|
523
|
+
// M9: Insecure Data Storage
|
|
524
|
+
'secure-coding/no-unencrypted-local-storage': 'error',
|
|
525
|
+
'secure-coding/no-sensitive-data-in-cache': 'error',
|
|
526
|
+
'secure-coding/require-storage-encryption': 'error',
|
|
527
|
+
'secure-coding/no-data-in-temp-storage': 'error',
|
|
528
|
+
'secure-coding/require-secure-deletion': 'error',
|
|
529
|
+
},
|
|
530
|
+
} satisfies TSESLint.FlatConfig.Config,
|
|
531
|
+
};
|
|
532
|
+
|
|
533
|
+
/**
|
|
534
|
+
* Default export for ESLint plugin
|
|
535
|
+
*/
|
|
536
|
+
export default plugin;
|
|
537
|
+
|
|
538
|
+
/**
|
|
539
|
+
* Re-export all types from the types barrel
|
|
540
|
+
*/
|
|
541
|
+
export type {
|
|
542
|
+
// Injection
|
|
543
|
+
NoSqlInjectionOptions,
|
|
544
|
+
DatabaseInjectionOptions,
|
|
545
|
+
DetectEvalWithExpressionOptions,
|
|
546
|
+
DetectChildProcessOptions,
|
|
547
|
+
NoUnsafeDynamicRequireOptions,
|
|
548
|
+
NoGraphqlInjectionOptions,
|
|
549
|
+
NoXxeInjectionOptions,
|
|
550
|
+
NoXpathInjectionOptions,
|
|
551
|
+
NoLdapInjectionOptions,
|
|
552
|
+
NoDirectiveInjectionOptions,
|
|
553
|
+
NoFormatStringInjectionOptions,
|
|
554
|
+
// Path & File
|
|
555
|
+
DetectNonLiteralFsFilenameOptions,
|
|
556
|
+
NoZipSlipOptions,
|
|
557
|
+
NoToctouVulnerabilityOptions,
|
|
558
|
+
// Regex
|
|
559
|
+
DetectNonLiteralRegexpOptions,
|
|
560
|
+
NoRedosVulnerableRegexOptions,
|
|
561
|
+
NoUnsafeRegexConstructionOptions,
|
|
562
|
+
// Object & Prototype
|
|
563
|
+
DetectObjectInjectionOptions,
|
|
564
|
+
NoUnsafeDeserializationOptions,
|
|
565
|
+
// Credentials & Crypto
|
|
566
|
+
NoHardcodedCredentialsOptions,
|
|
567
|
+
NoWeakCryptoOptions,
|
|
568
|
+
NoInsufficientRandomOptions,
|
|
569
|
+
NoTimingAttackOptions,
|
|
570
|
+
NoInsecureComparisonOptions,
|
|
571
|
+
NoInsecureJwtOptions,
|
|
572
|
+
// Input Validation & XSS
|
|
573
|
+
NoUnvalidatedUserInputOptions,
|
|
574
|
+
NoUnsanitizedHtmlOptions,
|
|
575
|
+
NoUnescapedUrlParameterOptions,
|
|
576
|
+
NoImproperSanitizationOptions,
|
|
577
|
+
NoImproperTypeValidationOptions,
|
|
578
|
+
// Authentication & Authorization
|
|
579
|
+
NoMissingAuthenticationOptions,
|
|
580
|
+
NoPrivilegeEscalationOptions,
|
|
581
|
+
NoWeakPasswordRecoveryOptions,
|
|
582
|
+
// Session & Cookies
|
|
583
|
+
NoInsecureCookieSettingsOptions,
|
|
584
|
+
NoMissingCsrfProtectionOptions,
|
|
585
|
+
NoDocumentCookieOptions,
|
|
586
|
+
// Network & Headers
|
|
587
|
+
NoMissingCorsCheckOptions,
|
|
588
|
+
NoMissingSecurityHeadersOptions,
|
|
589
|
+
NoInsecureRedirectsOptions,
|
|
590
|
+
NoUnencryptedTransmissionOptions,
|
|
591
|
+
NoClickjackingOptions,
|
|
592
|
+
// Data Exposure
|
|
593
|
+
NoExposedSensitiveDataOptions,
|
|
594
|
+
NoSensitiveDataExposureOptions,
|
|
595
|
+
// Buffer & Memory
|
|
596
|
+
NoBufferOverreadOptions,
|
|
597
|
+
// Resource & DoS
|
|
598
|
+
NoUnlimitedResourceAllocationOptions,
|
|
599
|
+
NoUncheckedLoopConditionOptions,
|
|
600
|
+
// Platform Specific
|
|
601
|
+
NoElectronSecurityIssuesOptions,
|
|
602
|
+
NoInsufficientPostmessageValidationOptions,
|
|
603
|
+
// Combined type
|
|
604
|
+
AllSecurityRulesOptions,
|
|
605
|
+
} from './types/index';
|