eslint-plugin-secure-coding 2.1.0 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +91 -12
- package/package.json +10 -4
- package/src/index.d.ts +1 -1
- package/src/index.js +223 -48
- package/src/index.js.map +1 -1
- package/src/rules/{security/database-injection.js → database-injection/index.js} +1 -1
- package/src/rules/database-injection/index.js.map +1 -0
- package/src/rules/{security/detect-child-process.js → detect-child-process/index.js} +1 -1
- package/src/rules/detect-child-process/index.js.map +1 -0
- package/src/rules/{security/detect-eval-with-expression.js → detect-eval-with-expression/index.js} +1 -1
- package/src/rules/detect-eval-with-expression/index.js.map +1 -0
- package/src/rules/detect-mixed-content/index.d.ts +8 -0
- package/src/rules/detect-mixed-content/index.js +45 -0
- package/src/rules/detect-mixed-content/index.js.map +1 -0
- package/src/rules/{security/detect-non-literal-fs-filename.js → detect-non-literal-fs-filename/index.js} +1 -1
- package/src/rules/detect-non-literal-fs-filename/index.js.map +1 -0
- package/src/rules/{security/detect-non-literal-regexp.js → detect-non-literal-regexp/index.js} +23 -6
- package/src/rules/detect-non-literal-regexp/index.js.map +1 -0
- package/src/rules/{security/detect-object-injection.js → detect-object-injection/index.js} +3 -1
- package/src/rules/detect-object-injection/index.js.map +1 -0
- package/src/rules/detect-suspicious-dependencies/index.d.ts +8 -0
- package/src/rules/detect-suspicious-dependencies/index.js +72 -0
- package/src/rules/detect-suspicious-dependencies/index.js.map +1 -0
- package/src/rules/detect-weak-password-validation/index.d.ts +6 -0
- package/src/rules/detect-weak-password-validation/index.js +59 -0
- package/src/rules/detect-weak-password-validation/index.js.map +1 -0
- package/src/rules/no-allow-arbitrary-loads/index.d.ts +8 -0
- package/src/rules/no-allow-arbitrary-loads/index.js +48 -0
- package/src/rules/no-allow-arbitrary-loads/index.js.map +1 -0
- package/src/rules/no-arbitrary-file-access/index.d.ts +6 -0
- package/src/rules/no-arbitrary-file-access/index.js +63 -0
- package/src/rules/no-arbitrary-file-access/index.js.map +1 -0
- package/src/rules/{security/no-buffer-overread.js → no-buffer-overread/index.js} +43 -5
- package/src/rules/no-buffer-overread/index.js.map +1 -0
- package/src/rules/{security/no-clickjacking.js → no-clickjacking/index.js} +23 -9
- package/src/rules/no-clickjacking/index.js.map +1 -0
- package/src/rules/no-client-side-auth-logic/index.d.ts +6 -0
- package/src/rules/no-client-side-auth-logic/index.js +70 -0
- package/src/rules/no-client-side-auth-logic/index.js.map +1 -0
- package/src/rules/no-credentials-in-query-params/index.d.ts +8 -0
- package/src/rules/no-credentials-in-query-params/index.js +58 -0
- package/src/rules/no-credentials-in-query-params/index.js.map +1 -0
- package/src/rules/no-credentials-in-storage-api/index.d.ts +6 -0
- package/src/rules/no-credentials-in-storage-api/index.js +55 -0
- package/src/rules/no-credentials-in-storage-api/index.js.map +1 -0
- package/src/rules/no-data-in-temp-storage/index.d.ts +6 -0
- package/src/rules/no-data-in-temp-storage/index.js +65 -0
- package/src/rules/no-data-in-temp-storage/index.js.map +1 -0
- package/src/rules/no-debug-code-in-production/index.d.ts +8 -0
- package/src/rules/no-debug-code-in-production/index.js +52 -0
- package/src/rules/no-debug-code-in-production/index.js.map +1 -0
- package/src/rules/{security/no-directive-injection.js → no-directive-injection/index.js} +17 -9
- package/src/rules/no-directive-injection/index.js.map +1 -0
- package/src/rules/no-disabled-certificate-validation/index.d.ts +6 -0
- package/src/rules/no-disabled-certificate-validation/index.js +62 -0
- package/src/rules/no-disabled-certificate-validation/index.js.map +1 -0
- package/src/rules/{security/no-document-cookie.js → no-document-cookie/index.js} +1 -1
- package/src/rules/no-document-cookie/index.js.map +1 -0
- package/src/rules/no-dynamic-dependency-loading/index.d.ts +8 -0
- package/src/rules/no-dynamic-dependency-loading/index.js +52 -0
- package/src/rules/no-dynamic-dependency-loading/index.js.map +1 -0
- package/src/rules/{security/no-electron-security-issues.js → no-electron-security-issues/index.js} +7 -4
- package/src/rules/no-electron-security-issues/index.js.map +1 -0
- package/src/rules/no-exposed-debug-endpoints/index.d.ts +6 -0
- package/src/rules/no-exposed-debug-endpoints/index.js +63 -0
- package/src/rules/no-exposed-debug-endpoints/index.js.map +1 -0
- package/src/rules/{security/no-exposed-sensitive-data.js → no-exposed-sensitive-data/index.js} +1 -1
- package/src/rules/no-exposed-sensitive-data/index.js.map +1 -0
- package/src/rules/{security/no-format-string-injection.js → no-format-string-injection/index.js} +17 -9
- package/src/rules/no-format-string-injection/index.js.map +1 -0
- package/src/rules/{security/no-graphql-injection.js → no-graphql-injection/index.js} +5 -3
- package/src/rules/no-graphql-injection/index.js.map +1 -0
- package/src/rules/{security/no-hardcoded-credentials.js → no-hardcoded-credentials/index.js} +1 -1
- package/src/rules/no-hardcoded-credentials/index.js.map +1 -0
- package/src/rules/no-hardcoded-session-tokens/index.d.ts +6 -0
- package/src/rules/no-hardcoded-session-tokens/index.js +60 -0
- package/src/rules/no-hardcoded-session-tokens/index.js.map +1 -0
- package/src/rules/no-http-urls/index.d.ts +12 -0
- package/src/rules/no-http-urls/index.js +115 -0
- package/src/rules/no-http-urls/index.js.map +1 -0
- package/src/rules/{security/no-improper-sanitization.js → no-improper-sanitization/index.js} +9 -5
- package/src/rules/no-improper-sanitization/index.js.map +1 -0
- package/src/rules/{security/no-improper-type-validation.js → no-improper-type-validation/index.js} +11 -6
- package/src/rules/no-improper-type-validation/index.js.map +1 -0
- package/src/rules/{security/no-insecure-comparison.js → no-insecure-comparison/index.js} +1 -1
- package/src/rules/no-insecure-comparison/index.js.map +1 -0
- package/src/rules/{security/no-insecure-cookie-settings.js → no-insecure-cookie-settings/index.js} +1 -1
- package/src/rules/no-insecure-cookie-settings/index.js.map +1 -0
- package/src/rules/{security/no-insecure-jwt.js → no-insecure-jwt/index.js} +24 -5
- package/src/rules/no-insecure-jwt/index.js.map +1 -0
- package/src/rules/{security/no-insecure-redirects.js → no-insecure-redirects/index.js} +3 -1
- package/src/rules/no-insecure-redirects/index.js.map +1 -0
- package/src/rules/no-insecure-websocket/index.d.ts +6 -0
- package/src/rules/no-insecure-websocket/index.js +62 -0
- package/src/rules/no-insecure-websocket/index.js.map +1 -0
- package/src/rules/{security/no-insufficient-postmessage-validation.js → no-insufficient-postmessage-validation/index.js} +7 -4
- package/src/rules/no-insufficient-postmessage-validation/index.js.map +1 -0
- package/src/rules/{security/no-insufficient-random.js → no-insufficient-random/index.js} +1 -1
- package/src/rules/no-insufficient-random/index.js.map +1 -0
- package/src/rules/{security/no-ldap-injection.js → no-ldap-injection/index.js} +15 -8
- package/src/rules/no-ldap-injection/index.js.map +1 -0
- package/src/rules/{security/no-missing-authentication.js → no-missing-authentication/index.js} +13 -1
- package/src/rules/no-missing-authentication/index.js.map +1 -0
- package/src/rules/{security/no-missing-cors-check.js → no-missing-cors-check/index.js} +1 -52
- package/src/rules/no-missing-cors-check/index.js.map +1 -0
- package/src/rules/{security/no-missing-csrf-protection.js → no-missing-csrf-protection/index.js} +1 -1
- package/src/rules/no-missing-csrf-protection/index.js.map +1 -0
- package/src/rules/{security/no-missing-security-headers.js → no-missing-security-headers/index.js} +1 -1
- package/src/rules/no-missing-security-headers/index.js.map +1 -0
- package/src/rules/no-password-in-url/index.d.ts +8 -0
- package/src/rules/no-password-in-url/index.js +56 -0
- package/src/rules/no-password-in-url/index.js.map +1 -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-permissive-cors/index.js.map +1 -0
- package/src/rules/no-pii-in-logs/index.d.ts +8 -0
- package/src/rules/no-pii-in-logs/index.js +72 -0
- package/src/rules/no-pii-in-logs/index.js.map +1 -0
- package/src/rules/no-postmessage-origin-wildcard/index.d.ts +8 -0
- package/src/rules/no-postmessage-origin-wildcard/index.js +58 -0
- package/src/rules/no-postmessage-origin-wildcard/index.js.map +1 -0
- package/src/rules/{security/no-privilege-escalation.js → no-privilege-escalation/index.js} +3 -35
- package/src/rules/no-privilege-escalation/index.js.map +1 -0
- package/src/rules/{security/no-redos-vulnerable-regex.js → no-redos-vulnerable-regex/index.js} +1 -1
- package/src/rules/no-redos-vulnerable-regex/index.js.map +1 -0
- package/src/rules/{security/no-sensitive-data-exposure.js → no-sensitive-data-exposure/index.js} +1 -1
- package/src/rules/no-sensitive-data-exposure/index.js.map +1 -0
- package/src/rules/no-sensitive-data-in-analytics/index.d.ts +8 -0
- package/src/rules/no-sensitive-data-in-analytics/index.js +63 -0
- package/src/rules/no-sensitive-data-in-analytics/index.js.map +1 -0
- package/src/rules/no-sensitive-data-in-cache/index.d.ts +8 -0
- package/src/rules/no-sensitive-data-in-cache/index.js +53 -0
- package/src/rules/no-sensitive-data-in-cache/index.js.map +1 -0
- package/src/rules/{security/no-sql-injection.js → no-sql-injection/index.js} +5 -1
- package/src/rules/no-sql-injection/index.js.map +1 -0
- package/src/rules/{security/no-timing-attack.js → no-timing-attack/index.js} +1 -1
- package/src/rules/no-timing-attack/index.js.map +1 -0
- package/src/rules/{security/no-toctou-vulnerability.js → no-toctou-vulnerability/index.js} +1 -1
- package/src/rules/no-toctou-vulnerability/index.js.map +1 -0
- package/src/rules/no-tracking-without-consent/index.d.ts +6 -0
- package/src/rules/no-tracking-without-consent/index.js +68 -0
- package/src/rules/no-tracking-without-consent/index.js.map +1 -0
- package/src/rules/{security/no-unchecked-loop-condition.js → no-unchecked-loop-condition/index.js} +25 -13
- package/src/rules/no-unchecked-loop-condition/index.js.map +1 -0
- package/src/rules/no-unencrypted-local-storage/index.d.ts +8 -0
- package/src/rules/no-unencrypted-local-storage/index.js +63 -0
- package/src/rules/no-unencrypted-local-storage/index.js.map +1 -0
- package/src/rules/{security/no-unencrypted-transmission.js → no-unencrypted-transmission/index.js} +1 -1
- package/src/rules/no-unencrypted-transmission/index.js.map +1 -0
- package/src/rules/{security/no-unescaped-url-parameter.js → no-unescaped-url-parameter/index.js} +1 -1
- package/src/rules/no-unescaped-url-parameter/index.js.map +1 -0
- package/src/rules/{security/no-unlimited-resource-allocation.js → no-unlimited-resource-allocation/index.js} +29 -62
- package/src/rules/no-unlimited-resource-allocation/index.js.map +1 -0
- package/src/rules/{security/no-unsafe-deserialization.js → no-unsafe-deserialization/index.js} +3 -2
- package/src/rules/no-unsafe-deserialization/index.js.map +1 -0
- package/src/rules/{security/no-unsafe-dynamic-require.js → no-unsafe-dynamic-require/index.js} +1 -1
- package/src/rules/no-unsafe-dynamic-require/index.js.map +1 -0
- package/src/rules/{security/no-unsafe-regex-construction.js → no-unsafe-regex-construction/index.js} +1 -1
- package/src/rules/no-unsafe-regex-construction/index.js.map +1 -0
- package/src/rules/{security/no-unsanitized-html.js → no-unsanitized-html/index.js} +14 -83
- package/src/rules/no-unsanitized-html/index.js.map +1 -0
- package/src/rules/no-unvalidated-deeplinks/index.d.ts +6 -0
- package/src/rules/no-unvalidated-deeplinks/index.js +63 -0
- package/src/rules/no-unvalidated-deeplinks/index.js.map +1 -0
- package/src/rules/{security/no-unvalidated-user-input.js → no-unvalidated-user-input/index.js} +1 -1
- package/src/rules/no-unvalidated-user-input/index.js.map +1 -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-verbose-error-messages/index.js.map +1 -0
- package/src/rules/{security/no-weak-crypto.js → no-weak-crypto/index.js} +1 -1
- package/src/rules/no-weak-crypto/index.js.map +1 -0
- package/src/rules/{security/no-weak-password-recovery.js → no-weak-password-recovery/index.js} +21 -8
- package/src/rules/no-weak-password-recovery/index.js.map +1 -0
- package/src/rules/{security/no-xpath-injection.js → no-xpath-injection/index.js} +3 -2
- package/src/rules/no-xpath-injection/index.js.map +1 -0
- package/src/rules/{security/no-xxe-injection.js → no-xxe-injection/index.js} +2 -5
- package/src/rules/no-xxe-injection/index.js.map +1 -0
- package/src/rules/{security/no-zip-slip.js → no-zip-slip/index.js} +1 -1
- package/src/rules/no-zip-slip/index.js.map +1 -0
- package/src/rules/require-backend-authorization/index.d.ts +6 -0
- package/src/rules/require-backend-authorization/index.js +61 -0
- package/src/rules/require-backend-authorization/index.js.map +1 -0
- package/src/rules/require-code-minification/index.d.ts +8 -0
- package/src/rules/require-code-minification/index.js +48 -0
- package/src/rules/require-code-minification/index.js.map +1 -0
- package/src/rules/require-csp-headers/index.d.ts +6 -0
- package/src/rules/require-csp-headers/index.js +65 -0
- package/src/rules/require-csp-headers/index.js.map +1 -0
- package/src/rules/require-data-minimization/index.d.ts +8 -0
- package/src/rules/require-data-minimization/index.js +54 -0
- package/src/rules/require-data-minimization/index.js.map +1 -0
- package/src/rules/require-dependency-integrity/index.d.ts +6 -0
- package/src/rules/require-dependency-integrity/index.js +65 -0
- package/src/rules/require-dependency-integrity/index.js.map +1 -0
- package/src/rules/require-https-only/index.d.ts +8 -0
- package/src/rules/require-https-only/index.js +64 -0
- package/src/rules/require-https-only/index.js.map +1 -0
- package/src/rules/require-mime-type-validation/index.d.ts +6 -0
- package/src/rules/require-mime-type-validation/index.js +67 -0
- package/src/rules/require-mime-type-validation/index.js.map +1 -0
- package/src/rules/require-network-timeout/index.d.ts +8 -0
- package/src/rules/require-network-timeout/index.js +51 -0
- package/src/rules/require-network-timeout/index.js.map +1 -0
- package/src/rules/require-package-lock/index.d.ts +8 -0
- package/src/rules/require-package-lock/index.js +64 -0
- package/src/rules/require-package-lock/index.js.map +1 -0
- package/src/rules/require-secure-credential-storage/index.d.ts +8 -0
- package/src/rules/require-secure-credential-storage/index.js +51 -0
- package/src/rules/require-secure-credential-storage/index.js.map +1 -0
- package/src/rules/require-secure-defaults/index.d.ts +8 -0
- package/src/rules/require-secure-defaults/index.js +48 -0
- package/src/rules/require-secure-defaults/index.js.map +1 -0
- package/src/rules/require-secure-deletion/index.d.ts +8 -0
- package/src/rules/require-secure-deletion/index.js +45 -0
- package/src/rules/require-secure-deletion/index.js.map +1 -0
- package/src/rules/require-storage-encryption/index.d.ts +8 -0
- package/src/rules/require-storage-encryption/index.js +51 -0
- package/src/rules/require-storage-encryption/index.js.map +1 -0
- package/src/rules/require-url-validation/index.d.ts +6 -0
- package/src/rules/require-url-validation/index.js +73 -0
- package/src/rules/require-url-validation/index.js.map +1 -0
- package/src/types/index.d.ts +48 -48
- package/src/rules/security/database-injection.js.map +0 -1
- package/src/rules/security/detect-child-process.js.map +0 -1
- package/src/rules/security/detect-eval-with-expression.js.map +0 -1
- package/src/rules/security/detect-non-literal-fs-filename.js.map +0 -1
- package/src/rules/security/detect-non-literal-regexp.js.map +0 -1
- package/src/rules/security/detect-object-injection.js.map +0 -1
- package/src/rules/security/no-buffer-overread.js.map +0 -1
- package/src/rules/security/no-clickjacking.js.map +0 -1
- package/src/rules/security/no-directive-injection.js.map +0 -1
- package/src/rules/security/no-document-cookie.js.map +0 -1
- package/src/rules/security/no-electron-security-issues.js.map +0 -1
- package/src/rules/security/no-exposed-sensitive-data.js.map +0 -1
- package/src/rules/security/no-format-string-injection.js.map +0 -1
- package/src/rules/security/no-graphql-injection.js.map +0 -1
- package/src/rules/security/no-hardcoded-credentials.js.map +0 -1
- package/src/rules/security/no-improper-sanitization.js.map +0 -1
- package/src/rules/security/no-improper-type-validation.js.map +0 -1
- package/src/rules/security/no-insecure-comparison.js.map +0 -1
- package/src/rules/security/no-insecure-cookie-settings.js.map +0 -1
- package/src/rules/security/no-insecure-jwt.js.map +0 -1
- package/src/rules/security/no-insecure-redirects.js.map +0 -1
- package/src/rules/security/no-insufficient-postmessage-validation.js.map +0 -1
- package/src/rules/security/no-insufficient-random.js.map +0 -1
- package/src/rules/security/no-ldap-injection.js.map +0 -1
- package/src/rules/security/no-missing-authentication.js.map +0 -1
- package/src/rules/security/no-missing-cors-check.js.map +0 -1
- package/src/rules/security/no-missing-csrf-protection.js.map +0 -1
- package/src/rules/security/no-missing-security-headers.js.map +0 -1
- package/src/rules/security/no-privilege-escalation.js.map +0 -1
- package/src/rules/security/no-redos-vulnerable-regex.js.map +0 -1
- package/src/rules/security/no-sensitive-data-exposure.js.map +0 -1
- package/src/rules/security/no-sql-injection.js.map +0 -1
- package/src/rules/security/no-timing-attack.js.map +0 -1
- package/src/rules/security/no-toctou-vulnerability.js.map +0 -1
- package/src/rules/security/no-unchecked-loop-condition.js.map +0 -1
- package/src/rules/security/no-unencrypted-transmission.js.map +0 -1
- package/src/rules/security/no-unescaped-url-parameter.js.map +0 -1
- package/src/rules/security/no-unlimited-resource-allocation.js.map +0 -1
- package/src/rules/security/no-unsafe-deserialization.js.map +0 -1
- package/src/rules/security/no-unsafe-dynamic-require.js.map +0 -1
- package/src/rules/security/no-unsafe-regex-construction.js.map +0 -1
- package/src/rules/security/no-unsanitized-html.js.map +0 -1
- package/src/rules/security/no-unvalidated-user-input.js.map +0 -1
- package/src/rules/security/no-weak-crypto.js.map +0 -1
- package/src/rules/security/no-weak-password-recovery.js.map +0 -1
- package/src/rules/security/no-xpath-injection.js.map +0 -1
- package/src/rules/security/no-xxe-injection.js.map +0 -1
- package/src/rules/security/no-zip-slip.js.map +0 -1
- /package/src/rules/{security/database-injection.d.ts → database-injection/index.d.ts} +0 -0
- /package/src/rules/{security/detect-child-process.d.ts → detect-child-process/index.d.ts} +0 -0
- /package/src/rules/{security/detect-eval-with-expression.d.ts → detect-eval-with-expression/index.d.ts} +0 -0
- /package/src/rules/{security/detect-non-literal-fs-filename.d.ts → detect-non-literal-fs-filename/index.d.ts} +0 -0
- /package/src/rules/{security/detect-non-literal-regexp.d.ts → detect-non-literal-regexp/index.d.ts} +0 -0
- /package/src/rules/{security/detect-object-injection.d.ts → detect-object-injection/index.d.ts} +0 -0
- /package/src/rules/{security/no-buffer-overread.d.ts → no-buffer-overread/index.d.ts} +0 -0
- /package/src/rules/{security/no-clickjacking.d.ts → no-clickjacking/index.d.ts} +0 -0
- /package/src/rules/{security/no-directive-injection.d.ts → no-directive-injection/index.d.ts} +0 -0
- /package/src/rules/{security/no-document-cookie.d.ts → no-document-cookie/index.d.ts} +0 -0
- /package/src/rules/{security/no-electron-security-issues.d.ts → no-electron-security-issues/index.d.ts} +0 -0
- /package/src/rules/{security/no-exposed-sensitive-data.d.ts → no-exposed-sensitive-data/index.d.ts} +0 -0
- /package/src/rules/{security/no-format-string-injection.d.ts → no-format-string-injection/index.d.ts} +0 -0
- /package/src/rules/{security/no-graphql-injection.d.ts → no-graphql-injection/index.d.ts} +0 -0
- /package/src/rules/{security/no-hardcoded-credentials.d.ts → no-hardcoded-credentials/index.d.ts} +0 -0
- /package/src/rules/{security/no-improper-sanitization.d.ts → no-improper-sanitization/index.d.ts} +0 -0
- /package/src/rules/{security/no-improper-type-validation.d.ts → no-improper-type-validation/index.d.ts} +0 -0
- /package/src/rules/{security/no-insecure-comparison.d.ts → no-insecure-comparison/index.d.ts} +0 -0
- /package/src/rules/{security/no-insecure-cookie-settings.d.ts → no-insecure-cookie-settings/index.d.ts} +0 -0
- /package/src/rules/{security/no-insecure-jwt.d.ts → no-insecure-jwt/index.d.ts} +0 -0
- /package/src/rules/{security/no-insecure-redirects.d.ts → no-insecure-redirects/index.d.ts} +0 -0
- /package/src/rules/{security/no-insufficient-postmessage-validation.d.ts → no-insufficient-postmessage-validation/index.d.ts} +0 -0
- /package/src/rules/{security/no-insufficient-random.d.ts → no-insufficient-random/index.d.ts} +0 -0
- /package/src/rules/{security/no-ldap-injection.d.ts → no-ldap-injection/index.d.ts} +0 -0
- /package/src/rules/{security/no-missing-authentication.d.ts → no-missing-authentication/index.d.ts} +0 -0
- /package/src/rules/{security/no-missing-cors-check.d.ts → no-missing-cors-check/index.d.ts} +0 -0
- /package/src/rules/{security/no-missing-csrf-protection.d.ts → no-missing-csrf-protection/index.d.ts} +0 -0
- /package/src/rules/{security/no-missing-security-headers.d.ts → no-missing-security-headers/index.d.ts} +0 -0
- /package/src/rules/{security/no-privilege-escalation.d.ts → no-privilege-escalation/index.d.ts} +0 -0
- /package/src/rules/{security/no-redos-vulnerable-regex.d.ts → no-redos-vulnerable-regex/index.d.ts} +0 -0
- /package/src/rules/{security/no-sensitive-data-exposure.d.ts → no-sensitive-data-exposure/index.d.ts} +0 -0
- /package/src/rules/{security/no-sql-injection.d.ts → no-sql-injection/index.d.ts} +0 -0
- /package/src/rules/{security/no-timing-attack.d.ts → no-timing-attack/index.d.ts} +0 -0
- /package/src/rules/{security/no-toctou-vulnerability.d.ts → no-toctou-vulnerability/index.d.ts} +0 -0
- /package/src/rules/{security/no-unchecked-loop-condition.d.ts → no-unchecked-loop-condition/index.d.ts} +0 -0
- /package/src/rules/{security/no-unencrypted-transmission.d.ts → no-unencrypted-transmission/index.d.ts} +0 -0
- /package/src/rules/{security/no-unescaped-url-parameter.d.ts → no-unescaped-url-parameter/index.d.ts} +0 -0
- /package/src/rules/{security/no-unlimited-resource-allocation.d.ts → no-unlimited-resource-allocation/index.d.ts} +0 -0
- /package/src/rules/{security/no-unsafe-deserialization.d.ts → no-unsafe-deserialization/index.d.ts} +0 -0
- /package/src/rules/{security/no-unsafe-dynamic-require.d.ts → no-unsafe-dynamic-require/index.d.ts} +0 -0
- /package/src/rules/{security/no-unsafe-regex-construction.d.ts → no-unsafe-regex-construction/index.d.ts} +0 -0
- /package/src/rules/{security/no-unsanitized-html.d.ts → no-unsanitized-html/index.d.ts} +0 -0
- /package/src/rules/{security/no-unvalidated-user-input.d.ts → no-unvalidated-user-input/index.d.ts} +0 -0
- /package/src/rules/{security/no-weak-crypto.d.ts → no-weak-crypto/index.d.ts} +0 -0
- /package/src/rules/{security/no-weak-password-recovery.d.ts → no-weak-password-recovery/index.d.ts} +0 -0
- /package/src/rules/{security/no-xpath-injection.d.ts → no-xpath-injection/index.d.ts} +0 -0
- /package/src/rules/{security/no-xxe-injection.d.ts → no-xxe-injection/index.d.ts} +0 -0
- /package/src/rules/{security/no-zip-slip.d.ts → no-zip-slip/index.d.ts} +0 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview Identify excessive data collection
|
|
4
|
+
* @see https://owasp.org/www-project-mobile-top-10/
|
|
5
|
+
* @see https://cwe.mitre.org/data/definitions/213.html
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.requireDataMinimization = void 0;
|
|
9
|
+
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
10
|
+
exports.requireDataMinimization = (0, eslint_devkit_1.createRule)({
|
|
11
|
+
name: 'require-data-minimization',
|
|
12
|
+
meta: {
|
|
13
|
+
type: 'suggestion',
|
|
14
|
+
docs: {
|
|
15
|
+
description: 'Identify excessive data collection patterns',
|
|
16
|
+
category: 'Security',
|
|
17
|
+
recommended: true,
|
|
18
|
+
owaspMobile: ['M6'],
|
|
19
|
+
cweIds: ['CWE-213'],
|
|
20
|
+
},
|
|
21
|
+
messages: {
|
|
22
|
+
violationDetected: (0, eslint_devkit_1.formatLLMMessage)({
|
|
23
|
+
icon: eslint_devkit_1.MessageIcons.SECURITY,
|
|
24
|
+
issueName: 'violation Detected',
|
|
25
|
+
cwe: 'CWE-213',
|
|
26
|
+
description: 'Excessive data collection detected - only collect data that is necessary',
|
|
27
|
+
severity: 'MEDIUM',
|
|
28
|
+
fix: 'Review and apply secure practices',
|
|
29
|
+
documentationLink: 'https://cwe.mitre.org/data/definitions/213.html',
|
|
30
|
+
})
|
|
31
|
+
},
|
|
32
|
+
schema: [],
|
|
33
|
+
},
|
|
34
|
+
defaultOptions: [],
|
|
35
|
+
create(context) {
|
|
36
|
+
function report(node) {
|
|
37
|
+
context.report({ node, messageId: 'violationDetected' });
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
ObjectExpression(node) {
|
|
41
|
+
// Flag objects with >10 properties being collected
|
|
42
|
+
if (node.properties.length > 10) {
|
|
43
|
+
// Check if this looks like user data collection
|
|
44
|
+
const hasUserData = node.properties.some(p => p.type === 'Property' &&
|
|
45
|
+
['email', 'name', 'phone', 'address'].includes(p.key.name));
|
|
46
|
+
if (hasUserData) {
|
|
47
|
+
report(node);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/eslint-plugin-secure-coding/src/rules/require-data-minimization/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,4DAAsF;AAUzE,QAAA,uBAAuB,GAAG,IAAA,0BAAU,EAA0B;IACzE,IAAI,EAAE,2BAA2B;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE;YACJ,WAAW,EAAE,6CAA6C;YAC1D,QAAQ,EAAE,UAAU;YACpB,WAAW,EAAE,IAAI;YACjB,WAAW,EAAE,CAAC,IAAI,CAAC;YACnB,MAAM,EAAE,CAAC,SAAS,CAAC;SACpB;QACD,QAAQ,EAAE;YACR,iBAAiB,EAAE,IAAA,gCAAgB,EAAC;gBAClC,IAAI,EAAE,4BAAY,CAAC,QAAQ;gBAC3B,SAAS,EAAE,oBAAoB;gBAC/B,GAAG,EAAE,SAAS;gBACd,WAAW,EAAE,0EAA0E;gBACvF,QAAQ,EAAE,QAAQ;gBAClB,GAAG,EAAE,mCAAmC;gBACxC,iBAAiB,EAAE,iDAAiD;aACrE,CAAC;SACH;QACD,MAAM,EAAE,EAAE;KACX;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,CAAC,OAAO;QACZ,SAAS,MAAM,CAAC,IAAmB;YACjC,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,mBAAmB,EAAE,CAAC,CAAC;QAC3D,CAAC;QAED,OAAO;YACL,gBAAgB,CAAC,IAA+B;gBAC9C,mDAAmD;gBACnD,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,EAAE,EAAE,CAAC;oBAChC,gDAAgD;oBAChD,MAAM,WAAW,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAC3C,CAAC,CAAC,IAAI,KAAK,UAAU;wBACrB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAC3D,CAAC;oBAEF,IAAI,WAAW,EAAE,CAAC;wBAChB,MAAM,CAAC,IAAI,CAAC,CAAC;oBACf,CAAC;gBACH,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview Require integrity hashes for external resources
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.requireDependencyIntegrity = void 0;
|
|
7
|
+
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
8
|
+
exports.requireDependencyIntegrity = (0, eslint_devkit_1.createRule)({
|
|
9
|
+
name: 'require-dependency-integrity',
|
|
10
|
+
meta: {
|
|
11
|
+
type: 'problem',
|
|
12
|
+
docs: {
|
|
13
|
+
description: 'Require SRI (Subresource Integrity) for CDN resources',
|
|
14
|
+
},
|
|
15
|
+
messages: {
|
|
16
|
+
violationDetected: (0, eslint_devkit_1.formatLLMMessage)({
|
|
17
|
+
icon: eslint_devkit_1.MessageIcons.SECURITY,
|
|
18
|
+
issueName: 'Missing SRI',
|
|
19
|
+
cwe: 'CWE-494',
|
|
20
|
+
description: 'External resource loaded without integrity hash - supply chain risk',
|
|
21
|
+
severity: 'HIGH',
|
|
22
|
+
fix: 'Add integrity="sha384-..." and crossorigin="anonymous" attributes',
|
|
23
|
+
documentationLink: 'https://cwe.mitre.org/data/definitions/494.html',
|
|
24
|
+
})
|
|
25
|
+
},
|
|
26
|
+
schema: [],
|
|
27
|
+
},
|
|
28
|
+
defaultOptions: [],
|
|
29
|
+
create(context) {
|
|
30
|
+
function report(node) {
|
|
31
|
+
context.report({ node, messageId: 'violationDetected' });
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
Literal(node) {
|
|
35
|
+
if (typeof node.value !== 'string')
|
|
36
|
+
return;
|
|
37
|
+
// Check for script/link tags without integrity
|
|
38
|
+
const value = node.value.toLowerCase();
|
|
39
|
+
if ((value.includes('<script') && value.includes('src=')) ||
|
|
40
|
+
(value.includes('<link') && value.includes('href='))) {
|
|
41
|
+
// Check if CDN source
|
|
42
|
+
if (value.includes('cdn.') || value.includes('cdnjs.') ||
|
|
43
|
+
value.includes('unpkg.') || value.includes('jsdelivr.')) {
|
|
44
|
+
if (!value.includes('integrity=')) {
|
|
45
|
+
report(node);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
TemplateLiteral(node) {
|
|
51
|
+
const text = context.sourceCode.getText(node).toLowerCase();
|
|
52
|
+
if ((text.includes('<script') && text.includes('src=')) ||
|
|
53
|
+
(text.includes('<link') && text.includes('href='))) {
|
|
54
|
+
if (text.includes('cdn.') || text.includes('cdnjs.') ||
|
|
55
|
+
text.includes('unpkg.') || text.includes('jsdelivr.')) {
|
|
56
|
+
if (!text.includes('integrity=')) {
|
|
57
|
+
report(node);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/eslint-plugin-secure-coding/src/rules/require-dependency-integrity/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,4DAAsF;AAUzE,QAAA,0BAA0B,GAAG,IAAA,0BAAU,EAA0B;IAC5E,IAAI,EAAE,8BAA8B;IACpC,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACJ,WAAW,EAAE,uDAAuD;SACrE;QACD,QAAQ,EAAE;YACR,iBAAiB,EAAE,IAAA,gCAAgB,EAAC;gBAClC,IAAI,EAAE,4BAAY,CAAC,QAAQ;gBAC3B,SAAS,EAAE,aAAa;gBACxB,GAAG,EAAE,SAAS;gBACd,WAAW,EAAE,qEAAqE;gBAClF,QAAQ,EAAE,MAAM;gBAChB,GAAG,EAAE,mEAAmE;gBACxE,iBAAiB,EAAE,iDAAiD;aACrE,CAAC;SACH;QACD,MAAM,EAAE,EAAE;KACX;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,CAAC,OAAO;QACZ,SAAS,MAAM,CAAC,IAAmB;YACjC,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,mBAAmB,EAAE,CAAC,CAAC;QAC3D,CAAC;QAED,OAAO;YACL,OAAO,CAAC,IAAsB;gBAC5B,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ;oBAAE,OAAO;gBAE3C,+CAA+C;gBAC/C,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;gBACvC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;oBACrD,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC;oBAEzD,sBAAsB;oBACtB,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC;wBAClD,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;wBAE5D,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;4BAClC,MAAM,CAAC,IAAI,CAAC,CAAC;wBACf,CAAC;oBACH,CAAC;gBACH,CAAC;YACH,CAAC;YAED,eAAe,CAAC,IAA8B;gBAC5C,MAAM,IAAI,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;gBAE5D,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;oBACnD,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC;oBAEvD,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC;wBAChD,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;wBAE1D,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;4BACjC,MAAM,CAAC,IAAI,CAAC,CAAC;wBACf,CAAC;oBACH,CAAC;gBACH,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Enforce HTTPS for all external requests
|
|
3
|
+
* @see https://owasp.org/www-project-mobile-top-10/
|
|
4
|
+
* @see https://cwe.mitre.org/data/definitions/319.html
|
|
5
|
+
*/
|
|
6
|
+
export interface Options {
|
|
7
|
+
}
|
|
8
|
+
export declare const requireHttpsOnly: ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview Enforce HTTPS for all external requests
|
|
4
|
+
* @see https://owasp.org/www-project-mobile-top-10/
|
|
5
|
+
* @see https://cwe.mitre.org/data/definitions/319.html
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.requireHttpsOnly = void 0;
|
|
9
|
+
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
10
|
+
exports.requireHttpsOnly = (0, eslint_devkit_1.createRule)({
|
|
11
|
+
name: 'require-https-only',
|
|
12
|
+
meta: {
|
|
13
|
+
type: 'problem',
|
|
14
|
+
docs: {
|
|
15
|
+
description: 'Enforce HTTPS for all external requests',
|
|
16
|
+
category: 'Security',
|
|
17
|
+
recommended: true,
|
|
18
|
+
owaspMobile: ['M5'],
|
|
19
|
+
cweIds: ["CWE-319"],
|
|
20
|
+
},
|
|
21
|
+
messages: {
|
|
22
|
+
violationDetected: (0, eslint_devkit_1.formatLLMMessage)({
|
|
23
|
+
icon: eslint_devkit_1.MessageIcons.SECURITY,
|
|
24
|
+
issueName: 'violation Detected',
|
|
25
|
+
cwe: 'CWE-319',
|
|
26
|
+
description: 'Enforce HTTPS for all external requests detected - this is a security risk',
|
|
27
|
+
severity: 'HIGH',
|
|
28
|
+
fix: 'Review and apply secure practices',
|
|
29
|
+
documentationLink: 'https://cwe.mitre.org/data/definitions/319.html',
|
|
30
|
+
})
|
|
31
|
+
},
|
|
32
|
+
schema: [],
|
|
33
|
+
},
|
|
34
|
+
defaultOptions: [],
|
|
35
|
+
create(context) {
|
|
36
|
+
const sourceCode = context.sourceCode;
|
|
37
|
+
function report(node) {
|
|
38
|
+
context.report({
|
|
39
|
+
node,
|
|
40
|
+
messageId: 'violationDetected',
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
CallExpression(node) {
|
|
45
|
+
// Check fetch/axios calls with http:// URLs
|
|
46
|
+
if (node.type === 'CallExpression') {
|
|
47
|
+
const callee = node.callee;
|
|
48
|
+
const isHttpCall = (callee.name === 'fetch' ||
|
|
49
|
+
(callee.object?.name === 'axios' &&
|
|
50
|
+
['get', 'post', 'put', 'delete', 'patch'].includes(callee.property?.name)));
|
|
51
|
+
if (isHttpCall && node.arguments[0]) {
|
|
52
|
+
const url = node.arguments[0];
|
|
53
|
+
if (url.type === 'Literal' &&
|
|
54
|
+
typeof url.value === 'string' &&
|
|
55
|
+
url.value.startsWith('http://')) {
|
|
56
|
+
report(node);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/eslint-plugin-secure-coding/src/rules/require-https-only/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,4DAAsF;AAUzE,QAAA,gBAAgB,GAAG,IAAA,0BAAU,EAA0B;IAClE,IAAI,EAAE,oBAAoB;IAC1B,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACJ,WAAW,EAAE,yCAAyC;YACtD,QAAQ,EAAE,UAAU;YACpB,WAAW,EAAE,IAAI;YACjB,WAAW,EAAE,CAAC,IAAI,CAAC;YACnB,MAAM,EAAE,CAAC,SAAS,CAAC;SACpB;QACD,QAAQ,EAAE;YACR,iBAAiB,EAAE,IAAA,gCAAgB,EAAC;gBAClC,IAAI,EAAE,4BAAY,CAAC,QAAQ;gBAC3B,SAAS,EAAE,oBAAoB;gBAC/B,GAAG,EAAE,SAAS;gBACd,WAAW,EAAE,4EAA4E;gBACzF,QAAQ,EAAE,MAAM;gBAChB,GAAG,EAAE,mCAAmC;gBACxC,iBAAiB,EAAE,iDAAiD;aACrE,CAAC;SACH;QACD,MAAM,EAAE,EAAE;KACX;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,CAAC,OAAO;QACZ,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;QAEtC,SAAS,MAAM,CAAC,IAAmB;YACjC,OAAO,CAAC,MAAM,CAAC;gBACb,IAAI;gBACJ,SAAS,EAAE,mBAAmB;aAC/B,CAAC,CAAC;QACL,CAAC;QAED,OAAO;YACL,cAAc,CAAC,IAA6B;gBAE5C,4CAA4C;gBAC5C,IAAI,IAAI,CAAC,IAAI,KAAK,gBAAgB,EAAE,CAAC;oBACnC,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;oBAC3B,MAAM,UAAU,GACd,CAAC,MAAM,CAAC,IAAI,KAAK,OAAO;wBACvB,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,KAAK,OAAO;4BAC/B,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;oBAEhF,IAAI,UAAU,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;wBACpC,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;wBAC9B,IAAI,GAAG,CAAC,IAAI,KAAK,SAAS;4BACtB,OAAO,GAAG,CAAC,KAAK,KAAK,QAAQ;4BAC7B,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;4BACpC,MAAM,CAAC,IAAI,CAAC,CAAC;wBACf,CAAC;oBACH,CAAC;gBACH,CAAC;YAED,CAAC;SAEA,CAAC;IACN,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview Require MIME type validation for uploads
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.requireMimeTypeValidation = void 0;
|
|
7
|
+
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
8
|
+
exports.requireMimeTypeValidation = (0, eslint_devkit_1.createRule)({
|
|
9
|
+
name: 'require-mime-type-validation',
|
|
10
|
+
meta: {
|
|
11
|
+
type: 'problem',
|
|
12
|
+
docs: {
|
|
13
|
+
description: 'Require MIME type validation for file uploads',
|
|
14
|
+
},
|
|
15
|
+
messages: {
|
|
16
|
+
violationDetected: (0, eslint_devkit_1.formatLLMMessage)({
|
|
17
|
+
icon: eslint_devkit_1.MessageIcons.SECURITY,
|
|
18
|
+
issueName: 'Missing MIME Validation',
|
|
19
|
+
cwe: 'CWE-434',
|
|
20
|
+
description: 'File upload without MIME type validation - unrestricted upload vulnerability',
|
|
21
|
+
severity: 'HIGH',
|
|
22
|
+
fix: 'Add fileFilter option to validate MIME types',
|
|
23
|
+
documentationLink: 'https://cwe.mitre.org/data/definitions/434.html',
|
|
24
|
+
})
|
|
25
|
+
},
|
|
26
|
+
schema: [],
|
|
27
|
+
},
|
|
28
|
+
defaultOptions: [],
|
|
29
|
+
create(context) {
|
|
30
|
+
function report(node) {
|
|
31
|
+
context.report({ node, messageId: 'violationDetected' });
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
CallExpression(node) {
|
|
35
|
+
// Detect multer().single() or multer().array() without fileFilter
|
|
36
|
+
if (node.callee.type === 'MemberExpression' &&
|
|
37
|
+
node.callee.property.type === 'Identifier' &&
|
|
38
|
+
['single', 'array', 'fields'].includes(node.callee.property.name)) {
|
|
39
|
+
// Check if parent has fileFilter configuration
|
|
40
|
+
const calleeObj = node.callee.object;
|
|
41
|
+
if (calleeObj.type === 'CallExpression') {
|
|
42
|
+
const multerArgs = calleeObj.arguments[0];
|
|
43
|
+
if (multerArgs && multerArgs.type === 'ObjectExpression') {
|
|
44
|
+
const hasFileFilter = multerArgs.properties.some((p) => p.key?.name === 'fileFilter' || p.key?.name === 'limits');
|
|
45
|
+
if (!hasFileFilter) {
|
|
46
|
+
report(node);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
else if (!multerArgs) {
|
|
50
|
+
// No config at all = no validation
|
|
51
|
+
report(node);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
// Detect upload() calls directly
|
|
56
|
+
if (node.callee.type === 'Identifier' && node.callee.name === 'upload') {
|
|
57
|
+
// Check if there's validation in arguments
|
|
58
|
+
if (node.arguments.length === 0 ||
|
|
59
|
+
(node.arguments[0]?.type === 'Identifier')) {
|
|
60
|
+
report(node);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/eslint-plugin-secure-coding/src/rules/require-mime-type-validation/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,4DAAsF;AAUzE,QAAA,yBAAyB,GAAG,IAAA,0BAAU,EAA0B;IAC3E,IAAI,EAAE,8BAA8B;IACpC,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACJ,WAAW,EAAE,+CAA+C;SAC7D;QACD,QAAQ,EAAE;YACR,iBAAiB,EAAE,IAAA,gCAAgB,EAAC;gBAClC,IAAI,EAAE,4BAAY,CAAC,QAAQ;gBAC3B,SAAS,EAAE,yBAAyB;gBACpC,GAAG,EAAE,SAAS;gBACd,WAAW,EAAE,8EAA8E;gBAC3F,QAAQ,EAAE,MAAM;gBAChB,GAAG,EAAE,8CAA8C;gBACnD,iBAAiB,EAAE,iDAAiD;aACrE,CAAC;SACH;QACD,MAAM,EAAE,EAAE;KACX;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,CAAC,OAAO;QACZ,SAAS,MAAM,CAAC,IAAmB;YACjC,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,mBAAmB,EAAE,CAAC,CAAC;QAC3D,CAAC;QAED,OAAO;YACL,cAAc,CAAC,IAA6B;gBAC1C,kEAAkE;gBAClE,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,kBAAkB;oBACvC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,KAAK,YAAY;oBAC1C,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;oBAEtE,+CAA+C;oBAC/C,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;oBACrC,IAAI,SAAS,CAAC,IAAI,KAAK,gBAAgB,EAAE,CAAC;wBACxC,MAAM,UAAU,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;wBAC1C,IAAI,UAAU,IAAI,UAAU,CAAC,IAAI,KAAK,kBAAkB,EAAE,CAAC;4BACzD,MAAM,aAAa,GAAG,UAAU,CAAC,UAAU,CAAC,IAAI,CAC9C,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,KAAK,YAAY,IAAI,CAAC,CAAC,GAAG,EAAE,IAAI,KAAK,QAAQ,CACrE,CAAC;4BACF,IAAI,CAAC,aAAa,EAAE,CAAC;gCACnB,MAAM,CAAC,IAAI,CAAC,CAAC;4BACf,CAAC;wBACH,CAAC;6BAAM,IAAI,CAAC,UAAU,EAAE,CAAC;4BACvB,mCAAmC;4BACnC,MAAM,CAAC,IAAI,CAAC,CAAC;wBACf,CAAC;oBACH,CAAC;gBACH,CAAC;gBAED,iCAAiC;gBACjC,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,YAAY,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;oBACvE,2CAA2C;oBAC3C,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC;wBAC3B,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,KAAK,YAAY,CAAC,EAAE,CAAC;wBAC/C,MAAM,CAAC,IAAI,CAAC,CAAC;oBACf,CAAC;gBACH,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Require timeout limits for network requests
|
|
3
|
+
* @see https://owasp.org/www-project-mobile-top-10/
|
|
4
|
+
* @see https://cwe.mitre.org/data/definitions/770.html
|
|
5
|
+
*/
|
|
6
|
+
export interface Options {
|
|
7
|
+
}
|
|
8
|
+
export declare const requireNetworkTimeout: ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview Require timeout limits for network requests
|
|
4
|
+
* @see https://owasp.org/www-project-mobile-top-10/
|
|
5
|
+
* @see https://cwe.mitre.org/data/definitions/770.html
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.requireNetworkTimeout = void 0;
|
|
9
|
+
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
10
|
+
exports.requireNetworkTimeout = (0, eslint_devkit_1.createRule)({
|
|
11
|
+
name: 'require-network-timeout',
|
|
12
|
+
meta: {
|
|
13
|
+
type: 'problem',
|
|
14
|
+
docs: {
|
|
15
|
+
description: 'Require timeout limits for network requests',
|
|
16
|
+
category: 'Security',
|
|
17
|
+
recommended: true,
|
|
18
|
+
owaspMobile: ['M5'],
|
|
19
|
+
cweIds: ["CWE-770"],
|
|
20
|
+
},
|
|
21
|
+
messages: {
|
|
22
|
+
violationDetected: (0, eslint_devkit_1.formatLLMMessage)({
|
|
23
|
+
icon: eslint_devkit_1.MessageIcons.SECURITY,
|
|
24
|
+
issueName: 'violation Detected',
|
|
25
|
+
cwe: 'CWE-400',
|
|
26
|
+
description: 'Require timeout limits for network requests detected - fetch/axios without timeout option',
|
|
27
|
+
severity: 'MEDIUM',
|
|
28
|
+
fix: 'Review and apply secure practices',
|
|
29
|
+
documentationLink: 'https://cwe.mitre.org/data/definitions/400.html',
|
|
30
|
+
})
|
|
31
|
+
},
|
|
32
|
+
schema: [],
|
|
33
|
+
},
|
|
34
|
+
defaultOptions: [],
|
|
35
|
+
create(context) {
|
|
36
|
+
return {
|
|
37
|
+
CallExpression(node) {
|
|
38
|
+
if (node.callee.name === 'fetch' ||
|
|
39
|
+
(node.callee.type === 'MemberExpression' &&
|
|
40
|
+
node.callee.object.name === 'axios')) {
|
|
41
|
+
const hasTimeout = node.arguments[1]?.type === 'ObjectExpression' &&
|
|
42
|
+
node.arguments[1].properties.some(p => p.key?.name === 'timeout');
|
|
43
|
+
if (!hasTimeout) {
|
|
44
|
+
context.report({ node, messageId: 'violationDetected' });
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/eslint-plugin-secure-coding/src/rules/require-network-timeout/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,4DAAsF;AAUzE,QAAA,qBAAqB,GAAG,IAAA,0BAAU,EAA0B;IACvE,IAAI,EAAE,yBAAyB;IAC/B,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACJ,WAAW,EAAE,6CAA6C;YAC1D,QAAQ,EAAE,UAAU;YACpB,WAAW,EAAE,IAAI;YACjB,WAAW,EAAE,CAAC,IAAI,CAAC;YACnB,MAAM,EAAE,CAAC,SAAS,CAAC;SACpB;QACD,QAAQ,EAAE;YACR,iBAAiB,EAAE,IAAA,gCAAgB,EAAC;gBAClC,IAAI,EAAE,4BAAY,CAAC,QAAQ;gBAC3B,SAAS,EAAE,oBAAoB;gBAC/B,GAAG,EAAE,SAAS;gBACd,WAAW,EAAE,2FAA2F;gBACxG,QAAQ,EAAE,QAAQ;gBAClB,GAAG,EAAE,mCAAmC;gBACxC,iBAAiB,EAAE,iDAAiD;aACrE,CAAC;SACH;QACD,MAAM,EAAE,EAAE;KACX;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,CAAC,OAAO;QACZ,OAAO;YAEL,cAAc,CAAC,IAA6B;gBAC1C,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,OAAO;oBAC5B,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,kBAAkB;wBACvC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,OAAO,CAAC,EAAE,CAAC;oBAC1C,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,KAAK,kBAAkB;wBAC/D,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,KAAK,SAAS,CAAC,CAAC;oBACpE,IAAI,CAAC,UAAU,EAAE,CAAC;wBAChB,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,mBAAmB,EAAE,CAAC,CAAC;oBAC3D,CAAC;gBACH,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Ensure package lock file exists
|
|
3
|
+
* @see https://owasp.org/www-project-mobile-top-10/
|
|
4
|
+
* @see https://cwe.mitre.org/data/definitions/829.html
|
|
5
|
+
*/
|
|
6
|
+
export interface Options {
|
|
7
|
+
}
|
|
8
|
+
export declare const requirePackageLock: ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview Ensure package lock file exists
|
|
4
|
+
* @see https://owasp.org/www-project-mobile-top-10/
|
|
5
|
+
* @see https://cwe.mitre.org/data/definitions/829.html
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.requirePackageLock = void 0;
|
|
9
|
+
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
10
|
+
exports.requirePackageLock = (0, eslint_devkit_1.createRule)({
|
|
11
|
+
name: 'require-package-lock',
|
|
12
|
+
meta: {
|
|
13
|
+
type: 'suggestion',
|
|
14
|
+
docs: {
|
|
15
|
+
description: 'Ensure package-lock.json or yarn.lock exists',
|
|
16
|
+
category: 'Security',
|
|
17
|
+
recommended: true,
|
|
18
|
+
owaspMobile: ['M2'],
|
|
19
|
+
cweIds: ['CWE-829'],
|
|
20
|
+
},
|
|
21
|
+
messages: {
|
|
22
|
+
violationDetected: (0, eslint_devkit_1.formatLLMMessage)({
|
|
23
|
+
icon: eslint_devkit_1.MessageIcons.SECURITY,
|
|
24
|
+
issueName: 'violation Detected',
|
|
25
|
+
cwe: 'CWE-829',
|
|
26
|
+
description: 'Package lock file missing - commit package-lock',
|
|
27
|
+
severity: 'HIGH',
|
|
28
|
+
fix: 'Review and apply secure practices',
|
|
29
|
+
documentationLink: 'https://cwe.mitre.org/data/definitions/829.html',
|
|
30
|
+
})
|
|
31
|
+
},
|
|
32
|
+
schema: [],
|
|
33
|
+
},
|
|
34
|
+
defaultOptions: [],
|
|
35
|
+
create(context) {
|
|
36
|
+
const fs = require('node:fs');
|
|
37
|
+
const path = require('node:path');
|
|
38
|
+
// Check once per file
|
|
39
|
+
let checked = false;
|
|
40
|
+
return {
|
|
41
|
+
Program(node) {
|
|
42
|
+
if (checked)
|
|
43
|
+
return;
|
|
44
|
+
checked = true;
|
|
45
|
+
// Find project root (simplified)
|
|
46
|
+
let dir = path.dirname(context.filename);
|
|
47
|
+
let found = false;
|
|
48
|
+
for (let i = 0; i < 10; i++) {
|
|
49
|
+
if (fs.existsSync(path.join(dir, 'package-lock.json')) ||
|
|
50
|
+
fs.existsSync(path.join(dir, 'yarn.lock')) ||
|
|
51
|
+
fs.existsSync(path.join(dir, 'pnpm-lock.yaml'))) {
|
|
52
|
+
found = true;
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
dir = path.dirname(dir);
|
|
56
|
+
}
|
|
57
|
+
if (!found) {
|
|
58
|
+
context.report({ node, messageId: 'violationDetected' });
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/eslint-plugin-secure-coding/src/rules/require-package-lock/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,4DAAsF;AAUzE,QAAA,kBAAkB,GAAG,IAAA,0BAAU,EAA0B;IACpE,IAAI,EAAE,sBAAsB;IAC5B,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE;YACJ,WAAW,EAAE,8CAA8C;YAC3D,QAAQ,EAAE,UAAU;YACpB,WAAW,EAAE,IAAI;YACjB,WAAW,EAAE,CAAC,IAAI,CAAC;YACnB,MAAM,EAAE,CAAC,SAAS,CAAC;SACpB;QACD,QAAQ,EAAE;YACR,iBAAiB,EAAE,IAAA,gCAAgB,EAAC;gBAClC,IAAI,EAAE,4BAAY,CAAC,QAAQ;gBAC3B,SAAS,EAAE,oBAAoB;gBAC/B,GAAG,EAAE,SAAS;gBACd,WAAW,EAAE,iDAAiD;gBAC9D,QAAQ,EAAE,MAAM;gBAChB,GAAG,EAAE,mCAAmC;gBACxC,iBAAiB,EAAE,iDAAiD;aACrE,CAAC;SACH;QACD,MAAM,EAAE,EAAE;KACX;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,CAAC,OAAO;QACZ,MAAM,EAAE,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;QAC9B,MAAM,IAAI,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;QAElC,sBAAsB;QACtB,IAAI,OAAO,GAAG,KAAK,CAAC;QAEpB,OAAO;YACL,OAAO,CAAC,IAAsB;gBAC5B,IAAI,OAAO;oBAAE,OAAO;gBACpB,OAAO,GAAG,IAAI,CAAC;gBAEf,iCAAiC;gBACjC,IAAI,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;gBACzC,IAAI,KAAK,GAAG,KAAK,CAAC;gBAElB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;oBAC5B,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,mBAAmB,CAAC,CAAC;wBAClD,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;wBAC1C,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC,EAAE,CAAC;wBACpD,KAAK,GAAG,IAAI,CAAC;wBACb,MAAM;oBACR,CAAC;oBACD,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;gBAC1B,CAAC;gBAED,IAAI,CAAC,KAAK,EAAE,CAAC;oBACX,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,mBAAmB,EAAE,CAAC,CAAC;gBAC3D,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Enforce secure storage patterns for credentials
|
|
3
|
+
* @see https://owasp.org/www-project-mobile-top-10/
|
|
4
|
+
* @see https://cwe.mitre.org/data/definitions/522.html
|
|
5
|
+
*/
|
|
6
|
+
export interface Options {
|
|
7
|
+
}
|
|
8
|
+
export declare const requireSecureCredentialStorage: ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview Enforce secure storage patterns for credentials
|
|
4
|
+
* @see https://owasp.org/www-project-mobile-top-10/
|
|
5
|
+
* @see https://cwe.mitre.org/data/definitions/522.html
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.requireSecureCredentialStorage = void 0;
|
|
9
|
+
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
10
|
+
exports.requireSecureCredentialStorage = (0, eslint_devkit_1.createRule)({
|
|
11
|
+
name: 'require-secure-credential-storage',
|
|
12
|
+
meta: {
|
|
13
|
+
type: 'problem',
|
|
14
|
+
docs: {
|
|
15
|
+
description: 'Enforce secure storage patterns for credentials',
|
|
16
|
+
category: 'Security',
|
|
17
|
+
recommended: true,
|
|
18
|
+
owaspMobile: ['M1'],
|
|
19
|
+
cweIds: ["CWE-522"],
|
|
20
|
+
},
|
|
21
|
+
messages: {
|
|
22
|
+
violationDetected: (0, eslint_devkit_1.formatLLMMessage)({
|
|
23
|
+
icon: eslint_devkit_1.MessageIcons.SECURITY,
|
|
24
|
+
issueName: 'violation Detected',
|
|
25
|
+
cwe: 'CWE-312',
|
|
26
|
+
description: 'Enforce secure storage patterns for credentials detected - Credentials without encryption',
|
|
27
|
+
severity: 'HIGH',
|
|
28
|
+
fix: 'Review and apply secure practices',
|
|
29
|
+
documentationLink: 'https://cwe.mitre.org/data/definitions/312.html',
|
|
30
|
+
})
|
|
31
|
+
},
|
|
32
|
+
schema: [],
|
|
33
|
+
},
|
|
34
|
+
defaultOptions: [],
|
|
35
|
+
create(context) {
|
|
36
|
+
return {
|
|
37
|
+
CallExpression(node) {
|
|
38
|
+
if (node.callee.type === 'MemberExpression' &&
|
|
39
|
+
['setItem', 'writeFile'].includes(node.callee.property.name)) {
|
|
40
|
+
// Check for encryption wrapper
|
|
41
|
+
const hasEncryption = node.arguments.some(arg => arg.type === 'CallExpression' &&
|
|
42
|
+
arg.callee.name?.includes('encrypt'));
|
|
43
|
+
if (!hasEncryption) {
|
|
44
|
+
context.report({ node, messageId: 'violationDetected' });
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/eslint-plugin-secure-coding/src/rules/require-secure-credential-storage/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,4DAAsF;AAUzE,QAAA,8BAA8B,GAAG,IAAA,0BAAU,EAA0B;IAChF,IAAI,EAAE,mCAAmC;IACzC,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACJ,WAAW,EAAE,iDAAiD;YAC9D,QAAQ,EAAE,UAAU;YACpB,WAAW,EAAE,IAAI;YACjB,WAAW,EAAE,CAAC,IAAI,CAAC;YACnB,MAAM,EAAE,CAAC,SAAS,CAAC;SACpB;QACD,QAAQ,EAAE;YACR,iBAAiB,EAAE,IAAA,gCAAgB,EAAC;gBAClC,IAAI,EAAE,4BAAY,CAAC,QAAQ;gBAC3B,SAAS,EAAE,oBAAoB;gBAC/B,GAAG,EAAE,SAAS;gBACd,WAAW,EAAE,2FAA2F;gBACxG,QAAQ,EAAE,MAAM;gBAChB,GAAG,EAAE,mCAAmC;gBACxC,iBAAiB,EAAE,iDAAiD;aACrE,CAAC;SACH;QACD,MAAM,EAAE,EAAE;KACX;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,CAAC,OAAO;QACZ,OAAO;YAEL,cAAc,CAAC,IAA6B;gBAC1C,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,kBAAkB;oBACvC,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;oBACjE,+BAA+B;oBAC/B,MAAM,aAAa,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAC9C,GAAG,CAAC,IAAI,KAAK,gBAAgB;wBAC7B,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,SAAS,CAAC,CACrC,CAAC;oBACF,IAAI,CAAC,aAAa,EAAE,CAAC;wBACnB,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,mBAAmB,EAAE,CAAC,CAAC;oBAC3D,CAAC;gBACH,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Ensure secure default configurations
|
|
3
|
+
* @see https://owasp.org/www-project-mobile-top-10/
|
|
4
|
+
* @see https://cwe.mitre.org/data/definitions/453.html
|
|
5
|
+
*/
|
|
6
|
+
export interface Options {
|
|
7
|
+
}
|
|
8
|
+
export declare const requireSecureDefaults: ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview Ensure secure default configurations
|
|
4
|
+
* @see https://owasp.org/www-project-mobile-top-10/
|
|
5
|
+
* @see https://cwe.mitre.org/data/definitions/453.html
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.requireSecureDefaults = void 0;
|
|
9
|
+
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
10
|
+
exports.requireSecureDefaults = (0, eslint_devkit_1.createRule)({
|
|
11
|
+
name: 'require-secure-defaults',
|
|
12
|
+
meta: {
|
|
13
|
+
type: 'problem',
|
|
14
|
+
docs: {
|
|
15
|
+
description: 'Ensure secure default configurations',
|
|
16
|
+
category: 'Security',
|
|
17
|
+
recommended: true,
|
|
18
|
+
owaspMobile: ['M8'],
|
|
19
|
+
cweIds: ["CWE-453"],
|
|
20
|
+
},
|
|
21
|
+
messages: {
|
|
22
|
+
violationDetected: (0, eslint_devkit_1.formatLLMMessage)({
|
|
23
|
+
icon: eslint_devkit_1.MessageIcons.SECURITY,
|
|
24
|
+
issueName: 'violation Detected',
|
|
25
|
+
cwe: 'CWE-1188',
|
|
26
|
+
description: 'Ensure secure default configurations detected - Insecure default values',
|
|
27
|
+
severity: 'MEDIUM',
|
|
28
|
+
fix: 'Review and apply secure practices',
|
|
29
|
+
documentationLink: 'https://cwe.mitre.org/data/definitions/1188.html',
|
|
30
|
+
})
|
|
31
|
+
},
|
|
32
|
+
schema: [],
|
|
33
|
+
},
|
|
34
|
+
defaultOptions: [],
|
|
35
|
+
create(context) {
|
|
36
|
+
return {
|
|
37
|
+
Property(node) {
|
|
38
|
+
if (node.key.type === 'Identifier' &&
|
|
39
|
+
['secure', 'strictSSL', 'verify'].includes(node.key.name) &&
|
|
40
|
+
node.value.type === 'Literal' &&
|
|
41
|
+
node.value.value === false) {
|
|
42
|
+
context.report({ node, messageId: 'violationDetected' });
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/eslint-plugin-secure-coding/src/rules/require-secure-defaults/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,4DAAsF;AAUzE,QAAA,qBAAqB,GAAG,IAAA,0BAAU,EAA0B;IACvE,IAAI,EAAE,yBAAyB;IAC/B,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACJ,WAAW,EAAE,sCAAsC;YACnD,QAAQ,EAAE,UAAU;YACpB,WAAW,EAAE,IAAI;YACjB,WAAW,EAAE,CAAC,IAAI,CAAC;YACnB,MAAM,EAAE,CAAC,SAAS,CAAC;SACpB;QACD,QAAQ,EAAE;YACR,iBAAiB,EAAE,IAAA,gCAAgB,EAAC;gBAClC,IAAI,EAAE,4BAAY,CAAC,QAAQ;gBAC3B,SAAS,EAAE,oBAAoB;gBAC/B,GAAG,EAAE,UAAU;gBACf,WAAW,EAAE,yEAAyE;gBACtF,QAAQ,EAAE,QAAQ;gBAClB,GAAG,EAAE,mCAAmC;gBACxC,iBAAiB,EAAE,kDAAkD;aACtE,CAAC;SACH;QACD,MAAM,EAAE,EAAE;KACX;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,CAAC,OAAO;QACZ,OAAO;YACL,QAAQ,CAAC,IAAuB;gBAC9B,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,KAAK,YAAY;oBAC9B,CAAC,QAAQ,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC;oBACzD,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS;oBAC7B,IAAI,CAAC,KAAK,CAAC,KAAK,KAAK,KAAK,EAAE,CAAC;oBAC/B,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,mBAAmB,EAAE,CAAC,CAAC;gBAC3D,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Require secure data deletion patterns
|
|
3
|
+
* @see https://owasp.org/www-project-mobile-top-10/
|
|
4
|
+
* @see https://cwe.mitre.org/data/definitions/459.html
|
|
5
|
+
*/
|
|
6
|
+
export interface Options {
|
|
7
|
+
}
|
|
8
|
+
export declare const requireSecureDeletion: ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview Require secure data deletion patterns
|
|
4
|
+
* @see https://owasp.org/www-project-mobile-top-10/
|
|
5
|
+
* @see https://cwe.mitre.org/data/definitions/459.html
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.requireSecureDeletion = void 0;
|
|
9
|
+
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
10
|
+
exports.requireSecureDeletion = (0, eslint_devkit_1.createRule)({
|
|
11
|
+
name: 'require-secure-deletion',
|
|
12
|
+
meta: {
|
|
13
|
+
type: 'problem',
|
|
14
|
+
docs: {
|
|
15
|
+
description: 'Require secure data deletion patterns',
|
|
16
|
+
category: 'Security',
|
|
17
|
+
recommended: true,
|
|
18
|
+
owaspMobile: ['M9'],
|
|
19
|
+
cweIds: ["CWE-459"],
|
|
20
|
+
},
|
|
21
|
+
messages: {
|
|
22
|
+
violationDetected: (0, eslint_devkit_1.formatLLMMessage)({
|
|
23
|
+
icon: eslint_devkit_1.MessageIcons.SECURITY,
|
|
24
|
+
issueName: 'violation Detected',
|
|
25
|
+
cwe: 'CWE-459',
|
|
26
|
+
description: 'Require secure data deletion patterns detected - delete without secure wipe',
|
|
27
|
+
severity: 'MEDIUM',
|
|
28
|
+
fix: 'Review and apply secure practices',
|
|
29
|
+
documentationLink: 'https://cwe.mitre.org/data/definitions/459.html',
|
|
30
|
+
})
|
|
31
|
+
},
|
|
32
|
+
schema: [],
|
|
33
|
+
},
|
|
34
|
+
defaultOptions: [],
|
|
35
|
+
create(context) {
|
|
36
|
+
return {
|
|
37
|
+
UnaryExpression(node) {
|
|
38
|
+
if (node.operator === 'delete') {
|
|
39
|
+
context.report({ node, messageId: 'violationDetected' });
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/eslint-plugin-secure-coding/src/rules/require-secure-deletion/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,4DAAsF;AAUzE,QAAA,qBAAqB,GAAG,IAAA,0BAAU,EAA0B;IACvE,IAAI,EAAE,yBAAyB;IAC/B,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACJ,WAAW,EAAE,uCAAuC;YACpD,QAAQ,EAAE,UAAU;YACpB,WAAW,EAAE,IAAI;YACjB,WAAW,EAAE,CAAC,IAAI,CAAC;YACnB,MAAM,EAAE,CAAC,SAAS,CAAC;SACpB;QACD,QAAQ,EAAE;YACR,iBAAiB,EAAE,IAAA,gCAAgB,EAAC;gBAClC,IAAI,EAAE,4BAAY,CAAC,QAAQ;gBAC3B,SAAS,EAAE,oBAAoB;gBAC/B,GAAG,EAAE,SAAS;gBACd,WAAW,EAAE,6EAA6E;gBAC1F,QAAQ,EAAE,QAAQ;gBAClB,GAAG,EAAE,mCAAmC;gBACxC,iBAAiB,EAAE,iDAAiD;aACrE,CAAC;SACH;QACD,MAAM,EAAE,EAAE;KACX;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,CAAC,OAAO;QACZ,OAAO;YAEL,eAAe,CAAC,IAA8B;gBAC5C,IAAI,IAAI,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;oBAC/B,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,mBAAmB,EAAE,CAAC,CAAC;gBAC3D,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|