eslint-plugin-secure-coding 2.3.3 → 2.4.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/CHANGELOG.md +51 -1
- package/README.md +2 -2
- package/package.json +1 -1
- package/src/index.d.ts +32 -0
- package/src/index.js +416 -0
- package/src/rules/detect-child-process/index.d.ts +11 -0
- package/src/rules/detect-child-process/index.js +529 -0
- package/src/rules/detect-eval-with-expression/index.d.ts +9 -0
- package/src/rules/detect-eval-with-expression/index.js +392 -0
- package/src/rules/detect-mixed-content/index.d.ts +8 -0
- package/src/rules/detect-mixed-content/index.js +44 -0
- package/src/rules/detect-non-literal-fs-filename/index.d.ts +7 -0
- package/src/rules/detect-non-literal-fs-filename/index.js +454 -0
- package/src/rules/detect-non-literal-regexp/index.d.ts +9 -0
- package/src/rules/detect-non-literal-regexp/index.js +403 -0
- package/src/rules/detect-object-injection/index.d.ts +11 -0
- package/src/rules/detect-object-injection/index.js +560 -0
- package/src/rules/detect-suspicious-dependencies/index.d.ts +8 -0
- package/src/rules/detect-suspicious-dependencies/index.js +71 -0
- package/src/rules/detect-weak-password-validation/index.d.ts +6 -0
- package/src/rules/detect-weak-password-validation/index.js +58 -0
- package/src/rules/no-allow-arbitrary-loads/index.d.ts +8 -0
- package/src/rules/no-allow-arbitrary-loads/index.js +47 -0
- package/src/rules/no-arbitrary-file-access/index.d.ts +13 -0
- package/src/rules/no-arbitrary-file-access/index.js +195 -0
- package/src/rules/no-buffer-overread/index.d.ts +29 -0
- package/src/rules/no-buffer-overread/index.js +606 -0
- package/src/rules/no-clickjacking/index.d.ts +10 -0
- package/src/rules/no-clickjacking/index.js +396 -0
- package/src/rules/no-client-side-auth-logic/index.d.ts +6 -0
- package/src/rules/no-client-side-auth-logic/index.js +69 -0
- package/src/rules/no-credentials-in-query-params/index.d.ts +8 -0
- package/src/rules/no-credentials-in-query-params/index.js +57 -0
- package/src/rules/no-data-in-temp-storage/index.d.ts +6 -0
- package/src/rules/no-data-in-temp-storage/index.js +64 -0
- package/src/rules/no-debug-code-in-production/index.d.ts +8 -0
- package/src/rules/no-debug-code-in-production/index.js +51 -0
- package/src/rules/no-directive-injection/index.d.ts +12 -0
- package/src/rules/no-directive-injection/index.js +457 -0
- package/src/rules/no-disabled-certificate-validation/index.d.ts +6 -0
- package/src/rules/no-disabled-certificate-validation/index.js +61 -0
- package/src/rules/no-dynamic-dependency-loading/index.d.ts +8 -0
- package/src/rules/no-dynamic-dependency-loading/index.js +51 -0
- package/src/rules/no-electron-security-issues/index.d.ts +10 -0
- package/src/rules/no-electron-security-issues/index.js +423 -0
- package/src/rules/no-exposed-debug-endpoints/index.d.ts +6 -0
- package/src/rules/no-exposed-debug-endpoints/index.js +62 -0
- package/src/rules/no-exposed-sensitive-data/index.d.ts +11 -0
- package/src/rules/no-exposed-sensitive-data/index.js +340 -0
- package/src/rules/no-format-string-injection/index.d.ts +17 -0
- package/src/rules/no-format-string-injection/index.js +660 -0
- package/src/rules/no-graphql-injection/index.d.ts +12 -0
- package/src/rules/no-graphql-injection/index.js +411 -0
- package/src/rules/no-hardcoded-credentials/index.d.ts +26 -0
- package/src/rules/no-hardcoded-credentials/index.js +376 -0
- package/src/rules/no-hardcoded-session-tokens/index.d.ts +6 -0
- package/src/rules/no-hardcoded-session-tokens/index.js +59 -0
- package/src/rules/no-http-urls/index.d.ts +12 -0
- package/src/rules/no-http-urls/index.js +114 -0
- package/src/rules/no-improper-sanitization/index.d.ts +12 -0
- package/src/rules/no-improper-sanitization/index.js +411 -0
- package/src/rules/no-improper-type-validation/index.d.ts +10 -0
- package/src/rules/no-improper-type-validation/index.js +475 -0
- package/src/rules/no-insecure-comparison/index.d.ts +7 -0
- package/src/rules/no-insecure-comparison/index.js +193 -0
- package/src/rules/no-insecure-redirects/index.d.ts +7 -0
- package/src/rules/no-insecure-redirects/index.js +216 -0
- package/src/rules/no-insecure-websocket/index.d.ts +6 -0
- package/src/rules/no-insecure-websocket/index.js +61 -0
- package/src/rules/no-ldap-injection/index.d.ts +10 -0
- package/src/rules/no-ldap-injection/index.js +455 -0
- package/src/rules/no-missing-authentication/index.d.ts +13 -0
- package/src/rules/no-missing-authentication/index.js +333 -0
- package/src/rules/no-missing-cors-check/index.d.ts +9 -0
- package/src/rules/no-missing-cors-check/index.js +399 -0
- package/src/rules/no-missing-csrf-protection/index.d.ts +11 -0
- package/src/rules/no-missing-csrf-protection/index.js +180 -0
- package/src/rules/no-missing-security-headers/index.d.ts +7 -0
- package/src/rules/no-missing-security-headers/index.js +218 -0
- package/src/rules/no-password-in-url/index.d.ts +8 -0
- package/src/rules/no-password-in-url/index.js +54 -0
- package/src/rules/no-permissive-cors/index.d.ts +8 -0
- package/src/rules/no-permissive-cors/index.js +65 -0
- package/src/rules/no-pii-in-logs/index.d.ts +8 -0
- package/src/rules/no-pii-in-logs/index.js +70 -0
- package/src/rules/no-privilege-escalation/index.d.ts +13 -0
- package/src/rules/no-privilege-escalation/index.js +321 -0
- package/src/rules/no-redos-vulnerable-regex/index.d.ts +7 -0
- package/src/rules/no-redos-vulnerable-regex/index.js +306 -0
- package/src/rules/no-sensitive-data-exposure/index.d.ts +11 -0
- package/src/rules/no-sensitive-data-exposure/index.js +250 -0
- package/src/rules/no-sensitive-data-in-analytics/index.d.ts +8 -0
- package/src/rules/no-sensitive-data-in-analytics/index.js +62 -0
- package/src/rules/no-sensitive-data-in-cache/index.d.ts +8 -0
- package/src/rules/no-sensitive-data-in-cache/index.js +52 -0
- package/src/rules/no-toctou-vulnerability/index.d.ts +7 -0
- package/src/rules/no-toctou-vulnerability/index.js +208 -0
- package/src/rules/no-tracking-without-consent/index.d.ts +6 -0
- package/src/rules/no-tracking-without-consent/index.js +67 -0
- package/src/rules/no-unchecked-loop-condition/index.d.ts +12 -0
- package/src/rules/no-unchecked-loop-condition/index.js +646 -0
- package/src/rules/no-unencrypted-transmission/index.d.ts +11 -0
- package/src/rules/no-unencrypted-transmission/index.js +236 -0
- package/src/rules/no-unescaped-url-parameter/index.d.ts +9 -0
- package/src/rules/no-unescaped-url-parameter/index.js +355 -0
- package/src/rules/no-unlimited-resource-allocation/index.d.ts +12 -0
- package/src/rules/no-unlimited-resource-allocation/index.js +643 -0
- package/src/rules/no-unsafe-deserialization/index.d.ts +10 -0
- package/src/rules/no-unsafe-deserialization/index.js +491 -0
- package/src/rules/no-unsafe-dynamic-require/index.d.ts +5 -0
- package/src/rules/no-unsafe-dynamic-require/index.js +106 -0
- package/src/rules/no-unsafe-regex-construction/index.d.ts +9 -0
- package/src/rules/no-unsafe-regex-construction/index.js +291 -0
- package/src/rules/no-unvalidated-deeplinks/index.d.ts +6 -0
- package/src/rules/no-unvalidated-deeplinks/index.js +62 -0
- package/src/rules/no-unvalidated-user-input/index.d.ts +9 -0
- package/src/rules/no-unvalidated-user-input/index.js +420 -0
- package/src/rules/no-verbose-error-messages/index.d.ts +8 -0
- package/src/rules/no-verbose-error-messages/index.js +68 -0
- package/src/rules/no-weak-password-recovery/index.d.ts +12 -0
- package/src/rules/no-weak-password-recovery/index.js +424 -0
- package/src/rules/no-xpath-injection/index.d.ts +10 -0
- package/src/rules/no-xpath-injection/index.js +487 -0
- package/src/rules/no-xxe-injection/index.d.ts +7 -0
- package/src/rules/no-xxe-injection/index.js +266 -0
- package/src/rules/no-zip-slip/index.d.ts +9 -0
- package/src/rules/no-zip-slip/index.js +445 -0
- package/src/rules/require-backend-authorization/index.d.ts +6 -0
- package/src/rules/require-backend-authorization/index.js +60 -0
- package/src/rules/require-code-minification/index.d.ts +8 -0
- package/src/rules/require-code-minification/index.js +47 -0
- package/src/rules/require-csp-headers/index.d.ts +6 -0
- package/src/rules/require-csp-headers/index.js +64 -0
- package/src/rules/require-data-minimization/index.d.ts +8 -0
- package/src/rules/require-data-minimization/index.js +53 -0
- package/src/rules/require-dependency-integrity/index.d.ts +6 -0
- package/src/rules/require-dependency-integrity/index.js +64 -0
- package/src/rules/require-https-only/index.d.ts +8 -0
- package/src/rules/require-https-only/index.js +62 -0
- package/src/rules/require-mime-type-validation/index.d.ts +6 -0
- package/src/rules/require-mime-type-validation/index.js +66 -0
- package/src/rules/require-network-timeout/index.d.ts +8 -0
- package/src/rules/require-network-timeout/index.js +50 -0
- package/src/rules/require-package-lock/index.d.ts +8 -0
- package/src/rules/require-package-lock/index.js +63 -0
- package/src/rules/require-secure-credential-storage/index.d.ts +8 -0
- package/src/rules/require-secure-credential-storage/index.js +50 -0
- package/src/rules/require-secure-defaults/index.d.ts +8 -0
- package/src/rules/require-secure-defaults/index.js +47 -0
- package/src/rules/require-secure-deletion/index.d.ts +8 -0
- package/src/rules/require-secure-deletion/index.js +44 -0
- package/src/rules/require-storage-encryption/index.d.ts +8 -0
- package/src/rules/require-storage-encryption/index.js +50 -0
- package/src/rules/require-url-validation/index.d.ts +6 -0
- package/src/rules/require-url-validation/index.js +72 -0
- package/src/types/index.d.ts +106 -0
- package/src/types/index.js +16 -0
- package/src/index.ts +0 -605
- package/src/rules/__tests__/integration-demo.test.ts +0 -290
- package/src/rules/__tests__/integration-llm.test.ts +0 -89
- package/src/rules/database-injection/database-injection.test.ts +0 -456
- package/src/rules/database-injection/index.ts +0 -488
- package/src/rules/detect-child-process/detect-child-process.test.ts +0 -207
- package/src/rules/detect-child-process/index.ts +0 -634
- package/src/rules/detect-eval-with-expression/detect-eval-with-expression.test.ts +0 -416
- package/src/rules/detect-eval-with-expression/index.ts +0 -463
- package/src/rules/detect-mixed-content/detect-mixed-content.test.ts +0 -28
- package/src/rules/detect-mixed-content/index.ts +0 -52
- package/src/rules/detect-non-literal-fs-filename/detect-non-literal-fs-filename.test.ts +0 -269
- package/src/rules/detect-non-literal-fs-filename/index.ts +0 -551
- package/src/rules/detect-non-literal-regexp/detect-non-literal-regexp.test.ts +0 -189
- package/src/rules/detect-non-literal-regexp/index.ts +0 -490
- package/src/rules/detect-object-injection/detect-object-injection.test.ts +0 -440
- package/src/rules/detect-object-injection/index.ts +0 -674
- package/src/rules/detect-suspicious-dependencies/detect-suspicious-dependencies.test.ts +0 -32
- package/src/rules/detect-suspicious-dependencies/index.ts +0 -84
- package/src/rules/detect-weak-password-validation/detect-weak-password-validation.test.ts +0 -31
- package/src/rules/detect-weak-password-validation/index.ts +0 -68
- package/src/rules/no-allow-arbitrary-loads/index.ts +0 -54
- package/src/rules/no-allow-arbitrary-loads/no-allow-arbitrary-loads.test.ts +0 -28
- package/src/rules/no-arbitrary-file-access/index.ts +0 -238
- package/src/rules/no-arbitrary-file-access/no-arbitrary-file-access.test.ts +0 -119
- package/src/rules/no-buffer-overread/index.ts +0 -724
- package/src/rules/no-buffer-overread/no-buffer-overread.test.ts +0 -313
- package/src/rules/no-clickjacking/index.ts +0 -481
- package/src/rules/no-clickjacking/no-clickjacking.test.ts +0 -253
- package/src/rules/no-client-side-auth-logic/index.ts +0 -81
- package/src/rules/no-client-side-auth-logic/no-client-side-auth-logic.test.ts +0 -33
- package/src/rules/no-credentials-in-query-params/index.ts +0 -69
- package/src/rules/no-credentials-in-query-params/no-credentials-in-query-params.test.ts +0 -33
- package/src/rules/no-credentials-in-storage-api/index.ts +0 -64
- package/src/rules/no-credentials-in-storage-api/no-credentials-in-storage-api.test.ts +0 -31
- package/src/rules/no-data-in-temp-storage/index.ts +0 -75
- package/src/rules/no-data-in-temp-storage/no-data-in-temp-storage.test.ts +0 -33
- package/src/rules/no-debug-code-in-production/index.ts +0 -59
- package/src/rules/no-debug-code-in-production/no-debug-code-in-production.test.ts +0 -26
- package/src/rules/no-directive-injection/index.ts +0 -551
- package/src/rules/no-directive-injection/no-directive-injection.test.ts +0 -305
- package/src/rules/no-disabled-certificate-validation/index.ts +0 -72
- package/src/rules/no-disabled-certificate-validation/no-disabled-certificate-validation.test.ts +0 -33
- package/src/rules/no-document-cookie/index.ts +0 -113
- package/src/rules/no-document-cookie/no-document-cookie.test.ts +0 -382
- package/src/rules/no-dynamic-dependency-loading/index.ts +0 -60
- package/src/rules/no-dynamic-dependency-loading/no-dynamic-dependency-loading.test.ts +0 -27
- package/src/rules/no-electron-security-issues/index.ts +0 -504
- package/src/rules/no-electron-security-issues/no-electron-security-issues.test.ts +0 -324
- package/src/rules/no-exposed-debug-endpoints/index.ts +0 -73
- package/src/rules/no-exposed-debug-endpoints/no-exposed-debug-endpoints.test.ts +0 -40
- package/src/rules/no-exposed-sensitive-data/index.ts +0 -428
- package/src/rules/no-exposed-sensitive-data/no-exposed-sensitive-data.test.ts +0 -75
- package/src/rules/no-format-string-injection/index.ts +0 -801
- package/src/rules/no-format-string-injection/no-format-string-injection.test.ts +0 -437
- package/src/rules/no-graphql-injection/index.ts +0 -508
- package/src/rules/no-graphql-injection/no-graphql-injection.test.ts +0 -371
- package/src/rules/no-hardcoded-credentials/index.ts +0 -478
- package/src/rules/no-hardcoded-credentials/no-hardcoded-credentials.test.ts +0 -639
- package/src/rules/no-hardcoded-session-tokens/index.ts +0 -69
- package/src/rules/no-hardcoded-session-tokens/no-hardcoded-session-tokens.test.ts +0 -42
- package/src/rules/no-http-urls/index.ts +0 -131
- package/src/rules/no-http-urls/no-http-urls.test.ts +0 -60
- package/src/rules/no-improper-sanitization/index.ts +0 -502
- package/src/rules/no-improper-sanitization/no-improper-sanitization.test.ts +0 -156
- package/src/rules/no-improper-type-validation/index.ts +0 -572
- package/src/rules/no-improper-type-validation/no-improper-type-validation.test.ts +0 -372
- package/src/rules/no-insecure-comparison/index.ts +0 -232
- package/src/rules/no-insecure-comparison/no-insecure-comparison.test.ts +0 -218
- package/src/rules/no-insecure-cookie-settings/index.ts +0 -391
- package/src/rules/no-insecure-cookie-settings/no-insecure-cookie-settings.test.ts +0 -409
- package/src/rules/no-insecure-jwt/index.ts +0 -467
- package/src/rules/no-insecure-jwt/no-insecure-jwt.test.ts +0 -259
- package/src/rules/no-insecure-redirects/index.ts +0 -267
- package/src/rules/no-insecure-redirects/no-insecure-redirects.test.ts +0 -108
- package/src/rules/no-insecure-websocket/index.ts +0 -72
- package/src/rules/no-insecure-websocket/no-insecure-websocket.test.ts +0 -42
- package/src/rules/no-insufficient-postmessage-validation/index.ts +0 -497
- package/src/rules/no-insufficient-postmessage-validation/no-insufficient-postmessage-validation.test.ts +0 -360
- package/src/rules/no-insufficient-random/index.ts +0 -288
- package/src/rules/no-insufficient-random/no-insufficient-random.test.ts +0 -246
- package/src/rules/no-ldap-injection/index.ts +0 -547
- package/src/rules/no-ldap-injection/no-ldap-injection.test.ts +0 -317
- package/src/rules/no-missing-authentication/index.ts +0 -408
- package/src/rules/no-missing-authentication/no-missing-authentication.test.ts +0 -350
- package/src/rules/no-missing-cors-check/index.ts +0 -453
- package/src/rules/no-missing-cors-check/no-missing-cors-check.test.ts +0 -392
- package/src/rules/no-missing-csrf-protection/index.ts +0 -229
- package/src/rules/no-missing-csrf-protection/no-missing-csrf-protection.test.ts +0 -222
- package/src/rules/no-missing-security-headers/index.ts +0 -266
- package/src/rules/no-missing-security-headers/no-missing-security-headers.test.ts +0 -98
- package/src/rules/no-password-in-url/index.ts +0 -64
- package/src/rules/no-password-in-url/no-password-in-url.test.ts +0 -27
- package/src/rules/no-permissive-cors/index.ts +0 -78
- package/src/rules/no-permissive-cors/no-permissive-cors.test.ts +0 -28
- package/src/rules/no-pii-in-logs/index.ts +0 -83
- package/src/rules/no-pii-in-logs/no-pii-in-logs.test.ts +0 -26
- package/src/rules/no-postmessage-origin-wildcard/index.ts +0 -67
- package/src/rules/no-postmessage-origin-wildcard/no-postmessage-origin-wildcard.test.ts +0 -27
- package/src/rules/no-privilege-escalation/index.ts +0 -403
- package/src/rules/no-privilege-escalation/no-privilege-escalation.test.ts +0 -306
- package/src/rules/no-redos-vulnerable-regex/index.ts +0 -379
- package/src/rules/no-redos-vulnerable-regex/no-redos-vulnerable-regex.test.ts +0 -83
- package/src/rules/no-sensitive-data-exposure/index.ts +0 -294
- package/src/rules/no-sensitive-data-exposure/no-sensitive-data-exposure.test.ts +0 -262
- package/src/rules/no-sensitive-data-in-analytics/index.ts +0 -73
- package/src/rules/no-sensitive-data-in-analytics/no-sensitive-data-in-analytics.test.ts +0 -42
- package/src/rules/no-sensitive-data-in-cache/index.ts +0 -59
- package/src/rules/no-sensitive-data-in-cache/no-sensitive-data-in-cache.test.ts +0 -32
- package/src/rules/no-sql-injection/index.ts +0 -424
- package/src/rules/no-sql-injection/no-sql-injection.test.ts +0 -303
- package/src/rules/no-timing-attack/index.ts +0 -552
- package/src/rules/no-timing-attack/no-timing-attack.test.ts +0 -348
- package/src/rules/no-toctou-vulnerability/index.ts +0 -250
- package/src/rules/no-toctou-vulnerability/no-toctou-vulnerability.test.ts +0 -60
- package/src/rules/no-tracking-without-consent/index.ts +0 -78
- package/src/rules/no-tracking-without-consent/no-tracking-without-consent.test.ts +0 -34
- package/src/rules/no-unchecked-loop-condition/index.ts +0 -781
- package/src/rules/no-unchecked-loop-condition/no-unchecked-loop-condition.test.ts +0 -459
- package/src/rules/no-unencrypted-local-storage/index.ts +0 -73
- package/src/rules/no-unencrypted-local-storage/no-unencrypted-local-storage.test.ts +0 -41
- package/src/rules/no-unencrypted-transmission/index.ts +0 -296
- package/src/rules/no-unencrypted-transmission/no-unencrypted-transmission.test.ts +0 -287
- package/src/rules/no-unescaped-url-parameter/index.ts +0 -424
- package/src/rules/no-unescaped-url-parameter/no-unescaped-url-parameter.test.ts +0 -263
- package/src/rules/no-unlimited-resource-allocation/index.ts +0 -767
- package/src/rules/no-unlimited-resource-allocation/no-unlimited-resource-allocation.test.ts +0 -544
- package/src/rules/no-unsafe-deserialization/index.ts +0 -593
- package/src/rules/no-unsafe-deserialization/no-unsafe-deserialization.test.ts +0 -310
- package/src/rules/no-unsafe-dynamic-require/index.ts +0 -125
- package/src/rules/no-unsafe-dynamic-require/no-unsafe-dynamic-require.test.ts +0 -151
- package/src/rules/no-unsafe-regex-construction/index.ts +0 -370
- package/src/rules/no-unsafe-regex-construction/no-unsafe-regex-construction.test.ts +0 -181
- package/src/rules/no-unsanitized-html/index.ts +0 -400
- package/src/rules/no-unsanitized-html/no-unsanitized-html.test.ts +0 -488
- package/src/rules/no-unvalidated-deeplinks/index.ts +0 -73
- package/src/rules/no-unvalidated-deeplinks/no-unvalidated-deeplinks.test.ts +0 -29
- package/src/rules/no-unvalidated-user-input/index.ts +0 -498
- package/src/rules/no-unvalidated-user-input/no-unvalidated-user-input.test.ts +0 -463
- package/src/rules/no-verbose-error-messages/index.ts +0 -83
- package/src/rules/no-verbose-error-messages/no-verbose-error-messages.test.ts +0 -34
- package/src/rules/no-weak-crypto/index.ts +0 -447
- package/src/rules/no-weak-crypto/no-weak-crypto.test.ts +0 -297
- package/src/rules/no-weak-password-recovery/index.ts +0 -509
- package/src/rules/no-weak-password-recovery/no-weak-password-recovery.test.ts +0 -184
- package/src/rules/no-xpath-injection/index.ts +0 -596
- package/src/rules/no-xpath-injection/no-xpath-injection.test.ts +0 -405
- package/src/rules/no-xxe-injection/index.ts +0 -342
- package/src/rules/no-xxe-injection/no-xxe-injection.test.ts +0 -122
- package/src/rules/no-zip-slip/index.ts +0 -526
- package/src/rules/no-zip-slip/no-zip-slip.test.ts +0 -305
- package/src/rules/require-backend-authorization/index.ts +0 -71
- package/src/rules/require-backend-authorization/require-backend-authorization.test.ts +0 -31
- package/src/rules/require-code-minification/index.ts +0 -54
- package/src/rules/require-code-minification/require-code-minification.test.ts +0 -30
- package/src/rules/require-csp-headers/index.ts +0 -74
- package/src/rules/require-csp-headers/require-csp-headers.test.ts +0 -34
- package/src/rules/require-data-minimization/index.ts +0 -65
- package/src/rules/require-data-minimization/require-data-minimization.test.ts +0 -31
- package/src/rules/require-dependency-integrity/index.ts +0 -78
- package/src/rules/require-dependency-integrity/require-dependency-integrity.test.ts +0 -44
- package/src/rules/require-https-only/index.ts +0 -75
- package/src/rules/require-https-only/require-https-only.test.ts +0 -26
- package/src/rules/require-mime-type-validation/index.ts +0 -77
- package/src/rules/require-mime-type-validation/require-mime-type-validation.test.ts +0 -32
- package/src/rules/require-network-timeout/index.ts +0 -58
- package/src/rules/require-network-timeout/require-network-timeout.test.ts +0 -26
- package/src/rules/require-package-lock/index.ts +0 -75
- package/src/rules/require-package-lock/require-package-lock.test.ts +0 -27
- package/src/rules/require-secure-credential-storage/index.ts +0 -60
- package/src/rules/require-secure-credential-storage/require-secure-credential-storage.test.ts +0 -26
- package/src/rules/require-secure-defaults/index.ts +0 -54
- package/src/rules/require-secure-defaults/require-secure-defaults.test.ts +0 -26
- package/src/rules/require-secure-deletion/index.ts +0 -52
- package/src/rules/require-secure-deletion/require-secure-deletion.test.ts +0 -29
- package/src/rules/require-storage-encryption/index.ts +0 -60
- package/src/rules/require-storage-encryption/require-storage-encryption.test.ts +0 -26
- package/src/rules/require-url-validation/index.ts +0 -85
- package/src/rules/require-url-validation/require-url-validation.test.ts +0 -32
- package/src/types/index.ts +0 -235
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,56 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [4.0.0] - 2025-12-31
|
|
9
|
+
|
|
10
|
+
### ⚠️ BREAKING CHANGES
|
|
11
|
+
|
|
12
|
+
Removed 12 rules that now have dedicated, specialized plugins with enhanced functionality.
|
|
13
|
+
|
|
14
|
+
#### Removed Rules (use dedicated plugins instead)
|
|
15
|
+
|
|
16
|
+
| Removed Rule | Replacement Plugin | Replacement Rule(s) |
|
|
17
|
+
| ---------------------------------------- | -------------------------------- | --------------------------------------------------- |
|
|
18
|
+
| `no-sql-injection` | `eslint-plugin-pg` | `pg/no-unsafe-query` |
|
|
19
|
+
| `database-injection` | `eslint-plugin-pg` | `pg/no-unsafe-query` |
|
|
20
|
+
| `no-insecure-jwt` | `eslint-plugin-jwt` | 13 dedicated JWT rules |
|
|
21
|
+
| `no-weak-crypto` | `eslint-plugin-crypto` | `crypto/no-weak-hash-algorithm` |
|
|
22
|
+
| `no-timing-attack` | `eslint-plugin-crypto` | `crypto/no-timing-unsafe-compare` |
|
|
23
|
+
| `no-insufficient-random` | `eslint-plugin-crypto` | `crypto/no-math-random-crypto` |
|
|
24
|
+
| `no-document-cookie` | `eslint-plugin-browser-security` | `browser-security/no-sensitive-cookie-js` |
|
|
25
|
+
| `no-unsanitized-html` | `eslint-plugin-browser-security` | `browser-security/no-innerhtml` |
|
|
26
|
+
| `no-postmessage-origin-wildcard` | `eslint-plugin-browser-security` | `browser-security/no-postmessage-wildcard-origin` |
|
|
27
|
+
| `no-insecure-cookie-settings` | `eslint-plugin-browser-security` | `browser-security/require-cookie-secure-attrs` |
|
|
28
|
+
| `no-insufficient-postmessage-validation` | `eslint-plugin-browser-security` | `browser-security/require-postmessage-origin-check` |
|
|
29
|
+
| `no-unencrypted-local-storage` | `eslint-plugin-browser-security` | `browser-security/no-sensitive-localstorage` |
|
|
30
|
+
| `no-credentials-in-storage-api` | `eslint-plugin-browser-security` | `browser-security/no-sensitive-localstorage` |
|
|
31
|
+
|
|
32
|
+
### Migration Guide
|
|
33
|
+
|
|
34
|
+
Install the specialized plugins for the functionality you need:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
# For PostgreSQL/SQL security
|
|
38
|
+
npm install --save-dev eslint-plugin-pg
|
|
39
|
+
|
|
40
|
+
# For JWT security
|
|
41
|
+
npm install --save-dev eslint-plugin-jwt
|
|
42
|
+
|
|
43
|
+
# For cryptography security
|
|
44
|
+
npm install --save-dev eslint-plugin-crypto
|
|
45
|
+
|
|
46
|
+
# For browser/client-side security
|
|
47
|
+
npm install --save-dev eslint-plugin-browser-security
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Why This Change?
|
|
51
|
+
|
|
52
|
+
Specialized plugins provide:
|
|
53
|
+
|
|
54
|
+
- **More rules**: 13 JWT rules vs 1, 24 crypto rules vs 3
|
|
55
|
+
- **Better detection**: Domain-specific AST patterns
|
|
56
|
+
- **Focused maintenance**: Faster updates for each security domain
|
|
57
|
+
|
|
8
58
|
## [3.0.2] - 2025-12-20
|
|
9
59
|
|
|
10
60
|
### Performance
|
|
@@ -18,7 +68,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
18
68
|
|
|
19
69
|
## [3.0.1] - 2025-12-20
|
|
20
70
|
|
|
21
|
-
###
|
|
71
|
+
### Fixed444
|
|
22
72
|
|
|
23
73
|
- **detect-object-injection**: Reduced false positives by detecting validation patterns:
|
|
24
74
|
- `includes()` checks in enclosing if-blocks
|
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
## 💡 What you get
|
|
20
20
|
|
|
21
|
-
- **Feature-based coverage:**
|
|
21
|
+
- **Feature-based coverage:** 75 rules grouped by attack surface (injection, crypto, auth, cookies, headers, mobile security, resource limits, platform specifics).
|
|
22
22
|
- **LLM-optimized & MCP-ready:** Structured 2-line messages with CWE + OWASP + CVSS + concrete fixes so humans _and_ AI auto-fixers stay aligned.
|
|
23
23
|
- **Standards aligned:** OWASP Top 10 Web + Mobile, CWE tagging, CVSS scoring in every finding for compliance mapping.
|
|
24
24
|
- **Tiered presets:** `recommended`, `strict`, `owasp-top-10` for fast policy rollout.
|
|
@@ -283,7 +283,7 @@ npx eslint .
|
|
|
283
283
|
|
|
284
284
|
## 📚 Documentation
|
|
285
285
|
|
|
286
|
-
- **[Rules Reference](./docs/RULES.md)** - Complete list of all
|
|
286
|
+
- **[Rules Reference](./docs/RULES.md)** - Complete list of all 75 rules with configuration options
|
|
287
287
|
|
|
288
288
|
---
|
|
289
289
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-secure-coding",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
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",
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
import { TSESLint } from '@interlace/eslint-devkit';
|
|
16
|
+
/**
|
|
17
|
+
* Collection of all security ESLint rules
|
|
18
|
+
*/
|
|
19
|
+
export declare const rules: Record<string, TSESLint.RuleModule<string, readonly unknown[]>>;
|
|
20
|
+
/**
|
|
21
|
+
* ESLint Plugin object
|
|
22
|
+
*/
|
|
23
|
+
export declare const plugin: TSESLint.FlatConfig.Plugin;
|
|
24
|
+
export declare const configs: Record<string, TSESLint.FlatConfig.Config>;
|
|
25
|
+
/**
|
|
26
|
+
* Default export for ESLint plugin
|
|
27
|
+
*/
|
|
28
|
+
export default plugin;
|
|
29
|
+
/**
|
|
30
|
+
* Re-export all types from the types barrel
|
|
31
|
+
*/
|
|
32
|
+
export type { DetectEvalWithExpressionOptions, DetectChildProcessOptions, NoUnsafeDynamicRequireOptions, NoGraphqlInjectionOptions, NoXxeInjectionOptions, NoXpathInjectionOptions, NoLdapInjectionOptions, NoDirectiveInjectionOptions, NoFormatStringInjectionOptions, DetectNonLiteralFsFilenameOptions, NoZipSlipOptions, NoToctouVulnerabilityOptions, DetectNonLiteralRegexpOptions, NoRedosVulnerableRegexOptions, NoUnsafeRegexConstructionOptions, DetectObjectInjectionOptions, NoUnsafeDeserializationOptions, NoHardcodedCredentialsOptions, NoInsecureComparisonOptions, NoUnvalidatedUserInputOptions, NoUnescapedUrlParameterOptions, NoImproperSanitizationOptions, NoImproperTypeValidationOptions, NoMissingAuthenticationOptions, NoPrivilegeEscalationOptions, NoWeakPasswordRecoveryOptions, NoMissingCsrfProtectionOptions, NoMissingCorsCheckOptions, NoMissingSecurityHeadersOptions, NoInsecureRedirectsOptions, NoUnencryptedTransmissionOptions, NoClickjackingOptions, NoExposedSensitiveDataOptions, NoSensitiveDataExposureOptions, NoBufferOverreadOptions, NoUnlimitedResourceAllocationOptions, NoUncheckedLoopConditionOptions, NoElectronSecurityIssuesOptions, AllSecurityRulesOptions, } from './types/index';
|
package/src/index.js
ADDED
|
@@ -0,0 +1,416 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* eslint-plugin-secure-coding
|
|
4
|
+
*
|
|
5
|
+
* A comprehensive security-focused ESLint plugin with 48+ rules
|
|
6
|
+
* for detecting and preventing security vulnerabilities in JavaScript/TypeScript code.
|
|
7
|
+
*
|
|
8
|
+
* Features:
|
|
9
|
+
* - LLM-optimized error messages with CWE references
|
|
10
|
+
* - OWASP Top 10 coverage
|
|
11
|
+
* - Auto-fix capabilities where safe
|
|
12
|
+
* - Structured context for AI assistants
|
|
13
|
+
*
|
|
14
|
+
* @see https://github.com/ofri-peretz/eslint#readme
|
|
15
|
+
*/
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.configs = exports.plugin = exports.rules = void 0;
|
|
18
|
+
// Security rules - Injection
|
|
19
|
+
const detect_eval_with_expression_1 = require("./rules/detect-eval-with-expression");
|
|
20
|
+
const detect_child_process_1 = require("./rules/detect-child-process");
|
|
21
|
+
const no_unsafe_dynamic_require_1 = require("./rules/no-unsafe-dynamic-require");
|
|
22
|
+
const no_graphql_injection_1 = require("./rules/no-graphql-injection");
|
|
23
|
+
const no_xxe_injection_1 = require("./rules/no-xxe-injection");
|
|
24
|
+
const no_xpath_injection_1 = require("./rules/no-xpath-injection");
|
|
25
|
+
const no_ldap_injection_1 = require("./rules/no-ldap-injection");
|
|
26
|
+
const no_directive_injection_1 = require("./rules/no-directive-injection");
|
|
27
|
+
const no_format_string_injection_1 = require("./rules/no-format-string-injection");
|
|
28
|
+
// Security rules - Path & File
|
|
29
|
+
const detect_non_literal_fs_filename_1 = require("./rules/detect-non-literal-fs-filename");
|
|
30
|
+
const no_zip_slip_1 = require("./rules/no-zip-slip");
|
|
31
|
+
const no_toctou_vulnerability_1 = require("./rules/no-toctou-vulnerability");
|
|
32
|
+
// Security rules - Regex
|
|
33
|
+
const detect_non_literal_regexp_1 = require("./rules/detect-non-literal-regexp");
|
|
34
|
+
const no_redos_vulnerable_regex_1 = require("./rules/no-redos-vulnerable-regex");
|
|
35
|
+
const no_unsafe_regex_construction_1 = require("./rules/no-unsafe-regex-construction");
|
|
36
|
+
// Security rules - Object & Prototype
|
|
37
|
+
const detect_object_injection_1 = require("./rules/detect-object-injection");
|
|
38
|
+
const no_unsafe_deserialization_1 = require("./rules/no-unsafe-deserialization");
|
|
39
|
+
// Security rules - Credentials & Crypto
|
|
40
|
+
const no_hardcoded_credentials_1 = require("./rules/no-hardcoded-credentials");
|
|
41
|
+
const no_insecure_comparison_1 = require("./rules/no-insecure-comparison");
|
|
42
|
+
// Security rules - Input Validation & XSS
|
|
43
|
+
const no_unvalidated_user_input_1 = require("./rules/no-unvalidated-user-input");
|
|
44
|
+
const no_unescaped_url_parameter_1 = require("./rules/no-unescaped-url-parameter");
|
|
45
|
+
const no_improper_sanitization_1 = require("./rules/no-improper-sanitization");
|
|
46
|
+
const no_improper_type_validation_1 = require("./rules/no-improper-type-validation");
|
|
47
|
+
// Security rules - Authentication & Authorization
|
|
48
|
+
const no_missing_authentication_1 = require("./rules/no-missing-authentication");
|
|
49
|
+
const no_privilege_escalation_1 = require("./rules/no-privilege-escalation");
|
|
50
|
+
const no_weak_password_recovery_1 = require("./rules/no-weak-password-recovery");
|
|
51
|
+
// Security rules - Session & Cookies
|
|
52
|
+
const no_missing_csrf_protection_1 = require("./rules/no-missing-csrf-protection");
|
|
53
|
+
// Security rules - Network & Headers
|
|
54
|
+
const no_missing_cors_check_1 = require("./rules/no-missing-cors-check");
|
|
55
|
+
const no_missing_security_headers_1 = require("./rules/no-missing-security-headers");
|
|
56
|
+
const no_insecure_redirects_1 = require("./rules/no-insecure-redirects");
|
|
57
|
+
const no_unencrypted_transmission_1 = require("./rules/no-unencrypted-transmission");
|
|
58
|
+
const no_clickjacking_1 = require("./rules/no-clickjacking");
|
|
59
|
+
// Security rules - Data Exposure
|
|
60
|
+
const no_exposed_sensitive_data_1 = require("./rules/no-exposed-sensitive-data");
|
|
61
|
+
const no_sensitive_data_exposure_1 = require("./rules/no-sensitive-data-exposure");
|
|
62
|
+
// Security rules - Buffer & Memory
|
|
63
|
+
const no_buffer_overread_1 = require("./rules/no-buffer-overread");
|
|
64
|
+
// Security rules - Resource & DoS
|
|
65
|
+
const no_unlimited_resource_allocation_1 = require("./rules/no-unlimited-resource-allocation");
|
|
66
|
+
const no_unchecked_loop_condition_1 = require("./rules/no-unchecked-loop-condition");
|
|
67
|
+
// Security rules - Platform Specific
|
|
68
|
+
const no_electron_security_issues_1 = require("./rules/no-electron-security-issues");
|
|
69
|
+
// OWASP Mobile Top 10 2023/2024 - Mobile Security Rules (40 rules)
|
|
70
|
+
// M1: Improper Credential Usage (3 rules)
|
|
71
|
+
const no_credentials_in_query_params_1 = require("./rules/no-credentials-in-query-params");
|
|
72
|
+
const require_secure_credential_storage_1 = require("./rules/require-secure-credential-storage");
|
|
73
|
+
// M2: Inadequate Supply Chain Security (4 rules)
|
|
74
|
+
const require_dependency_integrity_1 = require("./rules/require-dependency-integrity");
|
|
75
|
+
const detect_suspicious_dependencies_1 = require("./rules/detect-suspicious-dependencies");
|
|
76
|
+
const no_dynamic_dependency_loading_1 = require("./rules/no-dynamic-dependency-loading");
|
|
77
|
+
const require_package_lock_1 = require("./rules/require-package-lock");
|
|
78
|
+
// M3: Insecure Authentication/Authorization (5 rules)
|
|
79
|
+
const no_client_side_auth_logic_1 = require("./rules/no-client-side-auth-logic");
|
|
80
|
+
const require_backend_authorization_1 = require("./rules/require-backend-authorization");
|
|
81
|
+
const no_hardcoded_session_tokens_1 = require("./rules/no-hardcoded-session-tokens");
|
|
82
|
+
const detect_weak_password_validation_1 = require("./rules/detect-weak-password-validation");
|
|
83
|
+
const no_password_in_url_1 = require("./rules/no-password-in-url");
|
|
84
|
+
// M4: Insufficient Input/Output Validation (6 rules)
|
|
85
|
+
const no_unvalidated_deeplinks_1 = require("./rules/no-unvalidated-deeplinks");
|
|
86
|
+
const require_url_validation_1 = require("./rules/require-url-validation");
|
|
87
|
+
const no_arbitrary_file_access_1 = require("./rules/no-arbitrary-file-access");
|
|
88
|
+
const require_mime_type_validation_1 = require("./rules/require-mime-type-validation");
|
|
89
|
+
const require_csp_headers_1 = require("./rules/require-csp-headers");
|
|
90
|
+
// M5: Insecure Communication (7 rules)
|
|
91
|
+
const no_http_urls_1 = require("./rules/no-http-urls");
|
|
92
|
+
const no_disabled_certificate_validation_1 = require("./rules/no-disabled-certificate-validation");
|
|
93
|
+
const require_https_only_1 = require("./rules/require-https-only");
|
|
94
|
+
const no_insecure_websocket_1 = require("./rules/no-insecure-websocket");
|
|
95
|
+
const detect_mixed_content_1 = require("./rules/detect-mixed-content");
|
|
96
|
+
const no_allow_arbitrary_loads_1 = require("./rules/no-allow-arbitrary-loads");
|
|
97
|
+
const require_network_timeout_1 = require("./rules/require-network-timeout");
|
|
98
|
+
// M6: Inadequate Privacy Controls (4 rules)
|
|
99
|
+
const no_pii_in_logs_1 = require("./rules/no-pii-in-logs");
|
|
100
|
+
const no_tracking_without_consent_1 = require("./rules/no-tracking-without-consent");
|
|
101
|
+
const require_data_minimization_1 = require("./rules/require-data-minimization");
|
|
102
|
+
const no_sensitive_data_in_analytics_1 = require("./rules/no-sensitive-data-in-analytics");
|
|
103
|
+
// M7: Insufficient Binary Protections (2 rules)
|
|
104
|
+
const no_debug_code_in_production_1 = require("./rules/no-debug-code-in-production");
|
|
105
|
+
const require_code_minification_1 = require("./rules/require-code-minification");
|
|
106
|
+
// M8: Security Misconfiguration (4 rules)
|
|
107
|
+
const no_verbose_error_messages_1 = require("./rules/no-verbose-error-messages");
|
|
108
|
+
const no_exposed_debug_endpoints_1 = require("./rules/no-exposed-debug-endpoints");
|
|
109
|
+
const require_secure_defaults_1 = require("./rules/require-secure-defaults");
|
|
110
|
+
const no_permissive_cors_1 = require("./rules/no-permissive-cors");
|
|
111
|
+
// M9: Insecure Data Storage (5 rules)
|
|
112
|
+
const no_sensitive_data_in_cache_1 = require("./rules/no-sensitive-data-in-cache");
|
|
113
|
+
const require_storage_encryption_1 = require("./rules/require-storage-encryption");
|
|
114
|
+
const no_data_in_temp_storage_1 = require("./rules/no-data-in-temp-storage");
|
|
115
|
+
const require_secure_deletion_1 = require("./rules/require-secure-deletion");
|
|
116
|
+
/**
|
|
117
|
+
* Collection of all security ESLint rules
|
|
118
|
+
*/
|
|
119
|
+
exports.rules = {
|
|
120
|
+
// Flat rule names (recommended usage)
|
|
121
|
+
'detect-eval-with-expression': detect_eval_with_expression_1.detectEvalWithExpression,
|
|
122
|
+
'detect-child-process': detect_child_process_1.detectChildProcess,
|
|
123
|
+
'no-unsafe-dynamic-require': no_unsafe_dynamic_require_1.noUnsafeDynamicRequire,
|
|
124
|
+
'no-graphql-injection': no_graphql_injection_1.noGraphqlInjection,
|
|
125
|
+
'no-xxe-injection': no_xxe_injection_1.noXxeInjection,
|
|
126
|
+
'no-xpath-injection': no_xpath_injection_1.noXpathInjection,
|
|
127
|
+
'no-ldap-injection': no_ldap_injection_1.noLdapInjection,
|
|
128
|
+
'no-directive-injection': no_directive_injection_1.noDirectiveInjection,
|
|
129
|
+
'no-format-string-injection': no_format_string_injection_1.noFormatStringInjection,
|
|
130
|
+
'detect-non-literal-fs-filename': detect_non_literal_fs_filename_1.detectNonLiteralFsFilename,
|
|
131
|
+
'no-zip-slip': no_zip_slip_1.noZipSlip,
|
|
132
|
+
'no-toctou-vulnerability': no_toctou_vulnerability_1.noToctouVulnerability,
|
|
133
|
+
'detect-non-literal-regexp': detect_non_literal_regexp_1.detectNonLiteralRegexp,
|
|
134
|
+
'no-redos-vulnerable-regex': no_redos_vulnerable_regex_1.noRedosVulnerableRegex,
|
|
135
|
+
'no-unsafe-regex-construction': no_unsafe_regex_construction_1.noUnsafeRegexConstruction,
|
|
136
|
+
'detect-object-injection': detect_object_injection_1.detectObjectInjection,
|
|
137
|
+
'no-unsafe-deserialization': no_unsafe_deserialization_1.noUnsafeDeserialization,
|
|
138
|
+
'no-hardcoded-credentials': no_hardcoded_credentials_1.noHardcodedCredentials,
|
|
139
|
+
'no-insecure-comparison': no_insecure_comparison_1.noInsecureComparison,
|
|
140
|
+
'no-unvalidated-user-input': no_unvalidated_user_input_1.noUnvalidatedUserInput,
|
|
141
|
+
'no-unescaped-url-parameter': no_unescaped_url_parameter_1.noUnescapedUrlParameter,
|
|
142
|
+
'no-improper-sanitization': no_improper_sanitization_1.noImproperSanitization,
|
|
143
|
+
'no-improper-type-validation': no_improper_type_validation_1.noImproperTypeValidation,
|
|
144
|
+
'no-missing-authentication': no_missing_authentication_1.noMissingAuthentication,
|
|
145
|
+
'no-privilege-escalation': no_privilege_escalation_1.noPrivilegeEscalation,
|
|
146
|
+
'no-weak-password-recovery': no_weak_password_recovery_1.noWeakPasswordRecovery,
|
|
147
|
+
'no-missing-csrf-protection': no_missing_csrf_protection_1.noMissingCsrfProtection,
|
|
148
|
+
'no-missing-cors-check': no_missing_cors_check_1.noMissingCorsCheck,
|
|
149
|
+
'no-missing-security-headers': no_missing_security_headers_1.noMissingSecurityHeaders,
|
|
150
|
+
'no-insecure-redirects': no_insecure_redirects_1.noInsecureRedirects,
|
|
151
|
+
'no-unencrypted-transmission': no_unencrypted_transmission_1.noUnencryptedTransmission,
|
|
152
|
+
'no-clickjacking': no_clickjacking_1.noClickjacking,
|
|
153
|
+
'no-exposed-sensitive-data': no_exposed_sensitive_data_1.noExposedSensitiveData,
|
|
154
|
+
'no-sensitive-data-exposure': no_sensitive_data_exposure_1.noSensitiveDataExposure,
|
|
155
|
+
'no-buffer-overread': no_buffer_overread_1.noBufferOverread,
|
|
156
|
+
'no-unlimited-resource-allocation': no_unlimited_resource_allocation_1.noUnlimitedResourceAllocation,
|
|
157
|
+
'no-unchecked-loop-condition': no_unchecked_loop_condition_1.noUncheckedLoopCondition,
|
|
158
|
+
'no-electron-security-issues': no_electron_security_issues_1.noElectronSecurityIssues,
|
|
159
|
+
// OWASP Mobile Top 10 2023/2024 rules (40 rules)
|
|
160
|
+
// M1: Improper Credential Usage (3 rules)
|
|
161
|
+
'no-credentials-in-query-params': no_credentials_in_query_params_1.noCredentialsInQueryParams,
|
|
162
|
+
'require-secure-credential-storage': require_secure_credential_storage_1.requireSecureCredentialStorage,
|
|
163
|
+
// M2: Inadequate Supply Chain Security (4 rules)
|
|
164
|
+
'require-dependency-integrity': require_dependency_integrity_1.requireDependencyIntegrity,
|
|
165
|
+
'detect-suspicious-dependencies': detect_suspicious_dependencies_1.detectSuspiciousDependencies,
|
|
166
|
+
'no-dynamic-dependency-loading': no_dynamic_dependency_loading_1.noDynamicDependencyLoading,
|
|
167
|
+
'require-package-lock': require_package_lock_1.requirePackageLock,
|
|
168
|
+
// M3: Insecure Authentication/Authorization (5 rules)
|
|
169
|
+
'no-client-side-auth-logic': no_client_side_auth_logic_1.noClientSideAuthLogic,
|
|
170
|
+
'require-backend-authorization': require_backend_authorization_1.requireBackendAuthorization,
|
|
171
|
+
'no-hardcoded-session-tokens': no_hardcoded_session_tokens_1.noHardcodedSessionTokens,
|
|
172
|
+
'detect-weak-password-validation': detect_weak_password_validation_1.detectWeakPasswordValidation,
|
|
173
|
+
'no-password-in-url': no_password_in_url_1.noPasswordInUrl,
|
|
174
|
+
// M4: Insufficient Input/Output Validation (6 rules)
|
|
175
|
+
'no-unvalidated-deeplinks': no_unvalidated_deeplinks_1.noUnvalidatedDeeplinks,
|
|
176
|
+
'require-url-validation': require_url_validation_1.requireUrlValidation,
|
|
177
|
+
'no-arbitrary-file-access': no_arbitrary_file_access_1.noArbitraryFileAccess,
|
|
178
|
+
'require-mime-type-validation': require_mime_type_validation_1.requireMimeTypeValidation,
|
|
179
|
+
'require-csp-headers': require_csp_headers_1.requireCspHeaders,
|
|
180
|
+
// M5: Insecure Communication (7 rules)
|
|
181
|
+
'no-http-urls': no_http_urls_1.noHttpUrls,
|
|
182
|
+
'no-disabled-certificate-validation': no_disabled_certificate_validation_1.noDisabledCertificateValidation,
|
|
183
|
+
'require-https-only': require_https_only_1.requireHttpsOnly,
|
|
184
|
+
'no-insecure-websocket': no_insecure_websocket_1.noInsecureWebsocket,
|
|
185
|
+
'detect-mixed-content': detect_mixed_content_1.detectMixedContent,
|
|
186
|
+
'no-allow-arbitrary-loads': no_allow_arbitrary_loads_1.noAllowArbitraryLoads,
|
|
187
|
+
'require-network-timeout': require_network_timeout_1.requireNetworkTimeout,
|
|
188
|
+
// M6: Inadequate Privacy Controls (4 rules)
|
|
189
|
+
'no-pii-in-logs': no_pii_in_logs_1.noPiiInLogs,
|
|
190
|
+
'no-tracking-without-consent': no_tracking_without_consent_1.noTrackingWithoutConsent,
|
|
191
|
+
'require-data-minimization': require_data_minimization_1.requireDataMinimization,
|
|
192
|
+
'no-sensitive-data-in-analytics': no_sensitive_data_in_analytics_1.noSensitiveDataInAnalytics,
|
|
193
|
+
// M7: Insufficient Binary Protections (2 rules)
|
|
194
|
+
'no-debug-code-in-production': no_debug_code_in_production_1.noDebugCodeInProduction,
|
|
195
|
+
'require-code-minification': require_code_minification_1.requireCodeMinification,
|
|
196
|
+
// M8: Security Misconfiguration (4 rules)
|
|
197
|
+
'no-verbose-error-messages': no_verbose_error_messages_1.noVerboseErrorMessages,
|
|
198
|
+
'no-exposed-debug-endpoints': no_exposed_debug_endpoints_1.noExposedDebugEndpoints,
|
|
199
|
+
'require-secure-defaults': require_secure_defaults_1.requireSecureDefaults,
|
|
200
|
+
'no-permissive-cors': no_permissive_cors_1.noPermissiveCors,
|
|
201
|
+
// M9: Insecure Data Storage (5 rules)
|
|
202
|
+
'no-sensitive-data-in-cache': no_sensitive_data_in_cache_1.noSensitiveDataInCache,
|
|
203
|
+
'require-storage-encryption': require_storage_encryption_1.requireStorageEncryption,
|
|
204
|
+
'no-data-in-temp-storage': no_data_in_temp_storage_1.noDataInTempStorage,
|
|
205
|
+
'require-secure-deletion': require_secure_deletion_1.requireSecureDeletion,
|
|
206
|
+
};
|
|
207
|
+
/**
|
|
208
|
+
* ESLint Plugin object
|
|
209
|
+
*/
|
|
210
|
+
exports.plugin = {
|
|
211
|
+
meta: {
|
|
212
|
+
name: 'eslint-plugin-secure-coding',
|
|
213
|
+
version: '1.0.0',
|
|
214
|
+
},
|
|
215
|
+
rules: exports.rules,
|
|
216
|
+
};
|
|
217
|
+
/**
|
|
218
|
+
* Preset configurations for security rules
|
|
219
|
+
*/
|
|
220
|
+
const recommendedRules = {
|
|
221
|
+
// Critical - Injection vulnerabilities (OWASP A03)
|
|
222
|
+
'secure-coding/detect-eval-with-expression': 'error',
|
|
223
|
+
'secure-coding/detect-child-process': 'error',
|
|
224
|
+
'secure-coding/no-unsafe-dynamic-require': 'error',
|
|
225
|
+
'secure-coding/no-graphql-injection': 'error',
|
|
226
|
+
'secure-coding/no-xxe-injection': 'error',
|
|
227
|
+
'secure-coding/no-xpath-injection': 'error',
|
|
228
|
+
'secure-coding/no-ldap-injection': 'error',
|
|
229
|
+
'secure-coding/no-directive-injection': 'error',
|
|
230
|
+
'secure-coding/no-format-string-injection': 'error',
|
|
231
|
+
// Critical - Path traversal & file operations
|
|
232
|
+
'secure-coding/detect-non-literal-fs-filename': 'error',
|
|
233
|
+
'secure-coding/no-zip-slip': 'error',
|
|
234
|
+
'secure-coding/no-toctou-vulnerability': 'error',
|
|
235
|
+
// Critical - Deserialization
|
|
236
|
+
'secure-coding/no-unsafe-deserialization': 'error',
|
|
237
|
+
// High - Regex vulnerabilities
|
|
238
|
+
'secure-coding/detect-non-literal-regexp': 'warn',
|
|
239
|
+
'secure-coding/no-redos-vulnerable-regex': 'error',
|
|
240
|
+
'secure-coding/no-unsafe-regex-construction': 'warn',
|
|
241
|
+
// High - Prototype pollution
|
|
242
|
+
'secure-coding/detect-object-injection': 'warn',
|
|
243
|
+
// Critical - Cryptography (OWASP A02)
|
|
244
|
+
'secure-coding/no-hardcoded-credentials': 'error',
|
|
245
|
+
'secure-coding/no-insecure-comparison': 'warn',
|
|
246
|
+
// Critical - XSS vulnerabilities (OWASP A03)
|
|
247
|
+
'secure-coding/no-unvalidated-user-input': 'warn',
|
|
248
|
+
'secure-coding/no-unescaped-url-parameter': 'warn',
|
|
249
|
+
'secure-coding/no-improper-sanitization': 'error',
|
|
250
|
+
'secure-coding/no-improper-type-validation': 'warn',
|
|
251
|
+
// High - Authentication & Authorization (OWASP A01, A07)
|
|
252
|
+
'secure-coding/no-missing-authentication': 'warn',
|
|
253
|
+
'secure-coding/no-privilege-escalation': 'warn',
|
|
254
|
+
'secure-coding/no-weak-password-recovery': 'error',
|
|
255
|
+
// High - Session & Cookies
|
|
256
|
+
'secure-coding/no-missing-csrf-protection': 'warn',
|
|
257
|
+
// High - Network & Headers (OWASP A05)
|
|
258
|
+
'secure-coding/no-missing-cors-check': 'warn',
|
|
259
|
+
'secure-coding/no-missing-security-headers': 'warn',
|
|
260
|
+
'secure-coding/no-insecure-redirects': 'warn',
|
|
261
|
+
'secure-coding/no-unencrypted-transmission': 'warn',
|
|
262
|
+
'secure-coding/no-clickjacking': 'error',
|
|
263
|
+
// High - Data Exposure (OWASP A01)
|
|
264
|
+
'secure-coding/no-exposed-sensitive-data': 'error',
|
|
265
|
+
'secure-coding/no-sensitive-data-exposure': 'warn',
|
|
266
|
+
// Medium - Buffer & Memory
|
|
267
|
+
'secure-coding/no-buffer-overread': 'error',
|
|
268
|
+
// Medium - Resource & DoS
|
|
269
|
+
'secure-coding/no-unlimited-resource-allocation': 'error',
|
|
270
|
+
'secure-coding/no-unchecked-loop-condition': 'error',
|
|
271
|
+
// Medium - Platform specific
|
|
272
|
+
'secure-coding/no-electron-security-issues': 'error',
|
|
273
|
+
// Mobile & General Security (OWASP Mobile)
|
|
274
|
+
'secure-coding/no-credentials-in-query-params': 'error',
|
|
275
|
+
'secure-coding/no-http-urls': 'error',
|
|
276
|
+
'secure-coding/require-https-only': 'error',
|
|
277
|
+
'secure-coding/no-pii-in-logs': 'warn',
|
|
278
|
+
'secure-coding/no-verbose-error-messages': 'warn',
|
|
279
|
+
'secure-coding/no-hardcoded-session-tokens': 'error',
|
|
280
|
+
'secure-coding/detect-mixed-content': 'error',
|
|
281
|
+
'secure-coding/no-unvalidated-deeplinks': 'error',
|
|
282
|
+
'secure-coding/no-insecure-websocket': 'error',
|
|
283
|
+
'secure-coding/detect-suspicious-dependencies': 'warn',
|
|
284
|
+
};
|
|
285
|
+
exports.configs = {
|
|
286
|
+
/**
|
|
287
|
+
* Recommended security configuration
|
|
288
|
+
*
|
|
289
|
+
* Enables all security rules with sensible severity levels:
|
|
290
|
+
* - Critical injection vulnerabilities as errors
|
|
291
|
+
* - Important security issues as warnings
|
|
292
|
+
*/
|
|
293
|
+
recommended: {
|
|
294
|
+
plugins: {
|
|
295
|
+
'secure-coding': exports.plugin,
|
|
296
|
+
},
|
|
297
|
+
rules: recommendedRules,
|
|
298
|
+
},
|
|
299
|
+
/**
|
|
300
|
+
* Strict security configuration
|
|
301
|
+
*
|
|
302
|
+
* All security rules set to 'error' for maximum protection
|
|
303
|
+
*/
|
|
304
|
+
strict: {
|
|
305
|
+
plugins: {
|
|
306
|
+
'secure-coding': exports.plugin,
|
|
307
|
+
},
|
|
308
|
+
rules: Object.fromEntries(Object.keys(exports.rules).map(ruleName => [`secure-coding/${ruleName}`, 'error'])),
|
|
309
|
+
},
|
|
310
|
+
/**
|
|
311
|
+
* OWASP Top 10 focused configuration
|
|
312
|
+
*
|
|
313
|
+
* Rules mapped to OWASP Top 10 2021 categories
|
|
314
|
+
*/
|
|
315
|
+
'owasp-top-10': {
|
|
316
|
+
plugins: {
|
|
317
|
+
'secure-coding': exports.plugin,
|
|
318
|
+
},
|
|
319
|
+
rules: {
|
|
320
|
+
// A01:2021 – Broken Access Control
|
|
321
|
+
'secure-coding/no-missing-authentication': 'error',
|
|
322
|
+
'secure-coding/no-privilege-escalation': 'error',
|
|
323
|
+
'secure-coding/no-exposed-sensitive-data': 'error',
|
|
324
|
+
'secure-coding/no-insecure-redirects': 'error',
|
|
325
|
+
// A02:2021 – Cryptographic Failures
|
|
326
|
+
'secure-coding/no-hardcoded-credentials': 'error',
|
|
327
|
+
'secure-coding/no-unencrypted-transmission': 'error',
|
|
328
|
+
'secure-coding/no-sensitive-data-exposure': 'error',
|
|
329
|
+
// A03:2021 – Injection
|
|
330
|
+
'secure-coding/detect-eval-with-expression': 'error',
|
|
331
|
+
'secure-coding/detect-child-process': 'error',
|
|
332
|
+
'secure-coding/no-graphql-injection': 'error',
|
|
333
|
+
'secure-coding/no-xxe-injection': 'error',
|
|
334
|
+
'secure-coding/no-xpath-injection': 'error',
|
|
335
|
+
'secure-coding/no-ldap-injection': 'error',
|
|
336
|
+
'secure-coding/no-unescaped-url-parameter': 'error',
|
|
337
|
+
// A04:2021 – Insecure Design
|
|
338
|
+
'secure-coding/no-weak-password-recovery': 'error',
|
|
339
|
+
'secure-coding/no-improper-type-validation': 'error',
|
|
340
|
+
// A05:2021 – Security Misconfiguration
|
|
341
|
+
'secure-coding/no-missing-security-headers': 'error',
|
|
342
|
+
'secure-coding/no-missing-cors-check': 'error',
|
|
343
|
+
'secure-coding/no-clickjacking': 'error',
|
|
344
|
+
'secure-coding/no-electron-security-issues': 'error',
|
|
345
|
+
// A07:2021 – Identification and Authentication Failures
|
|
346
|
+
'secure-coding/no-insecure-comparison': 'error',
|
|
347
|
+
'secure-coding/no-missing-csrf-protection': 'error',
|
|
348
|
+
// A08:2021 – Software and Data Integrity Failures
|
|
349
|
+
'secure-coding/no-unsafe-deserialization': 'error',
|
|
350
|
+
'secure-coding/no-unsafe-dynamic-require': 'error',
|
|
351
|
+
},
|
|
352
|
+
},
|
|
353
|
+
/**
|
|
354
|
+
* OWASP Mobile Top 10 focused configuration
|
|
355
|
+
*
|
|
356
|
+
* Rules mapped to OWASP Mobile Top 10 2024 categories
|
|
357
|
+
*/
|
|
358
|
+
'owasp-mobile-top-10': {
|
|
359
|
+
plugins: {
|
|
360
|
+
'secure-coding': exports.plugin,
|
|
361
|
+
},
|
|
362
|
+
rules: {
|
|
363
|
+
// M1: Improper Credential Usage
|
|
364
|
+
'secure-coding/no-credentials-in-query-params': 'error',
|
|
365
|
+
'secure-coding/require-secure-credential-storage': 'error',
|
|
366
|
+
'secure-coding/no-hardcoded-credentials': 'error',
|
|
367
|
+
// M2: Inadequate Supply Chain Security
|
|
368
|
+
'secure-coding/require-dependency-integrity': 'error',
|
|
369
|
+
'secure-coding/detect-suspicious-dependencies': 'error',
|
|
370
|
+
'secure-coding/no-dynamic-dependency-loading': 'error',
|
|
371
|
+
'secure-coding/require-package-lock': 'error',
|
|
372
|
+
// M3: Insecure Authentication/Authorization
|
|
373
|
+
'secure-coding/no-client-side-auth-logic': 'error',
|
|
374
|
+
'secure-coding/require-backend-authorization': 'error',
|
|
375
|
+
'secure-coding/no-hardcoded-session-tokens': 'error',
|
|
376
|
+
'secure-coding/detect-weak-password-validation': 'error',
|
|
377
|
+
'secure-coding/no-password-in-url': 'error',
|
|
378
|
+
// M4: Insufficient Input/Output Validation
|
|
379
|
+
'secure-coding/no-unvalidated-deeplinks': 'error',
|
|
380
|
+
'secure-coding/require-url-validation': 'error',
|
|
381
|
+
'secure-coding/no-arbitrary-file-access': 'error',
|
|
382
|
+
'secure-coding/require-mime-type-validation': 'error',
|
|
383
|
+
'secure-coding/require-csp-headers': 'error',
|
|
384
|
+
// M5: Insecure Communication
|
|
385
|
+
'secure-coding/no-http-urls': 'error',
|
|
386
|
+
'secure-coding/no-disabled-certificate-validation': 'error',
|
|
387
|
+
'secure-coding/require-https-only': 'error',
|
|
388
|
+
'secure-coding/no-insecure-websocket': 'error',
|
|
389
|
+
'secure-coding/detect-mixed-content': 'error',
|
|
390
|
+
'secure-coding/no-allow-arbitrary-loads': 'error',
|
|
391
|
+
'secure-coding/require-network-timeout': 'error',
|
|
392
|
+
// M6: Inadequate Privacy Controls
|
|
393
|
+
'secure-coding/no-pii-in-logs': 'error',
|
|
394
|
+
'secure-coding/no-tracking-without-consent': 'error',
|
|
395
|
+
'secure-coding/require-data-minimization': 'error',
|
|
396
|
+
'secure-coding/no-sensitive-data-in-analytics': 'error',
|
|
397
|
+
// M7: Insufficient Binary Protections
|
|
398
|
+
'secure-coding/no-debug-code-in-production': 'error',
|
|
399
|
+
'secure-coding/require-code-minification': 'error',
|
|
400
|
+
// M8: Security Misconfiguration
|
|
401
|
+
'secure-coding/no-verbose-error-messages': 'error',
|
|
402
|
+
'secure-coding/no-exposed-debug-endpoints': 'error',
|
|
403
|
+
'secure-coding/require-secure-defaults': 'error',
|
|
404
|
+
'secure-coding/no-permissive-cors': 'error',
|
|
405
|
+
// M9: Insecure Data Storage
|
|
406
|
+
'secure-coding/no-sensitive-data-in-cache': 'error',
|
|
407
|
+
'secure-coding/require-storage-encryption': 'error',
|
|
408
|
+
'secure-coding/no-data-in-temp-storage': 'error',
|
|
409
|
+
'secure-coding/require-secure-deletion': 'error',
|
|
410
|
+
},
|
|
411
|
+
},
|
|
412
|
+
};
|
|
413
|
+
/**
|
|
414
|
+
* Default export for ESLint plugin
|
|
415
|
+
*/
|
|
416
|
+
exports.default = exports.plugin;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface Options {
|
|
2
|
+
/** Allow exec() with literal strings. Default: false (stricter) */
|
|
3
|
+
allowLiteralStrings?: boolean;
|
|
4
|
+
/** Allow spawn() with literal arguments. Default: false (stricter) */
|
|
5
|
+
allowLiteralSpawn?: boolean;
|
|
6
|
+
/** Additional child_process methods to check */
|
|
7
|
+
additionalMethods?: string[];
|
|
8
|
+
/** Strategy for fixing command injection: 'validate', 'sanitize', 'restrict', or 'auto' */
|
|
9
|
+
strategy?: 'validate' | 'sanitize' | 'restrict' | 'auto';
|
|
10
|
+
}
|
|
11
|
+
export declare const detectChildProcess: ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
|