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/src/index.ts
DELETED
|
@@ -1,605 +0,0 @@
|
|
|
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';
|