@sun-asterisk/sunlint 1.3.39 → 1.3.41
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/config/rules/rules-registry-generated.json +134 -108
- package/core/rule-selection-service.js +11 -0
- package/docs/GENERATED_FILES_QUICK_REFERENCE.md +96 -0
- package/docs/GENERATED_FILE_HANDLING_SUMMARY.md +152 -0
- package/docs/skills/CREATE_NEW_DART_RULE.md +161 -14
- package/origin-rules/dart-en.md +151 -163
- package/package.json +2 -1
- package/rules/dart/D002_dispose_resources/config.json +25 -0
- package/rules/dart/D003_prefer_widgets_over_methods/config.json +14 -0
- package/rules/dart/D004_avoid_shrinkwrap_listview/config.json +13 -0
- package/rules/dart/D005_limit_widget_nesting/config.json +13 -0
- package/rules/dart/D006_prefer_extracting_large_callbacks/config.json +25 -0
- package/rules/dart/D007_prefer_init_first_dispose_last/config.json +10 -0
- package/rules/dart/D008_avoid_long_functions/config.json +12 -0
- package/rules/dart/D009_limit_function_parameters/config.json +13 -0
- package/rules/dart/D010_limit_cyclomatic_complexity/config.json +12 -0
- package/rules/dart/D011_prefer_named_parameters/config.json +12 -0
- package/rules/dart/D012_prefer_named_boolean_parameters/config.json +9 -0
- package/rules/dart/D013_single_public_class/config.json +10 -0
- package/rules/dart/D014_unsafe_collection_access/config.json +10 -0
- package/rules/dart/D015_copywith_all_parameters/config.json +9 -0
- package/rules/dart/D016_project_should_have_tests/config.json +24 -0
- package/rules/dart/D017_pubspec_dependencies_review/config.json +23 -0
- package/rules/dart/D018_remove_commented_code/config.json +13 -0
- package/rules/dart/D019_avoid_single_child_multi_child_widget/config.json +21 -0
- package/rules/dart/D020_limit_if_else_branches/config.json +12 -0
- package/rules/dart/D021_avoid_negated_boolean_checks/config.json +14 -0
- package/rules/dart/D022_use_setstate_correctly/config.json +14 -0
- package/rules/dart/D023_avoid_unnecessary_method_overrides/config.json +13 -0
- package/rules/dart/D024_avoid_unnecessary_stateful_widget/config.json +9 -0
- package/rules/dart/D025_avoid_nested_conditional_expressions/config.json +9 -0
- package/skill-assets/sunlint-code-quality/AGENTS.md +80 -0
- package/skill-assets/sunlint-code-quality/SKILL.md +176 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/C006-verb-noun-functions.md +36 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/C013-no-dead-code.md +38 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/C014-dependency-injection.md +45 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/C017-no-constructor-logic.md +46 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/C018-generic-errors.md +38 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/C019-error-log-level.md +29 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/C020-no-unused-imports.md +30 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/C022-no-unused-variables.md +33 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/C023-no-duplicate-names.md +36 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/C024-centralize-constants.md +33 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/C029-catch-log-root-cause.md +40 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/C030-custom-error-classes.md +38 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/C033-separate-data-access.md +53 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/C035-error-context-logging.md +31 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/C041-no-hardcoded-secrets.md +25 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/C042-boolean-naming.md +27 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/C052-controller-parsing.md +41 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/C060-superclass-logic.md +33 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/C067-no-hardcoded-config.md +24 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S003-open-redirect.md +47 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S004-no-log-credentials.md +28 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S005-server-authorization.md +51 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S006-default-credentials.md +42 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S007-output-encoding.md +36 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S009-approved-crypto.md +37 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S010-csprng.md +32 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S011-encrypted-client-hello.md +36 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S012-secrets-management.md +35 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S013-tls-connections.md +36 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S016-no-sensitive-query-string.md +39 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S017-parameterized-queries.md +47 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S019-email-input-sanitization.md +35 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S020-eval-code-execution.md +56 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S022-context-escaping.md +50 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S023-dynamic-js-encoding.md +34 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S025-server-validation.md +56 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S026-tls-encryption.md +28 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S027-mtls-validation.md +40 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S028-upload-limits.md +50 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S029-csrf-protection.md +42 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S030-directory-browsing.md +26 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S031-secure-cookie-flag.md +35 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S032-httponly-cookie.md +31 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S033-samesite-cookie.md +36 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S034-host-prefix-cookie.md +31 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S035-app-hostnames.md +26 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S036-internal-file-paths.md +36 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S037-anti-cache-headers.md +33 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S039-tls-certificate-validation.md +41 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S041-logout-invalidation.md +36 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S042-long-lived-sessions.md +47 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S044-critical-changes-reauth.md +45 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S045-brute-force-protection.md +48 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S047-oauth-csrf-protection.md +53 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S048-oauth-redirect-validation.md +37 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S049-auth-code-expiry.md +33 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S050-token-entropy.md +33 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S051-password-length.md +35 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S052-otp-entropy.md +26 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S053-generic-error-messages.md +32 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S054-no-default-admin.md +31 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S055-content-type-validation.md +44 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S056-log-injection.md +33 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S057-synchronized-time.md +27 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S058-ssrf-protection.md +54 -0
- package/skill-assets/sunlint-code-quality/rules/go/C006-verb-noun-functions.md +45 -0
- package/skill-assets/sunlint-code-quality/rules/go/C013-no-dead-code.md +48 -0
- package/skill-assets/sunlint-code-quality/rules/go/C014-dependency-injection.md +85 -0
- package/skill-assets/sunlint-code-quality/rules/go/C017-no-constructor-logic.md +67 -0
- package/skill-assets/sunlint-code-quality/rules/go/C018-generic-errors.md +63 -0
- package/skill-assets/sunlint-code-quality/rules/go/C019-error-log-level.md +50 -0
- package/skill-assets/sunlint-code-quality/rules/go/C020-no-unused-imports.md +45 -0
- package/skill-assets/sunlint-code-quality/rules/go/C022-no-unused-variables.md +34 -0
- package/skill-assets/sunlint-code-quality/rules/go/C023-no-duplicate-names.md +41 -0
- package/skill-assets/sunlint-code-quality/rules/go/C024-centralize-constants.md +55 -0
- package/skill-assets/sunlint-code-quality/rules/go/C029-catch-log-root-cause.md +56 -0
- package/skill-assets/sunlint-code-quality/rules/go/C030-custom-error-classes.md +69 -0
- package/skill-assets/sunlint-code-quality/rules/go/C033-separate-data-access.md +68 -0
- package/skill-assets/sunlint-code-quality/rules/go/C035-error-context-logging.md +48 -0
- package/skill-assets/sunlint-code-quality/rules/go/C041-no-hardcoded-secrets.md +45 -0
- package/skill-assets/sunlint-code-quality/rules/go/C042-boolean-naming.md +42 -0
- package/skill-assets/sunlint-code-quality/rules/go/C052-controller-parsing.md +62 -0
- package/skill-assets/sunlint-code-quality/rules/go/C060-superclass-logic.md +60 -0
- package/skill-assets/sunlint-code-quality/rules/go/C067-no-hardcoded-config.md +51 -0
- package/skill-assets/sunlint-code-quality/rules/go/S003-open-redirect.md +80 -0
- package/skill-assets/sunlint-code-quality/rules/go/S004-no-log-credentials.md +66 -0
- package/skill-assets/sunlint-code-quality/rules/go/S005-server-authorization.md +55 -0
- package/skill-assets/sunlint-code-quality/rules/go/S006-default-credentials.md +47 -0
- package/skill-assets/sunlint-code-quality/rules/go/S007-output-encoding.md +50 -0
- package/skill-assets/sunlint-code-quality/rules/go/S009-approved-crypto.md +63 -0
- package/skill-assets/sunlint-code-quality/rules/go/S010-csprng.md +53 -0
- package/skill-assets/sunlint-code-quality/rules/go/S011-encrypted-client-hello.md +34 -0
- package/skill-assets/sunlint-code-quality/rules/go/S012-secrets-management.md +49 -0
- package/skill-assets/sunlint-code-quality/rules/go/S013-tls-connections.md +61 -0
- package/skill-assets/sunlint-code-quality/rules/go/S016-no-sensitive-query-string.md +42 -0
- package/skill-assets/sunlint-code-quality/rules/go/S017-parameterized-queries.md +36 -0
- package/skill-assets/sunlint-code-quality/rules/go/S019-email-input-sanitization.md +44 -0
- package/skill-assets/sunlint-code-quality/rules/go/S020-eval-code-execution.md +47 -0
- package/skill-assets/sunlint-code-quality/rules/go/S022-context-escaping.md +49 -0
- package/skill-assets/sunlint-code-quality/rules/go/S023-dynamic-js-encoding.md +51 -0
- package/skill-assets/sunlint-code-quality/rules/go/S025-server-validation.md +57 -0
- package/skill-assets/sunlint-code-quality/rules/go/S026-tls-encryption.md +46 -0
- package/skill-assets/sunlint-code-quality/rules/go/S027-mtls-validation.md +52 -0
- package/skill-assets/sunlint-code-quality/rules/go/S028-upload-limits.md +58 -0
- package/skill-assets/sunlint-code-quality/rules/go/S029-csrf-protection.md +53 -0
- package/skill-assets/sunlint-code-quality/rules/go/S030-directory-browsing.md +53 -0
- package/skill-assets/sunlint-code-quality/rules/go/S031-secure-cookie-flag.md +48 -0
- package/skill-assets/sunlint-code-quality/rules/go/S032-httponly-cookie.md +42 -0
- package/skill-assets/sunlint-code-quality/rules/go/S033-samesite-cookie.md +49 -0
- package/skill-assets/sunlint-code-quality/rules/go/S034-host-prefix-cookie.md +44 -0
- package/skill-assets/sunlint-code-quality/rules/go/S035-app-hostnames.md +50 -0
- package/skill-assets/sunlint-code-quality/rules/go/S036-internal-file-paths.md +56 -0
- package/skill-assets/sunlint-code-quality/rules/go/S037-anti-cache-headers.md +43 -0
- package/skill-assets/sunlint-code-quality/rules/go/S039-tls-certificate-validation.md +41 -0
- package/skill-assets/sunlint-code-quality/rules/go/S041-logout-invalidation.md +46 -0
- package/skill-assets/sunlint-code-quality/rules/go/S042-long-lived-sessions.md +58 -0
- package/skill-assets/sunlint-code-quality/rules/go/S044-critical-changes-reauth.md +53 -0
- package/skill-assets/sunlint-code-quality/rules/go/S045-brute-force-protection.md +55 -0
- package/skill-assets/sunlint-code-quality/rules/go/S047-oauth-csrf-protection.md +51 -0
- package/skill-assets/sunlint-code-quality/rules/go/S048-oauth-redirect-validation.md +58 -0
- package/skill-assets/sunlint-code-quality/rules/go/S049-auth-code-expiry.md +52 -0
- package/skill-assets/sunlint-code-quality/rules/go/S050-token-entropy.md +53 -0
- package/skill-assets/sunlint-code-quality/rules/go/S051-password-length.md +49 -0
- package/skill-assets/sunlint-code-quality/rules/go/S052-otp-entropy.md +48 -0
- package/skill-assets/sunlint-code-quality/rules/go/S053-generic-error-messages.md +51 -0
- package/skill-assets/sunlint-code-quality/rules/go/S054-no-default-admin.md +43 -0
- package/skill-assets/sunlint-code-quality/rules/go/S055-content-type-validation.md +52 -0
- package/skill-assets/sunlint-code-quality/rules/go/S056-log-injection.md +40 -0
- package/skill-assets/sunlint-code-quality/rules/go/S057-synchronized-time.md +40 -0
- package/skill-assets/sunlint-code-quality/rules/go/S058-ssrf-protection.md +70 -0
- package/skill-assets/sunlint-code-quality/rules/java/C006-verb-noun-functions.md +36 -0
- package/skill-assets/sunlint-code-quality/rules/java/C013-no-dead-code.md +175 -0
- package/skill-assets/sunlint-code-quality/rules/java/C014-dependency-injection.md +42 -0
- package/skill-assets/sunlint-code-quality/rules/java/C017-no-constructor-logic.md +39 -0
- package/skill-assets/sunlint-code-quality/rules/java/C018-generic-errors.md +28 -0
- package/skill-assets/sunlint-code-quality/rules/java/C019-error-log-level.md +34 -0
- package/skill-assets/sunlint-code-quality/rules/java/C020-no-unused-imports.md +34 -0
- package/skill-assets/sunlint-code-quality/rules/java/C022-no-unused-variables.md +31 -0
- package/skill-assets/sunlint-code-quality/rules/java/C023-no-duplicate-names.md +37 -0
- package/skill-assets/sunlint-code-quality/rules/java/C024-centralize-constants.md +36 -0
- package/skill-assets/sunlint-code-quality/rules/java/C029-catch-log-root-cause.md +42 -0
- package/skill-assets/sunlint-code-quality/rules/java/C030-custom-error-classes.md +50 -0
- package/skill-assets/sunlint-code-quality/rules/java/C033-separate-data-access.md +46 -0
- package/skill-assets/sunlint-code-quality/rules/java/C035-error-context-logging.md +38 -0
- package/skill-assets/sunlint-code-quality/rules/java/C041-no-hardcoded-secrets.md +34 -0
- package/skill-assets/sunlint-code-quality/rules/java/C042-boolean-naming.md +27 -0
- package/skill-assets/sunlint-code-quality/rules/java/C052-controller-parsing.md +39 -0
- package/skill-assets/sunlint-code-quality/rules/java/C060-superclass-logic.md +32 -0
- package/skill-assets/sunlint-code-quality/rules/java/C067-no-hardcoded-config.md +31 -0
- package/skill-assets/sunlint-code-quality/rules/java/S003-open-redirect.md +38 -0
- package/skill-assets/sunlint-code-quality/rules/java/S004-no-log-credentials.md +36 -0
- package/skill-assets/sunlint-code-quality/rules/java/S005-server-authorization.md +53 -0
- package/skill-assets/sunlint-code-quality/rules/java/S006-default-credentials.md +39 -0
- package/skill-assets/sunlint-code-quality/rules/java/S007-output-encoding.md +49 -0
- package/skill-assets/sunlint-code-quality/rules/java/S009-approved-crypto.md +40 -0
- package/skill-assets/sunlint-code-quality/rules/java/S010-csprng.md +36 -0
- package/skill-assets/sunlint-code-quality/rules/java/S011-encrypted-client-hello.md +27 -0
- package/skill-assets/sunlint-code-quality/rules/java/S012-secrets-management.md +34 -0
- package/skill-assets/sunlint-code-quality/rules/java/S013-tls-connections.md +40 -0
- package/skill-assets/sunlint-code-quality/rules/java/S016-no-sensitive-query-string.md +36 -0
- package/skill-assets/sunlint-code-quality/rules/java/S017-parameterized-queries.md +47 -0
- package/skill-assets/sunlint-code-quality/rules/java/S019-email-input-sanitization.md +32 -0
- package/skill-assets/sunlint-code-quality/rules/java/S020-eval-code-execution.md +45 -0
- package/skill-assets/sunlint-code-quality/rules/java/S022-context-escaping.md +28 -0
- package/skill-assets/sunlint-code-quality/rules/java/S023-dynamic-js-encoding.md +28 -0
- package/skill-assets/sunlint-code-quality/rules/java/S025-server-validation.md +58 -0
- package/skill-assets/sunlint-code-quality/rules/java/S026-tls-encryption.md +57 -0
- package/skill-assets/sunlint-code-quality/rules/java/S027-mtls-validation.md +26 -0
- package/skill-assets/sunlint-code-quality/rules/java/S028-upload-limits.md +35 -0
- package/skill-assets/sunlint-code-quality/rules/java/S029-csrf-protection.md +35 -0
- package/skill-assets/sunlint-code-quality/rules/java/S030-directory-browsing.md +38 -0
- package/skill-assets/sunlint-code-quality/rules/java/S031-secure-cookie-flag.md +38 -0
- package/skill-assets/sunlint-code-quality/rules/java/S032-httponly-cookie.md +31 -0
- package/skill-assets/sunlint-code-quality/rules/java/S033-samesite-cookie.md +42 -0
- package/skill-assets/sunlint-code-quality/rules/java/S034-host-prefix-cookie.md +35 -0
- package/skill-assets/sunlint-code-quality/rules/java/S035-app-hostnames.md +23 -0
- package/skill-assets/sunlint-code-quality/rules/java/S036-internal-file-paths.md +39 -0
- package/skill-assets/sunlint-code-quality/rules/java/S037-anti-cache-headers.md +37 -0
- package/skill-assets/sunlint-code-quality/rules/java/S039-tls-certificate-validation.md +43 -0
- package/skill-assets/sunlint-code-quality/rules/java/S041-logout-invalidation.md +53 -0
- package/skill-assets/sunlint-code-quality/rules/java/S042-long-lived-sessions.md +36 -0
- package/skill-assets/sunlint-code-quality/rules/java/S044-critical-changes-reauth.md +28 -0
- package/skill-assets/sunlint-code-quality/rules/java/S045-brute-force-protection.md +38 -0
- package/skill-assets/sunlint-code-quality/rules/java/S047-oauth-csrf-protection.md +33 -0
- package/skill-assets/sunlint-code-quality/rules/java/S048-oauth-redirect-validation.md +25 -0
- package/skill-assets/sunlint-code-quality/rules/java/S049-auth-code-expiry.md +23 -0
- package/skill-assets/sunlint-code-quality/rules/java/S050-token-entropy.md +20 -0
- package/skill-assets/sunlint-code-quality/rules/java/S051-password-length.md +20 -0
- package/skill-assets/sunlint-code-quality/rules/java/S052-otp-entropy.md +23 -0
- package/skill-assets/sunlint-code-quality/rules/java/S053-generic-error-messages.md +21 -0
- package/skill-assets/sunlint-code-quality/rules/java/S054-no-default-admin.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/java/S055-content-type-validation.md +36 -0
- package/skill-assets/sunlint-code-quality/rules/java/S056-log-injection.md +38 -0
- package/skill-assets/sunlint-code-quality/rules/java/S057-synchronized-time.md +35 -0
- package/skill-assets/sunlint-code-quality/rules/java/S058-ssrf-protection.md +56 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/C006-verb-noun-functions.md +45 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/C013-no-dead-code.md +49 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/C014-dependency-injection.md +64 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/C017-no-constructor-logic.md +68 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/C018-generic-errors.md +46 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/C019-error-log-level.md +50 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/C020-no-unused-imports.md +44 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/C022-no-unused-variables.md +39 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/C023-no-duplicate-names.md +47 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/C024-centralize-constants.md +58 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/C029-catch-log-root-cause.md +50 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/C030-custom-error-classes.md +72 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/C033-separate-data-access.md +69 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/C035-error-context-logging.md +47 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/C041-no-hardcoded-secrets.md +47 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/C042-boolean-naming.md +42 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/C052-controller-parsing.md +71 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/C060-superclass-logic.md +60 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/C067-no-hardcoded-config.md +51 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S003-open-redirect.md +66 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S004-no-log-credentials.md +59 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S005-server-authorization.md +75 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S006-default-credentials.md +49 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S007-output-encoding.md +62 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S009-approved-crypto.md +51 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S010-csprng.md +61 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S011-encrypted-client-hello.md +48 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S012-secrets-management.md +53 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S013-tls-connections.md +61 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S016-no-sensitive-query-string.md +51 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S017-parameterized-queries.md +41 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S019-email-input-sanitization.md +50 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S020-eval-code-execution.md +57 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S022-context-escaping.md +58 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S023-dynamic-js-encoding.md +57 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S025-server-validation.md +59 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S026-tls-encryption.md +50 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S027-mtls-validation.md +60 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S028-upload-limits.md +67 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S029-csrf-protection.md +57 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S030-directory-browsing.md +50 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S031-secure-cookie-flag.md +51 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S032-httponly-cookie.md +49 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S033-samesite-cookie.md +54 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S034-host-prefix-cookie.md +50 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S035-app-hostnames.md +59 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S036-internal-file-paths.md +61 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S037-anti-cache-headers.md +58 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S039-tls-certificate-validation.md +62 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S041-logout-invalidation.md +71 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S042-long-lived-sessions.md +57 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S044-critical-changes-reauth.md +64 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S045-brute-force-protection.md +64 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S047-oauth-csrf-protection.md +74 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S048-oauth-redirect-validation.md +61 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S049-auth-code-expiry.md +70 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S050-token-entropy.md +65 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S051-password-length.md +52 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S052-otp-entropy.md +55 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S053-generic-error-messages.md +66 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S054-no-default-admin.md +57 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S055-content-type-validation.md +58 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S056-log-injection.md +47 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S057-synchronized-time.md +49 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S058-ssrf-protection.md +69 -0
- package/skill-assets/sunlint-code-quality/rules/php/C006-verb-noun-functions.md +46 -0
- package/skill-assets/sunlint-code-quality/rules/php/C013-no-dead-code.md +53 -0
- package/skill-assets/sunlint-code-quality/rules/php/C014-dependency-injection.md +71 -0
- package/skill-assets/sunlint-code-quality/rules/php/C017-no-constructor-logic.md +68 -0
- package/skill-assets/sunlint-code-quality/rules/php/C018-generic-errors.md +50 -0
- package/skill-assets/sunlint-code-quality/rules/php/C019-error-log-level.md +54 -0
- package/skill-assets/sunlint-code-quality/rules/php/C020-no-unused-imports.md +55 -0
- package/skill-assets/sunlint-code-quality/rules/php/C022-no-unused-variables.md +51 -0
- package/skill-assets/sunlint-code-quality/rules/php/C023-no-duplicate-names.md +61 -0
- package/skill-assets/sunlint-code-quality/rules/php/C024-centralize-constants.md +60 -0
- package/skill-assets/sunlint-code-quality/rules/php/C029-catch-log-root-cause.md +57 -0
- package/skill-assets/sunlint-code-quality/rules/php/C030-custom-error-classes.md +62 -0
- package/skill-assets/sunlint-code-quality/rules/php/C033-separate-data-access.md +79 -0
- package/skill-assets/sunlint-code-quality/rules/php/C035-error-context-logging.md +54 -0
- package/skill-assets/sunlint-code-quality/rules/php/C041-no-hardcoded-secrets.md +59 -0
- package/skill-assets/sunlint-code-quality/rules/php/C042-boolean-naming.md +52 -0
- package/skill-assets/sunlint-code-quality/rules/php/C052-controller-parsing.md +66 -0
- package/skill-assets/sunlint-code-quality/rules/php/C060-superclass-logic.md +54 -0
- package/skill-assets/sunlint-code-quality/rules/php/C067-no-hardcoded-config.md +55 -0
- package/skill-assets/sunlint-code-quality/rules/php/S003-open-redirect.md +60 -0
- package/skill-assets/sunlint-code-quality/rules/php/S004-no-log-credentials.md +67 -0
- package/skill-assets/sunlint-code-quality/rules/php/S005-server-authorization.md +57 -0
- package/skill-assets/sunlint-code-quality/rules/php/S006-default-credentials.md +61 -0
- package/skill-assets/sunlint-code-quality/rules/php/S007-output-encoding.md +61 -0
- package/skill-assets/sunlint-code-quality/rules/php/S009-approved-crypto.md +53 -0
- package/skill-assets/sunlint-code-quality/rules/php/S010-csprng.md +47 -0
- package/skill-assets/sunlint-code-quality/rules/php/S011-encrypted-client-hello.md +41 -0
- package/skill-assets/sunlint-code-quality/rules/php/S012-secrets-management.md +60 -0
- package/skill-assets/sunlint-code-quality/rules/php/S013-tls-connections.md +67 -0
- package/skill-assets/sunlint-code-quality/rules/php/S016-no-sensitive-query-string.md +61 -0
- package/skill-assets/sunlint-code-quality/rules/php/S017-parameterized-queries.md +44 -0
- package/skill-assets/sunlint-code-quality/rules/php/S019-email-input-sanitization.md +54 -0
- package/skill-assets/sunlint-code-quality/rules/php/S020-eval-code-execution.md +57 -0
- package/skill-assets/sunlint-code-quality/rules/php/S022-context-escaping.md +58 -0
- package/skill-assets/sunlint-code-quality/rules/php/S023-dynamic-js-encoding.md +62 -0
- package/skill-assets/sunlint-code-quality/rules/php/S025-server-validation.md +63 -0
- package/skill-assets/sunlint-code-quality/rules/php/S026-tls-encryption.md +48 -0
- package/skill-assets/sunlint-code-quality/rules/php/S027-mtls-validation.md +62 -0
- package/skill-assets/sunlint-code-quality/rules/php/S028-upload-limits.md +60 -0
- package/skill-assets/sunlint-code-quality/rules/php/S029-csrf-protection.md +65 -0
- package/skill-assets/sunlint-code-quality/rules/php/S030-directory-browsing.md +40 -0
- package/skill-assets/sunlint-code-quality/rules/php/S031-secure-cookie-flag.md +55 -0
- package/skill-assets/sunlint-code-quality/rules/php/S032-httponly-cookie.md +54 -0
- package/skill-assets/sunlint-code-quality/rules/php/S033-samesite-cookie.md +52 -0
- package/skill-assets/sunlint-code-quality/rules/php/S034-host-prefix-cookie.md +49 -0
- package/skill-assets/sunlint-code-quality/rules/php/S035-app-hostnames.md +49 -0
- package/skill-assets/sunlint-code-quality/rules/php/S036-internal-file-paths.md +56 -0
- package/skill-assets/sunlint-code-quality/rules/php/S037-anti-cache-headers.md +56 -0
- package/skill-assets/sunlint-code-quality/rules/php/S039-tls-certificate-validation.md +54 -0
- package/skill-assets/sunlint-code-quality/rules/php/S041-logout-invalidation.md +63 -0
- package/skill-assets/sunlint-code-quality/rules/php/S042-long-lived-sessions.md +57 -0
- package/skill-assets/sunlint-code-quality/rules/php/S044-critical-changes-reauth.md +71 -0
- package/skill-assets/sunlint-code-quality/rules/php/S045-brute-force-protection.md +67 -0
- package/skill-assets/sunlint-code-quality/rules/php/S047-oauth-csrf-protection.md +72 -0
- package/skill-assets/sunlint-code-quality/rules/php/S048-oauth-redirect-validation.md +54 -0
- package/skill-assets/sunlint-code-quality/rules/php/S049-auth-code-expiry.md +71 -0
- package/skill-assets/sunlint-code-quality/rules/php/S050-token-entropy.md +58 -0
- package/skill-assets/sunlint-code-quality/rules/php/S051-password-length.md +59 -0
- package/skill-assets/sunlint-code-quality/rules/php/S052-otp-entropy.md +45 -0
- package/skill-assets/sunlint-code-quality/rules/php/S053-generic-error-messages.md +59 -0
- package/skill-assets/sunlint-code-quality/rules/php/S054-no-default-admin.md +62 -0
- package/skill-assets/sunlint-code-quality/rules/php/S055-content-type-validation.md +58 -0
- package/skill-assets/sunlint-code-quality/rules/php/S056-log-injection.md +48 -0
- package/skill-assets/sunlint-code-quality/rules/php/S057-synchronized-time.md +52 -0
- package/skill-assets/sunlint-code-quality/rules/php/S058-ssrf-protection.md +65 -0
- package/skill-assets/sunlint-code-quality/rules/python/C006-verb-noun-functions.md +30 -0
- package/skill-assets/sunlint-code-quality/rules/python/C013-no-dead-code.md +24 -0
- package/skill-assets/sunlint-code-quality/rules/python/C014-dependency-injection.md +68 -0
- package/skill-assets/sunlint-code-quality/rules/python/C017-no-constructor-logic.md +30 -0
- package/skill-assets/sunlint-code-quality/rules/python/C018-generic-errors.md +25 -0
- package/skill-assets/sunlint-code-quality/rules/python/C019-error-log-level.md +26 -0
- package/skill-assets/sunlint-code-quality/rules/python/C020-no-unused-imports.md +28 -0
- package/skill-assets/sunlint-code-quality/rules/python/C022-no-unused-variables.md +24 -0
- package/skill-assets/sunlint-code-quality/rules/python/C023-no-duplicate-names.md +27 -0
- package/skill-assets/sunlint-code-quality/rules/python/C024-centralize-constants.md +27 -0
- package/skill-assets/sunlint-code-quality/rules/python/C029-catch-log-root-cause.md +61 -0
- package/skill-assets/sunlint-code-quality/rules/python/C030-custom-error-classes.md +28 -0
- package/skill-assets/sunlint-code-quality/rules/python/C033-separate-data-access.md +53 -0
- package/skill-assets/sunlint-code-quality/rules/python/C035-error-context-logging.md +26 -0
- package/skill-assets/sunlint-code-quality/rules/python/C041-no-hardcoded-secrets.md +23 -0
- package/skill-assets/sunlint-code-quality/rules/python/C042-boolean-naming.md +24 -0
- package/skill-assets/sunlint-code-quality/rules/python/C052-controller-parsing.md +34 -0
- package/skill-assets/sunlint-code-quality/rules/python/C060-superclass-logic.md +26 -0
- package/skill-assets/sunlint-code-quality/rules/python/C067-no-hardcoded-config.md +22 -0
- package/skill-assets/sunlint-code-quality/rules/python/S003-open-redirect.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S004-no-log-credentials.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S005-server-authorization.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S006-default-credentials.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S007-output-encoding.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S009-approved-crypto.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S010-csprng.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S011-encrypted-client-hello.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S012-secrets-management.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S013-tls-connections.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S016-no-sensitive-query-string.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S017-parameterized-queries.md +51 -0
- package/skill-assets/sunlint-code-quality/rules/python/S019-email-input-sanitization.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S020-eval-code-execution.md +51 -0
- package/skill-assets/sunlint-code-quality/rules/python/S022-context-escaping.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S023-dynamic-js-encoding.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S025-server-validation.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S026-tls-encryption.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S027-mtls-validation.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S028-upload-limits.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S029-csrf-protection.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S030-directory-browsing.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S031-secure-cookie-flag.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S032-httponly-cookie.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S033-samesite-cookie.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S034-host-prefix-cookie.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S035-app-hostnames.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S036-internal-file-paths.md +50 -0
- package/skill-assets/sunlint-code-quality/rules/python/S037-anti-cache-headers.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S039-tls-certificate-validation.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S041-logout-invalidation.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S042-long-lived-sessions.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S044-critical-changes-reauth.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S045-brute-force-protection.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S047-oauth-csrf-protection.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S048-oauth-redirect-validation.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S049-auth-code-expiry.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S050-token-entropy.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S051-password-length.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S052-otp-entropy.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S053-generic-error-messages.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S054-no-default-admin.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S055-content-type-validation.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S056-log-injection.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S057-synchronized-time.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S058-ssrf-protection.md +57 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/C006-verb-noun-functions.md +45 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/C013-no-dead-code.md +51 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/C014-dependency-injection.md +69 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/C017-no-constructor-logic.md +60 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/C018-generic-errors.md +47 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/C019-error-log-level.md +50 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/C020-no-unused-imports.md +55 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/C022-no-unused-variables.md +59 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/C023-no-duplicate-names.md +58 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/C024-centralize-constants.md +56 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/C029-catch-log-root-cause.md +53 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/C030-custom-error-classes.md +60 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/C033-separate-data-access.md +69 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/C035-error-context-logging.md +50 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/C041-no-hardcoded-secrets.md +47 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/C042-boolean-naming.md +42 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/C052-controller-parsing.md +64 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/C060-superclass-logic.md +67 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/C067-no-hardcoded-config.md +52 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S003-open-redirect.md +76 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S004-no-log-credentials.md +71 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S005-server-authorization.md +68 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S006-default-credentials.md +69 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S007-output-encoding.md +60 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S009-approved-crypto.md +53 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S010-csprng.md +53 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S011-encrypted-client-hello.md +45 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S012-secrets-management.md +47 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S013-tls-connections.md +70 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S016-no-sensitive-query-string.md +53 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S017-parameterized-queries.md +55 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S019-email-input-sanitization.md +56 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S020-eval-code-execution.md +58 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S022-context-escaping.md +48 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S023-dynamic-js-encoding.md +52 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S025-server-validation.md +62 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S026-tls-encryption.md +47 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S027-mtls-validation.md +50 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S028-upload-limits.md +65 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S029-csrf-protection.md +62 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S030-directory-browsing.md +52 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S031-secure-cookie-flag.md +48 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S032-httponly-cookie.md +36 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S033-samesite-cookie.md +46 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S034-host-prefix-cookie.md +50 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S035-app-hostnames.md +49 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S036-internal-file-paths.md +53 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S037-anti-cache-headers.md +52 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S039-tls-certificate-validation.md +51 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S041-logout-invalidation.md +58 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S042-long-lived-sessions.md +55 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S044-critical-changes-reauth.md +69 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S045-brute-force-protection.md +59 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S047-oauth-csrf-protection.md +60 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S048-oauth-redirect-validation.md +59 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S049-auth-code-expiry.md +73 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S050-token-entropy.md +48 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S051-password-length.md +60 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S052-otp-entropy.md +49 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S053-generic-error-messages.md +61 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S054-no-default-admin.md +64 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S055-content-type-validation.md +64 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S056-log-injection.md +48 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S057-synchronized-time.md +57 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S058-ssrf-protection.md +63 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Apply CSRF Protection
|
|
3
|
+
impact: HIGH
|
|
4
|
+
impactDescription: prevents Cross-Site Request Forgery attacks that could execute actions on behalf of the user
|
|
5
|
+
tags: csrf, security, java
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Apply CSRF Protection
|
|
9
|
+
|
|
10
|
+
CSRF attacks trick a logged-in user into sending a request to your application (e.g., via a hidden form on a malicious site). If the application relies only on cookies for authentication, the browser will include them, and the attack will succeed.
|
|
11
|
+
|
|
12
|
+
**Incorrect (no CSRF protection):**
|
|
13
|
+
|
|
14
|
+
```java
|
|
15
|
+
// VULNERABLE: Spring Security disabled CSRF
|
|
16
|
+
http.csrf(csrf -> csrf.disable());
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
**Correct (enabled and configured CSRF):**
|
|
20
|
+
|
|
21
|
+
```java
|
|
22
|
+
// 1. Spring Security (Enabled by default)
|
|
23
|
+
// For SPAs (Stateless/JWT):
|
|
24
|
+
// http.csrf(csrf -> csrf.csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse()));
|
|
25
|
+
|
|
26
|
+
// 2. In Thymeleaf forms (automatic token insertion):
|
|
27
|
+
// <form th:action="@{/logout}" method="post">
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
**Defense Strategies:**
|
|
31
|
+
- **Synchronizer Token Pattern:** Include a random token in every state-changing request (POST, PUT, DELETE).
|
|
32
|
+
- **SameSite Cookie Attribute:** Set `SameSite=Lax` or `Strict`.
|
|
33
|
+
- **Custom Headers:** For AJAX requests, require a custom header (e.g., `X-Requested-With`) which cannot be added cross-site without CORS permission.
|
|
34
|
+
|
|
35
|
+
**Tools:** Spring Security, OWASP ZAP
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Disable Directory Browsing
|
|
3
|
+
impact: MEDIUM
|
|
4
|
+
impactDescription: prevents attackers from seeing the directory structure and identifying sensitive files
|
|
5
|
+
tags: configuration, server, directory-browsing, security, java
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Disable Directory Browsing
|
|
9
|
+
|
|
10
|
+
If directory browsing is enabled, an attacker visiting a folder without an `index.html` file can see all files in that directory. This often leads to the discovery of sensitive configuration files, source code backups, or uploaded data.
|
|
11
|
+
|
|
12
|
+
**How to Disable:**
|
|
13
|
+
|
|
14
|
+
**1. In Embedded Tomcat (Spring Boot):**
|
|
15
|
+
It is disabled by default. Do not change the `server.tomcat.basedir` to a public-facing path without index files.
|
|
16
|
+
|
|
17
|
+
**2. In Standard `web.xml` (Legacy):**
|
|
18
|
+
```xml
|
|
19
|
+
<servlet>
|
|
20
|
+
<servlet-name>default</servlet-name>
|
|
21
|
+
<servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
|
|
22
|
+
<init-param>
|
|
23
|
+
<param-name>listings</param-name>
|
|
24
|
+
<param-value>false</param-value> <!-- SECURE: Set to false -->
|
|
25
|
+
</init-param>
|
|
26
|
+
</servlet>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
**3. Using Spring Security:**
|
|
30
|
+
```java
|
|
31
|
+
// Prevent direct access to static resource directories
|
|
32
|
+
http.authorizeHttpRequests(auth -> auth
|
|
33
|
+
.requestMatchers("/static/**").permitAll()
|
|
34
|
+
.requestMatchers("/config/**").denyAll()
|
|
35
|
+
);
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**Tools:** OWASP ZAP, Manual Review
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Set Secure Flag On Session Cookies
|
|
3
|
+
impact: HIGH
|
|
4
|
+
impactDescription: prevents cookies from being sent over unencrypted HTTP connections
|
|
5
|
+
tags: cookie, secure, session, transport, security, java
|
|
6
|
+
---
|
|
7
|
+
## Set Secure Flag On Session Cookies
|
|
8
|
+
|
|
9
|
+
The `Secure` flag ensures that the browser only sends the cookie over encrypted (HTTPS) connections. Without this flag, a cookie could be sent over a plain HTTP link (e.g., if a user manually types `http://...`), making it vulnerable to interception.
|
|
10
|
+
|
|
11
|
+
**Incorrect (insecure cookie):**
|
|
12
|
+
|
|
13
|
+
```java
|
|
14
|
+
// VULNERABLE: Cookie can be sent over HTTP
|
|
15
|
+
Cookie cookie = new Cookie("SESSION_ID", "12345");
|
|
16
|
+
cookie.setPath("/");
|
|
17
|
+
response.addCookie(cookie);
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
**Correct (secure cookie):**
|
|
21
|
+
|
|
22
|
+
```java
|
|
23
|
+
// 1. Manual Servlet API
|
|
24
|
+
Cookie cookie = new Cookie("SESSION_ID", "12345");
|
|
25
|
+
cookie.setSecure(true); // SECURE: Only send over HTTPS
|
|
26
|
+
cookie.setPath("/");
|
|
27
|
+
response.addCookie(cookie);
|
|
28
|
+
|
|
29
|
+
// 2. Spring Boot Configuration (application.properties)
|
|
30
|
+
// server.servlet.session.cookie.secure=true
|
|
31
|
+
|
|
32
|
+
// 3. Spring Security Header
|
|
33
|
+
// http.headers(headers -> headers
|
|
34
|
+
// .contentSecurityPolicy(csp -> csp.policyDirectives("upgrade-insecure-requests"))
|
|
35
|
+
// );
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**Tools:** OWASP ZAP, Browser DevTools, SonarQube (S2255)
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Set HttpOnly On Session Cookies
|
|
3
|
+
impact: HIGH
|
|
4
|
+
impactDescription: prevents client-side scripts from accessing the cookie, mitigating XSS impacts
|
|
5
|
+
tags: cookie, httponly, session, xss, security, java
|
|
6
|
+
---
|
|
7
|
+
## Set HttpOnly On Session Cookies
|
|
8
|
+
|
|
9
|
+
The `HttpOnly` flag prevents JavaScript from accessing the cookie via `document.cookie`. This is a critical defense-in-depth measure; even if an attacker finds an XSS vulnerability, they cannot steal the session cookie.
|
|
10
|
+
|
|
11
|
+
**Incorrect (accessible via JS):**
|
|
12
|
+
|
|
13
|
+
```java
|
|
14
|
+
// VULNERABLE: JS can read this cookie
|
|
15
|
+
Cookie cookie = new Cookie("SESSION_ID", "12345");
|
|
16
|
+
response.addCookie(cookie);
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
**Correct (HttpOnly cookie):**
|
|
20
|
+
|
|
21
|
+
```java
|
|
22
|
+
// 1. Manual Servlet API
|
|
23
|
+
Cookie cookie = new Cookie("SESSION_ID", "12345");
|
|
24
|
+
cookie.setHttpOnly(true); // SECURE: Inaccessible to JavaScript
|
|
25
|
+
response.addCookie(cookie);
|
|
26
|
+
|
|
27
|
+
// 2. Spring Boot Configuration (application.properties)
|
|
28
|
+
// server.servlet.session.cookie.http-only=true
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**Tools:** Browser DevTools, SonarQube (S3330)
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Set SameSite On Session Cookies
|
|
3
|
+
impact: MEDIUM
|
|
4
|
+
impactDescription: prevents Cross-Site Request Forgery (CSRF) attacks by restricting cookie transmission
|
|
5
|
+
tags: cookie, samesite, csrf, security, java
|
|
6
|
+
---
|
|
7
|
+
## Set SameSite On Session Cookies
|
|
8
|
+
|
|
9
|
+
The `SameSite` attribute tells the browser whether to send the cookie with cross-site requests. Setting it to `Lax` or `Strict` significantly reduces the risk of CSRF attacks.
|
|
10
|
+
|
|
11
|
+
**Incorrect (no SameSite attribute):**
|
|
12
|
+
|
|
13
|
+
```java
|
|
14
|
+
// VULNERABLE: Browser defaults vary, might allow cross-site sending
|
|
15
|
+
Cookie cookie = new Cookie("SESSION_ID", "12345");
|
|
16
|
+
response.addCookie(cookie);
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
**Correct (SameSite Lax/Strict):**
|
|
20
|
+
|
|
21
|
+
```java
|
|
22
|
+
// 1. Spring Boot Configuration (Recommended)
|
|
23
|
+
// server.servlet.session.cookie.same-site=lax
|
|
24
|
+
|
|
25
|
+
// 2. Spring Security (if using SessionRepository)
|
|
26
|
+
// @Bean
|
|
27
|
+
// public CookieSerializer cookieSerializer() {
|
|
28
|
+
// DefaultCookieSerializer serializer = new DefaultCookieSerializer();
|
|
29
|
+
// serializer.setSameSite("Lax");
|
|
30
|
+
// return serializer;
|
|
31
|
+
// }
|
|
32
|
+
|
|
33
|
+
// 3. Manual Header (Servlet 6.0+ or via Filter)
|
|
34
|
+
response.setHeader("Set-Cookie", "SESSION_ID=12345; Secure; HttpOnly; SameSite=Lax");
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**Modes:**
|
|
38
|
+
- `Strict`: Cookie only sent for first-party requests.
|
|
39
|
+
- `Lax`: Cookie sent for first-party and safe top-level navigations (links). **Recommended default.**
|
|
40
|
+
- `None`: Cookie sent always (requires `Secure` attribute).
|
|
41
|
+
|
|
42
|
+
**Tools:** OWASP ZAP, Browser DevTools
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Use __Host- Prefix For Cookies
|
|
3
|
+
impact: MEDIUM
|
|
4
|
+
impactDescription: prevents cookie tossing and domain-shadowing attacks
|
|
5
|
+
tags: cookie, host-prefix, security, java
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Use __Host- Prefix For Cookies
|
|
9
|
+
|
|
10
|
+
The `__Host-` prefix on a cookie name provides maximum security. It forces the cookie to be `Secure`, have no specified `Domain` (preventing subdomains from accessing it), and be restricted to the same path that set it (`/`).
|
|
11
|
+
|
|
12
|
+
**Incorrect (standard cookie name):**
|
|
13
|
+
|
|
14
|
+
```java
|
|
15
|
+
// VULNERABLE: Can be shadowed by subdomains
|
|
16
|
+
Cookie cookie = new Cookie("SESSION_ID", "12345");
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
**Correct (__Host- prefix):**
|
|
20
|
+
|
|
21
|
+
```java
|
|
22
|
+
// SECURE: Browser enforces Secure, Path=/, and no Domain
|
|
23
|
+
Cookie cookie = new Cookie("__Host-SESSION_ID", "12345");
|
|
24
|
+
cookie.setSecure(true);
|
|
25
|
+
cookie.setPath("/");
|
|
26
|
+
response.addCookie(cookie);
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
**Requirements:**
|
|
30
|
+
- The cookie name must start with `__Host-`.
|
|
31
|
+
- The `Secure` attribute must be set.
|
|
32
|
+
- The `Path` attribute must be `/`.
|
|
33
|
+
- The `Domain` attribute must **NOT** be set.
|
|
34
|
+
|
|
35
|
+
**Tools:** Browser DevTools, Manual Review
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Host Apps On Different Hostnames
|
|
3
|
+
impact: MEDIUM
|
|
4
|
+
impactDescription: prevents Cross-Site Scripting (XSS) from spreading between different applications on the same domain
|
|
5
|
+
tags: architecture, isolation, security, java
|
|
6
|
+
---
|
|
7
|
+
## Host Apps On Different Hostnames
|
|
8
|
+
|
|
9
|
+
If multiple applications (e.g., `app.example.com` and `admin.example.com`) are hosted on the same domain (`example.com`) and share cookies or have permissive CORS, an XSS in one app can be used to attack the other.
|
|
10
|
+
|
|
11
|
+
**Best Practice:**
|
|
12
|
+
Use distinct subdomains or entirely different domains for applications with different trust levels.
|
|
13
|
+
|
|
14
|
+
**Correct (Isolation):**
|
|
15
|
+
- **Public Website:** `www.sun-asterisk.vn`
|
|
16
|
+
- **Customer Portal:** `portal.sun-asterisk.vn`
|
|
17
|
+
- **Internal Admin:** `admin-internal.sun-asterisk.vn` (or on a private VPC)
|
|
18
|
+
|
|
19
|
+
**Why it matters:**
|
|
20
|
+
- **Cookie Isolation:** Browsers can be configured to share cookies across subdomains.
|
|
21
|
+
- **Same-Origin Policy:** Distinct origins provide a strong security boundary.
|
|
22
|
+
|
|
23
|
+
**Tools:** Architecture Review
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Use Internal Data For File Paths
|
|
3
|
+
impact: CRITICAL
|
|
4
|
+
impactDescription: prevents Path Traversal attacks (LFI/RFI)
|
|
5
|
+
tags: architecture, path-traversal, security, java
|
|
6
|
+
---
|
|
7
|
+
## Use Internal Data For File Paths
|
|
8
|
+
|
|
9
|
+
Never allow a user to specify the file name or path directly in a request (e.g., `?file=report.pdf`). Attackers can use `../` to access sensitive files like `/etc/passwd`.
|
|
10
|
+
|
|
11
|
+
**Incorrect (trusting user for file path):**
|
|
12
|
+
|
|
13
|
+
```java
|
|
14
|
+
// VULNERABLE: Attacker input: ../../../etc/passwd
|
|
15
|
+
@GetMapping("/download")
|
|
16
|
+
public void download(@RequestParam String file, HttpServletResponse response) {
|
|
17
|
+
File target = new File("/var/www/uploads/" + file);
|
|
18
|
+
// ...
|
|
19
|
+
}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
**Correct (internal mapping):**
|
|
23
|
+
|
|
24
|
+
```java
|
|
25
|
+
// SECURE: Use a database ID and look up the internal path
|
|
26
|
+
@GetMapping("/download/{id}")
|
|
27
|
+
public void download(@PathVariable Long id, HttpServletResponse response) {
|
|
28
|
+
FileInfo info = fileRepo.findById(id).orElseThrow();
|
|
29
|
+
File target = new File("/var/www/uploads/" + info.getInternalStorageName());
|
|
30
|
+
// ...
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// SECURE: Strict validation (Whitelist/Regex)
|
|
34
|
+
if (!file.matches("^[a-zA-Z0-0._-]+\\.pdf$")) {
|
|
35
|
+
throw new SecurityException("Invalid filename");
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
**Tools:** SonarQube (S2083), OWASP ZAP, Manual Review
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Set Anti-cache Headers For Sensitive Pages
|
|
3
|
+
impact: MEDIUM
|
|
4
|
+
impactDescription: prevents sensitive data from being stored in browser or proxy caches
|
|
5
|
+
tags: cache, headers, security, java
|
|
6
|
+
---
|
|
7
|
+
## Set Anti-cache Headers For Sensitive Pages
|
|
8
|
+
|
|
9
|
+
Sensitive information (bank statements, health records) should not be cached on the user's computer or on intermediate proxies. If cached, another user of the same computer or network could potentially see the data.
|
|
10
|
+
|
|
11
|
+
**Incorrect (cacheable sensitive data):**
|
|
12
|
+
|
|
13
|
+
```java
|
|
14
|
+
@GetMapping("/account/balance")
|
|
15
|
+
public ResponseEntity<BalanceDto> getBalance() {
|
|
16
|
+
return ResponseEntity.ok(service.getBalance());
|
|
17
|
+
}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
**Correct (anti-cache headers):**
|
|
21
|
+
|
|
22
|
+
```java
|
|
23
|
+
@GetMapping("/account/balance")
|
|
24
|
+
public ResponseEntity<BalanceDto> getBalance() {
|
|
25
|
+
return ResponseEntity.ok()
|
|
26
|
+
.header(HttpHeaders.CACHE_CONTROL, "no-store, no-cache, must-revalidate, max-age=0")
|
|
27
|
+
.header(HttpHeaders.PRAGMA, "no-cache")
|
|
28
|
+
.body(service.getBalance());
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**Recommended Headers:**
|
|
33
|
+
- `Cache-Control: no-store, no-cache, must-revalidate, max-age=0`
|
|
34
|
+
- `Pragma: no-cache`
|
|
35
|
+
- `Expires: 0`
|
|
36
|
+
|
|
37
|
+
**Tools:** Browser DevTools, OWASP ZAP
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: TLS Clients Must Validate Server Certificates
|
|
3
|
+
impact: CRITICAL
|
|
4
|
+
impactDescription: prevents Man-in-the-Middle (MitM) attacks by ensuring the server is authentic
|
|
5
|
+
tags: tls, certificates, validation, mitm, security, java
|
|
6
|
+
---
|
|
7
|
+
## TLS Clients Must Validate Server Certificates
|
|
8
|
+
|
|
9
|
+
Disabling certificate validation (trusting all certificates) makes TLS useless. An attacker can use a self-signed certificate to intercept and read all traffic between your client and the server.
|
|
10
|
+
|
|
11
|
+
**Incorrect (disabled validation):**
|
|
12
|
+
|
|
13
|
+
```java
|
|
14
|
+
// VULNERABLE: Trusting all certificates
|
|
15
|
+
TrustManager[] trustAllCerts = new TrustManager[]{
|
|
16
|
+
new X509TrustManager() {
|
|
17
|
+
public void checkClientTrusted(X509Certificate[] chain, String authType) {}
|
|
18
|
+
public void checkServerTrusted(X509Certificate[] chain, String authType) {}
|
|
19
|
+
public X509Certificate[] getAcceptedIssuers() { return null; }
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
SSLContext sc = SSLContext.getInstance("TLS");
|
|
23
|
+
sc.init(null, trustAllCerts, new SecureRandom());
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
**Correct (default/strict validation):**
|
|
27
|
+
|
|
28
|
+
```java
|
|
29
|
+
// SECURE: Use the default JVM TrustManager (uses the system keystore)
|
|
30
|
+
SSLContext sc = SSLContext.getDefault();
|
|
31
|
+
|
|
32
|
+
// SECURE: Use a custom Truststore containing only your CA
|
|
33
|
+
KeyStore trustStore = KeyStore.getInstance("PKCS12");
|
|
34
|
+
trustStore.load(new FileInputStream("my-ca.p12"), password);
|
|
35
|
+
|
|
36
|
+
TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
|
|
37
|
+
tmf.init(trustStore);
|
|
38
|
+
|
|
39
|
+
SSLContext sc = SSLContext.getInstance("TLS");
|
|
40
|
+
sc.init(null, tmf.getTrustManagers(), new SecureRandom());
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**Tools:** FindSecBugs (WEAK_TRUST_MANAGER), SonarQube (S4830)
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Invalidate Session On Logout
|
|
3
|
+
impact: CRITICAL
|
|
4
|
+
impactDescription: ensures that stolen or leaked session tokens cannot be reused after a user has logged out
|
|
5
|
+
tags: session, logout, invalidation, security, java
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Invalidate Session On Logout
|
|
9
|
+
|
|
10
|
+
When a user logs out, the session must be destroyed on the server. Simply deleting the cookie on the client is insufficient, as the session remains active on the server and can be hijacked if an attacker possesses the session ID.
|
|
11
|
+
|
|
12
|
+
**Incorrect (client-side only logout):**
|
|
13
|
+
|
|
14
|
+
```java
|
|
15
|
+
// VULNERABLE: Only deletes cookie, session still exists on server
|
|
16
|
+
@GetMapping("/logout")
|
|
17
|
+
public String logout(HttpServletResponse response) {
|
|
18
|
+
Cookie cookie = new Cookie("JSESSIONID", null);
|
|
19
|
+
cookie.setMaxAge(0);
|
|
20
|
+
response.addCookie(cookie);
|
|
21
|
+
return "redirect:/login";
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
**Correct (server-side session invalidation):**
|
|
26
|
+
|
|
27
|
+
```java
|
|
28
|
+
// 1. Using Standard Servlet API
|
|
29
|
+
@GetMapping("/logout")
|
|
30
|
+
public String logout(HttpServletRequest request) {
|
|
31
|
+
HttpSession session = request.getSession(false);
|
|
32
|
+
if (session != null) {
|
|
33
|
+
session.invalidate(); // Destroys the session on the server
|
|
34
|
+
}
|
|
35
|
+
return "redirect:/login";
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// 2. Using Spring Security (Recommended)
|
|
39
|
+
// Configure in SecurityFilterChain:
|
|
40
|
+
// http.logout(logout -> logout
|
|
41
|
+
// .logoutUrl("/auth/logout")
|
|
42
|
+
// .invalidateHttpSession(true)
|
|
43
|
+
// .deleteCookies("JSESSIONID")
|
|
44
|
+
// .logoutSuccessUrl("/login")
|
|
45
|
+
// );
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
**JWT (Stateless) Logout:**
|
|
49
|
+
For JWTs, since they are stateless, you cannot "invalidate" them on the server easily.
|
|
50
|
+
- **Option A:** Use short-lived Access Tokens and revoke Refresh Tokens.
|
|
51
|
+
- **Option B:** Maintain a "Denylist" in Redis for revoked JTI (JWT ID) claims until they expire.
|
|
52
|
+
|
|
53
|
+
**Tools:** Spring Security, OWASP ZAP, Manual Audit
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Re-authenticate For Long-lived Sessions
|
|
3
|
+
impact: MEDIUM
|
|
4
|
+
impactDescription: ensures continuous user identity verification and reduces the window for session hijacking
|
|
5
|
+
tags: session, authentication, timeout, security, java
|
|
6
|
+
---
|
|
7
|
+
## Re-authenticate For Long-lived Sessions
|
|
8
|
+
|
|
9
|
+
Long-lived sessions (e.g., "Remember Me" for 30 days) increase the risk of session hijacking. For sensitive actions, you should require the user to re-enter their password even if they are already "logged in."
|
|
10
|
+
|
|
11
|
+
**Incorrect (never re-auth):**
|
|
12
|
+
|
|
13
|
+
```java
|
|
14
|
+
@PostMapping("/user/change-email")
|
|
15
|
+
public void changeEmail(@RequestBody String newEmail) {
|
|
16
|
+
// VULNERABLE: If the computer was left unlocked, anyone can change the email
|
|
17
|
+
userService.updateEmail(currentUserId, newEmail);
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
**Correct (fresh authentication):**
|
|
22
|
+
|
|
23
|
+
```java
|
|
24
|
+
@PostMapping("/user/change-email")
|
|
25
|
+
public ResponseEntity<?> changeEmail(@RequestBody ChangeEmailRequest req) {
|
|
26
|
+
// SECURE: Verify the password again for this critical action
|
|
27
|
+
if (!authService.verifyPassword(currentUserId, req.getPassword())) {
|
|
28
|
+
return ResponseEntity.status(401).body("Password verification failed");
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
userService.updateEmail(currentUserId, req.getNewEmail());
|
|
32
|
+
return ResponseEntity.ok().build();
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
**Tools:** Spring Security (IsFullyAuthenticated), Manual Audit
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Re-authenticate Before Critical Changes
|
|
3
|
+
impact: HIGH
|
|
4
|
+
impactDescription: prevents unauthorized sensitive operations if a session is left unattended or hijacked
|
|
5
|
+
tags: authentication, reauthentication, security, java
|
|
6
|
+
---
|
|
7
|
+
## Re-authenticate Before Critical Changes
|
|
8
|
+
|
|
9
|
+
Critical actions like changing passwords, changing emails, or deleting an account should always require a fresh authentication step (password or MFA challenge).
|
|
10
|
+
|
|
11
|
+
**Correct (Spring Security):**
|
|
12
|
+
|
|
13
|
+
```java
|
|
14
|
+
// Use @PreAuthorize to ensure user did not use "Remember Me" for this specific method
|
|
15
|
+
@PreAuthorize("isFullyAuthenticated()")
|
|
16
|
+
@PostMapping("/settings/delete-account")
|
|
17
|
+
public void deleteAccount() {
|
|
18
|
+
// ...
|
|
19
|
+
}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
**Definition of "Critical Changes":**
|
|
23
|
+
- Security settings (MFA, password).
|
|
24
|
+
- Contact information (Email, Phone).
|
|
25
|
+
- Financial transactions or withdrawal.
|
|
26
|
+
- Account deletion.
|
|
27
|
+
|
|
28
|
+
**Tools:** Spring Security, OWASP ASVS
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Implement Brute-Force Protection
|
|
3
|
+
impact: HIGH
|
|
4
|
+
impactDescription: prevents automated attacks from guessing passwords or credentials
|
|
5
|
+
tags: brute-force, rate-limiting, authentication, security, java
|
|
6
|
+
---
|
|
7
|
+
## Implement Brute-Force Protection
|
|
8
|
+
|
|
9
|
+
Without protection, an attacker can use automated scripts to try thousands of password combinations. You must implement rate limiting or account lockout mechanisms.
|
|
10
|
+
|
|
11
|
+
**Incorrect (no protection):**
|
|
12
|
+
|
|
13
|
+
```java
|
|
14
|
+
@PostMapping("/login")
|
|
15
|
+
public void login(@RequestBody LoginRequest req) {
|
|
16
|
+
// VULNERABLE: No limit on the number of attempts
|
|
17
|
+
boolean success = authService.authenticate(req);
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
**Correct (rate limiting and lockout):**
|
|
22
|
+
|
|
23
|
+
```java
|
|
24
|
+
// 1. Using Bucket4j for Rate Limiting
|
|
25
|
+
@PostMapping("/login")
|
|
26
|
+
public ResponseEntity<?> login(@RequestBody LoginRequest req) {
|
|
27
|
+
String clientIp = getClientIp();
|
|
28
|
+
if (loginRateLimiter.tryConsume(clientIp)) {
|
|
29
|
+
// Proceed with auth
|
|
30
|
+
boolean success = authService.authenticate(req);
|
|
31
|
+
// ...
|
|
32
|
+
} else {
|
|
33
|
+
return ResponseEntity.status(429).body("Too many attempts");
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**Tools:** Bucket4j, Spring Security Lockout, Redis
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Protect OAuth Code Flow Vs CSRF
|
|
3
|
+
impact: HIGH
|
|
4
|
+
impactDescription: prevents attackers from linking their accounts to a victim's session
|
|
5
|
+
tags: oauth2, csrf, state, security, java
|
|
6
|
+
---
|
|
7
|
+
## Protect OAuth Code Flow Vs CSRF
|
|
8
|
+
|
|
9
|
+
In the OAuth2 Authorization Code flow, you must use the `state` parameter to prevent CSRF. The `state` parameter ensures that the response from the Authorization Server (AS) matches the original request initiated by the user.
|
|
10
|
+
|
|
11
|
+
**Incorrect (missing state):**
|
|
12
|
+
|
|
13
|
+
```java
|
|
14
|
+
// VULNERABLE: No state parameter
|
|
15
|
+
String redirectUrl = "https://auth-server.com/authorize?client_id=123&response_type=code";
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
**Correct (using state):**
|
|
19
|
+
|
|
20
|
+
```java
|
|
21
|
+
// SECURE: Generate and verify state
|
|
22
|
+
String state = generateSecureRandomString();
|
|
23
|
+
session.setAttribute("oauth_state", state);
|
|
24
|
+
String redirectUrl = "https://auth-server.com/authorize?client_id=123&response_type=code&state=" + state;
|
|
25
|
+
|
|
26
|
+
// In the callback:
|
|
27
|
+
String returnedState = request.getParameter("state");
|
|
28
|
+
if (!state.equals(returnedState)) {
|
|
29
|
+
throw new SecurityException("CSRF Detected");
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**Tools:** Spring Security OAuth2 (handles this automatically)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Validate OAuth Redirect URIs Exactly
|
|
3
|
+
impact: HIGH
|
|
4
|
+
impactDescription: prevents attackers from stealing authorization codes via open redirects
|
|
5
|
+
tags: oauth2, redirect, validation, security, java
|
|
6
|
+
---
|
|
7
|
+
## Validate OAuth Redirect URIs Exactly
|
|
8
|
+
|
|
9
|
+
An attacker could specify a malicious `redirect_uri` in the authorize request. If the server does not perform exact matching, the authorization code could be sent to the attacker.
|
|
10
|
+
|
|
11
|
+
**Incorrect (prefix matching):**
|
|
12
|
+
|
|
13
|
+
```java
|
|
14
|
+
// VULNERABLE: Allows redirect to https://your-site.com.attacker.com
|
|
15
|
+
if (redirectUri.startsWith("https://your-site.com")) { ... }
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
**Correct (exact matching):**
|
|
19
|
+
|
|
20
|
+
```java
|
|
21
|
+
// SECURE: Exact string comparison against an allow-list
|
|
22
|
+
if (ALLOWED_REDIRECT_URIS.contains(redirectUri)) { ... }
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
**Tools:** Spring Security OAuth2
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Authentication Codes Must Expire Quickly
|
|
3
|
+
impact: HIGH
|
|
4
|
+
impactDescription: limits the window of opportunity for an attacker to use a stolen code
|
|
5
|
+
tags: oauth2, authentication, expiry, security, java
|
|
6
|
+
---
|
|
7
|
+
## Authentication Codes Must Expire Quickly
|
|
8
|
+
|
|
9
|
+
Authorization codes (and OTPs) are intended for immediate, one-time use. They should have a very short lifespan (typically 1 to 10 minutes).
|
|
10
|
+
|
|
11
|
+
**Correct (Spring Security):**
|
|
12
|
+
|
|
13
|
+
```java
|
|
14
|
+
// Configure the token store or code service to expire codes
|
|
15
|
+
// Default in Spring Security OAuth2 is usually 5 minutes
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
**Best Practice:**
|
|
19
|
+
- Max lifespan: **10 minutes**.
|
|
20
|
+
- Revoke code immediately after use (One-time use).
|
|
21
|
+
- Revoke all associated tokens if a code is used twice (indicates an attack).
|
|
22
|
+
|
|
23
|
+
**Tools:** Spring Security, Redis (for TTL)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Reference Tokens Entropy
|
|
3
|
+
impact: HIGH
|
|
4
|
+
impactDescription: ensures that tokens cannot be guessed by an attacker
|
|
5
|
+
tags: tokens, entropy, csprng, security, java
|
|
6
|
+
---
|
|
7
|
+
## Reference Tokens Entropy
|
|
8
|
+
|
|
9
|
+
Opaque reference tokens (like session IDs or API keys) must be generated using a CSPRNG and have enough entropy to prevent guessing (at least 128 bits).
|
|
10
|
+
|
|
11
|
+
**Correct (SecureRandom):**
|
|
12
|
+
|
|
13
|
+
```java
|
|
14
|
+
SecureRandom random = new SecureRandom();
|
|
15
|
+
byte[] bytes = new byte[24]; // 192 bits of entropy
|
|
16
|
+
random.nextBytes(bytes);
|
|
17
|
+
String token = Base64.getUrlEncoder().withoutPadding().encodeToString(bytes);
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
**Tools:** SecureRandom, SonarQube (S2245)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Support 12-64 Char Passwords
|
|
3
|
+
impact: MEDIUM
|
|
4
|
+
impactDescription: follows modern security standards for password length
|
|
5
|
+
tags: password, policy, security, java
|
|
6
|
+
---
|
|
7
|
+
## Support 12-64 Char Passwords
|
|
8
|
+
|
|
9
|
+
Restricting password length too much prevents strong passphrases. Allowing too much length without limits can lead to hashing-based DoS.
|
|
10
|
+
|
|
11
|
+
**Correct (Hibernate Validator):**
|
|
12
|
+
|
|
13
|
+
```java
|
|
14
|
+
public class UserDto {
|
|
15
|
+
@Size(min = 12, max = 64)
|
|
16
|
+
private String password;
|
|
17
|
+
}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
**Tools:** NIST Guidelines, Hibernate Validator
|