@sun-asterisk/sunlint 1.3.32 → 1.3.34
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 +47 -0
- package/config/released-rules.json +62 -0
- package/config/rules/enhanced-rules-registry.json +2315 -1354
- package/core/adapters/dart-analyzer.js +658 -0
- package/core/adapters/index.js +102 -0
- package/core/adapters/sunlint-rule-adapter.js +0 -2
- package/core/adapters/typescript-analyzer.js +277 -0
- package/core/analysis-orchestrator.js +168 -40
- package/core/architecture-integration.js +220 -0
- package/core/cli-action-handler.js +72 -24
- package/core/cli-program.js +13 -1
- package/core/config-merger.js +24 -14
- package/core/constants/defaults.js +1 -2
- package/core/github-annotate-service.js +141 -89
- package/core/github-step-summary-generator.js +8 -8
- package/core/interfaces/language-analyzer.interface.js +393 -0
- package/core/output-service.js +102 -38
- package/core/rule-selection-service.js +77 -27
- package/core/scoring-service.js +65 -20
- package/core/semantic-engine-manager.js +375 -0
- package/core/semantic-engine.js +4 -57
- package/core/unified-rule-registry.js +52 -11
- package/core/upload-service.js +43 -9
- package/docs/DART_RULE_EXECUTION_FLOW.md +745 -0
- package/docs/DART_SUPPORT_IMPLEMENTATION.md +245 -0
- package/docs/SUNLINT_ARCHITECTURE.md +692 -0
- package/docs/skills/CREATE_DART_RULE.md +909 -0
- package/engines/eslint-engine.js +2 -8
- package/engines/heuristic-engine.js +234 -38
- package/package.json +6 -5
- package/rules/common/C002_no_duplicate_code/config.json +12 -20
- package/rules/common/C002_no_duplicate_code/dart/analyzer.js +53 -0
- package/rules/common/C002_no_duplicate_code/index.js +93 -0
- package/rules/common/C003_no_vague_abbreviations/config.json +1 -1
- package/rules/common/C003_no_vague_abbreviations/dart/analyzer.js +54 -0
- package/rules/common/C003_no_vague_abbreviations/index.js +93 -0
- package/rules/common/C006_function_naming/dart/analyzer.js +40 -0
- package/rules/common/C006_function_naming/index.js +86 -0
- package/rules/common/C008_variable_declaration_locality/dart/analyzer.js +32 -0
- package/rules/common/C008_variable_declaration_locality/index.js +86 -0
- package/rules/common/C010_limit_block_nesting/dart/analyzer.js +32 -0
- package/rules/common/C010_limit_block_nesting/index.js +86 -0
- package/rules/common/C012_command_query_separation/config.json +61 -0
- package/rules/common/C012_command_query_separation/dart/analyzer.js +32 -0
- package/rules/common/C012_command_query_separation/index.js +86 -0
- package/rules/common/C013_no_dead_code/dart/analyzer.js +32 -0
- package/rules/common/C013_no_dead_code/index.js +86 -0
- package/rules/common/C014_dependency_injection/dart/analyzer.js +32 -0
- package/rules/common/C014_dependency_injection/index.js +86 -0
- package/rules/common/C017_constructor_logic/dart/analyzer.js +32 -0
- package/rules/common/C017_constructor_logic/index.js +86 -0
- package/rules/common/C018_no_throw_generic_error/dart/analyzer.js +32 -0
- package/rules/common/C018_no_throw_generic_error/index.js +86 -0
- package/rules/common/C019_log_level_usage/dart/analyzer.js +32 -0
- package/rules/common/C019_log_level_usage/index.js +86 -0
- package/rules/common/C019_log_level_usage/{ts-morph-analyzer.js → typescript/ts-morph-analyzer.js} +0 -1
- package/rules/common/C020_unused_imports/dart/analyzer.js +32 -0
- package/rules/common/C020_unused_imports/index.js +86 -0
- package/rules/common/C020_unused_imports/{ts-morph-analyzer.js → typescript/ts-morph-analyzer.js} +0 -1
- package/rules/common/C021_import_organization/config.json +29 -9
- package/rules/common/C021_import_organization/dart/analyzer.js +40 -0
- package/rules/common/C021_import_organization/index.js +83 -0
- package/rules/common/C021_import_organization/{ts-morph-analyzer.js → typescript/ts-morph-analyzer.js} +0 -1
- package/rules/common/C023_no_duplicate_variable/config.json +7 -2
- package/rules/common/C023_no_duplicate_variable/dart/analyzer.js +40 -0
- package/rules/common/C023_no_duplicate_variable/index.js +83 -0
- package/rules/common/C024_no_scatter_hardcoded_constants/config.json +7 -2
- package/rules/common/C024_no_scatter_hardcoded_constants/dart/analyzer.js +40 -0
- package/rules/common/C024_no_scatter_hardcoded_constants/index.js +83 -0
- package/rules/common/C024_no_scatter_hardcoded_constants/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +19 -1
- package/rules/common/C029_catch_block_logging/config.json +15 -5
- package/rules/common/C029_catch_block_logging/dart/analyzer.js +40 -0
- package/rules/common/C029_catch_block_logging/index.js +83 -0
- package/rules/common/C030_use_custom_error_classes/config.json +28 -0
- package/rules/common/C030_use_custom_error_classes/dart/analyzer.js +40 -0
- package/rules/common/C030_use_custom_error_classes/index.js +83 -0
- package/rules/common/C031_validation_separation/config.json +28 -0
- package/rules/common/C031_validation_separation/dart/analyzer.js +40 -0
- package/rules/common/C031_validation_separation/index.js +83 -0
- package/rules/common/C033_separate_service_repository/config.json +8 -3
- package/rules/common/C033_separate_service_repository/dart/analyzer.js +40 -0
- package/rules/common/C033_separate_service_repository/index.js +83 -0
- package/rules/common/C035_error_logging_context/config.json +34 -12
- package/rules/common/C035_error_logging_context/dart/analyzer.js +40 -0
- package/rules/common/C035_error_logging_context/index.js +83 -0
- package/rules/common/C040_centralized_validation/config.json +37 -8
- package/rules/common/C040_centralized_validation/dart/analyzer.js +40 -0
- package/rules/common/C040_centralized_validation/index.js +83 -0
- package/rules/common/C041_no_sensitive_hardcode/config.json +7 -2
- package/rules/common/C041_no_sensitive_hardcode/dart/analyzer.js +40 -0
- package/rules/common/C041_no_sensitive_hardcode/index.js +83 -0
- package/rules/common/C042_boolean_name_prefix/config.json +28 -0
- package/rules/common/C042_boolean_name_prefix/dart/analyzer.js +40 -0
- package/rules/common/C042_boolean_name_prefix/index.js +83 -0
- package/rules/common/C043_no_console_or_print/config.json +28 -0
- package/rules/common/C043_no_console_or_print/dart/analyzer.js +40 -0
- package/rules/common/C043_no_console_or_print/index.js +83 -0
- package/rules/common/C047_no_duplicate_retry_logic/config.json +28 -0
- package/rules/common/C047_no_duplicate_retry_logic/dart/analyzer.js +40 -0
- package/rules/common/C047_no_duplicate_retry_logic/index.js +83 -0
- package/rules/common/C048_no_bypass_architectural_layers/config.json +7 -2
- package/rules/common/C048_no_bypass_architectural_layers/dart/analyzer.js +40 -0
- package/rules/common/C048_no_bypass_architectural_layers/index.js +83 -0
- package/rules/common/C052_parsing_or_data_transformation/config.json +7 -2
- package/rules/common/C052_parsing_or_data_transformation/dart/analyzer.js +40 -0
- package/rules/common/C052_parsing_or_data_transformation/index.js +83 -0
- package/rules/common/C060_no_override_superclass/config.json +7 -2
- package/rules/common/C060_no_override_superclass/dart/analyzer.js +40 -0
- package/rules/common/C060_no_override_superclass/index.js +83 -0
- package/rules/common/C065_one_behavior_per_test/config.json +187 -28
- package/rules/common/C065_one_behavior_per_test/dart/analyzer.js +40 -0
- package/rules/common/C065_one_behavior_per_test/index.js +83 -0
- package/rules/common/C067_no_hardcoded_config/config.json +18 -4
- package/rules/common/C067_no_hardcoded_config/dart/analyzer.js +40 -0
- package/rules/common/C067_no_hardcoded_config/index.js +83 -0
- package/rules/common/C070_no_real_time_tests/config.json +41 -12
- package/rules/common/C070_no_real_time_tests/dart/analyzer.js +40 -0
- package/rules/common/C070_no_real_time_tests/index.js +83 -0
- package/rules/common/C072_single_test_behavior/config.json +28 -0
- package/rules/common/C072_single_test_behavior/dart/analyzer.js +40 -0
- package/rules/common/C072_single_test_behavior/index.js +83 -0
- package/rules/common/C073_validate_required_config_on_startup/config.json +93 -18
- package/rules/common/C073_validate_required_config_on_startup/dart/analyzer.js +40 -0
- package/rules/common/C073_validate_required_config_on_startup/index.js +83 -0
- package/rules/common/C073_validate_required_config_on_startup/{analyzer.js → typescript/analyzer.js} +0 -1
- package/rules/common/C075_explicit_return_types/config.json +28 -0
- package/rules/common/C075_explicit_return_types/dart/analyzer.js +40 -0
- package/rules/common/C075_explicit_return_types/index.js +83 -0
- package/rules/common/C076_explicit_function_types/config.json +18 -4
- package/rules/common/C076_explicit_function_types/dart/analyzer.js +40 -0
- package/rules/common/C076_explicit_function_types/index.js +83 -0
- package/rules/index.js +26 -6
- package/rules/security/S003_open_redirect_protection/config.json +11 -53
- package/rules/security/S003_open_redirect_protection/dart/analyzer.js +43 -0
- package/rules/security/S003_open_redirect_protection/index.js +94 -0
- package/rules/security/S003_open_redirect_protection/typescript/analyzer.js +105 -0
- package/rules/security/S003_open_redirect_protection/{symbol-based-analyzer.js → typescript/semantic-analyzer.js} +1 -1
- package/rules/security/S004_sensitive_data_logging/config.json +1 -1
- package/rules/security/S004_sensitive_data_logging/dart/analyzer.js +58 -0
- package/rules/security/S004_sensitive_data_logging/index.js +93 -0
- package/rules/security/S005_no_origin_auth/dart/analyzer.js +30 -0
- package/rules/security/S005_no_origin_auth/index.js +83 -0
- package/rules/security/S005_no_origin_auth/{analyzer.js → typescript/analyzer.js} +1 -0
- package/rules/security/S006_no_plaintext_recovery_codes/dart/analyzer.js +30 -0
- package/rules/security/S006_no_plaintext_recovery_codes/index.js +83 -0
- package/rules/security/S007_no_plaintext_otp/dart/analyzer.js +30 -0
- package/rules/security/S007_no_plaintext_otp/index.js +83 -0
- package/rules/security/S009_no_insecure_encryption/dart/analyzer.js +30 -0
- package/rules/security/S009_no_insecure_encryption/index.js +83 -0
- package/rules/security/S010_no_insecure_encryption/dart/analyzer.js +30 -0
- package/rules/security/S010_no_insecure_encryption/index.js +83 -0
- package/rules/security/S011_secure_guid_generation/dart/analyzer.js +30 -0
- package/rules/security/S011_secure_guid_generation/index.js +83 -0
- package/rules/security/S012_hardcoded_secrets/dart/analyzer.js +30 -0
- package/rules/security/S012_hardcoded_secrets/index.js +83 -0
- package/rules/security/S012_hardcoded_secrets/typescript/config.json +75 -0
- package/rules/security/S013_tls_enforcement/dart/analyzer.js +30 -0
- package/rules/security/S013_tls_enforcement/index.js +83 -0
- package/rules/security/S014_tls_version_enforcement/dart/analyzer.js +30 -0
- package/rules/security/S014_tls_version_enforcement/index.js +83 -0
- package/rules/security/S015_insecure_tls_certificate/config.json +41 -0
- package/rules/security/S015_insecure_tls_certificate/dart/analyzer.js +19 -0
- package/rules/security/S015_insecure_tls_certificate/index.js +83 -0
- package/rules/security/S016_no_sensitive_querystring/dart/analyzer.js +30 -0
- package/rules/security/S016_no_sensitive_querystring/index.js +83 -0
- package/rules/security/S017_use_parameterized_queries/dart/analyzer.js +30 -0
- package/rules/security/S017_use_parameterized_queries/index.js +83 -0
- package/rules/security/S019_smtp_injection_protection/dart/analyzer.js +30 -0
- package/rules/security/S019_smtp_injection_protection/index.js +83 -0
- package/rules/security/S020_no_eval_dynamic_code/dart/analyzer.js +30 -0
- package/rules/security/S020_no_eval_dynamic_code/index.js +83 -0
- package/rules/security/S022_escape_output_context/dart/analyzer.js +30 -0
- package/rules/security/S022_escape_output_context/index.js +83 -0
- package/rules/security/S023_no_json_injection/dart/analyzer.js +30 -0
- package/rules/security/S023_no_json_injection/index.js +83 -0
- package/rules/security/S024_xpath_xxe_protection/dart/analyzer.js +30 -0
- package/rules/security/S024_xpath_xxe_protection/index.js +83 -0
- package/rules/security/S025_server_side_validation/dart/analyzer.js +30 -0
- package/rules/security/S025_server_side_validation/index.js +83 -0
- package/rules/security/S026_json_schema_validation/dart/analyzer.js +30 -0
- package/rules/security/S026_json_schema_validation/index.js +83 -0
- package/rules/security/S027_no_hardcoded_secrets/dart/analyzer.js +30 -0
- package/rules/security/S027_no_hardcoded_secrets/index.js +83 -0
- package/rules/security/S028_file_upload_size_limits/dart/analyzer.js +30 -0
- package/rules/security/S028_file_upload_size_limits/index.js +83 -0
- package/rules/security/S029_csrf_protection/dart/analyzer.js +30 -0
- package/rules/security/S029_csrf_protection/index.js +83 -0
- package/rules/security/S030_directory_browsing_protection/dart/analyzer.js +30 -0
- package/rules/security/S030_directory_browsing_protection/index.js +83 -0
- package/rules/security/S031_secure_session_cookies/dart/analyzer.js +30 -0
- package/rules/security/S031_secure_session_cookies/index.js +83 -0
- package/rules/security/S032_httponly_session_cookies/dart/analyzer.js +30 -0
- package/rules/security/S032_httponly_session_cookies/index.js +83 -0
- package/rules/security/S033_samesite_session_cookies/dart/analyzer.js +30 -0
- package/rules/security/S033_samesite_session_cookies/index.js +83 -0
- package/rules/security/S034_host_prefix_session_cookies/dart/analyzer.js +30 -0
- package/rules/security/S034_host_prefix_session_cookies/index.js +83 -0
- package/rules/security/S035_path_session_cookies/dart/analyzer.js +30 -0
- package/rules/security/S035_path_session_cookies/index.js +83 -0
- package/rules/security/S036_lfi_rfi_protection/dart/analyzer.js +30 -0
- package/rules/security/S036_lfi_rfi_protection/index.js +83 -0
- package/rules/security/S037_cache_headers/dart/analyzer.js +30 -0
- package/rules/security/S037_cache_headers/index.js +83 -0
- package/rules/security/S038_no_version_headers/dart/analyzer.js +30 -0
- package/rules/security/S038_no_version_headers/index.js +83 -0
- package/rules/security/S039_no_session_tokens_in_url/dart/analyzer.js +30 -0
- package/rules/security/S039_no_session_tokens_in_url/index.js +83 -0
- package/rules/security/S040_session_fixation_protection/dart/analyzer.js +30 -0
- package/rules/security/S040_session_fixation_protection/index.js +83 -0
- package/rules/security/S041_session_token_invalidation/dart/analyzer.js +30 -0
- package/rules/security/S041_session_token_invalidation/index.js +83 -0
- package/rules/security/S042_require_re_authentication_for_long_lived/dart/analyzer.js +30 -0
- package/rules/security/S042_require_re_authentication_for_long_lived/index.js +83 -0
- package/rules/security/S043_password_changes_invalidate_all_sessions/dart/analyzer.js +30 -0
- package/rules/security/S043_password_changes_invalidate_all_sessions/index.js +83 -0
- package/rules/security/S044_re_authentication_required/dart/analyzer.js +30 -0
- package/rules/security/S044_re_authentication_required/index.js +83 -0
- package/rules/security/S045_brute_force_protection/dart/analyzer.js +30 -0
- package/rules/security/S045_brute_force_protection/index.js +83 -0
- package/rules/security/S048_no_current_password_in_reset/dart/analyzer.js +30 -0
- package/rules/security/S048_no_current_password_in_reset/index.js +83 -0
- package/rules/security/S049_short_validity_tokens/dart/analyzer.js +30 -0
- package/rules/security/S049_short_validity_tokens/index.js +83 -0
- package/rules/security/S049_short_validity_tokens/typescript/config.json +124 -0
- package/rules/security/S051_password_length_policy/dart/analyzer.js +30 -0
- package/rules/security/S051_password_length_policy/index.js +83 -0
- package/rules/security/S051_password_length_policy/typescript/config.json +83 -0
- package/rules/security/S052_weak_otp_entropy/dart/analyzer.js +30 -0
- package/rules/security/S052_weak_otp_entropy/index.js +83 -0
- package/rules/security/S052_weak_otp_entropy/typescript/config.json +57 -0
- package/rules/security/S054_no_default_accounts/dart/analyzer.js +30 -0
- package/rules/security/S054_no_default_accounts/index.js +83 -0
- package/rules/security/S054_no_default_accounts/typescript/config.json +101 -0
- package/rules/security/S055_content_type_validation/dart/analyzer.js +30 -0
- package/rules/security/S055_content_type_validation/index.js +83 -0
- package/rules/security/S056_log_injection_protection/dart/analyzer.js +30 -0
- package/rules/security/S056_log_injection_protection/index.js +83 -0
- package/rules/security/S057_utc_logging/dart/analyzer.js +30 -0
- package/rules/security/S057_utc_logging/index.js +83 -0
- package/rules/security/S057_utc_logging/typescript/config.json +105 -0
- package/rules/security/S058_no_ssrf/dart/analyzer.js +30 -0
- package/rules/security/S058_no_ssrf/index.js +83 -0
- package/rules/security/S058_no_ssrf/{analyzer.js → typescript/analyzer.js} +0 -1
- package/rules/security/S058_no_ssrf/typescript/config.json +125 -0
- package/scripts/build-release.sh +12 -0
- package/scripts/copy-arch-detect.js +78 -0
- package/rules/common/C002_no_duplicate_code/test-cases/api-handlers.ts +0 -64
- package/rules/common/C002_no_duplicate_code/test-cases/data-processor.ts +0 -46
- package/rules/common/C002_no_duplicate_code/test-cases/good-example.tsx +0 -40
- package/rules/common/C002_no_duplicate_code/test-cases/product-service.ts +0 -57
- package/rules/common/C002_no_duplicate_code/test-cases/user-service.ts +0 -49
- package/rules/common/C067_no_hardcoded_config/symbol-based-analyzer.js.backup +0 -3853
- package/rules/security/S003_open_redirect_protection/analyzer.js +0 -135
- /package/rules/common/C002_no_duplicate_code/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C003_no_vague_abbreviations/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C006_function_naming/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/{C008 → C008_variable_declaration_locality}/config.json +0 -0
- /package/rules/common/{C008 → C008_variable_declaration_locality/typescript}/analyzer.js +0 -0
- /package/rules/common/{C008 → C008_variable_declaration_locality/typescript}/ts-morph-analyzer.js +0 -0
- /package/rules/common/C010_limit_block_nesting/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C010_limit_block_nesting/{regex-based-analyzer.js → typescript/regex-based-analyzer.js} +0 -0
- /package/rules/common/C010_limit_block_nesting/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/common/C012_command_query_separation/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C012_command_query_separation/{ast-analyzer.js → typescript/ast-analyzer.js} +0 -0
- /package/rules/common/C013_no_dead_code/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C013_no_dead_code/{regex-based-analyzer.js → typescript/regex-based-analyzer.js} +0 -0
- /package/rules/common/C013_no_dead_code/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/common/C014_dependency_injection/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C014_dependency_injection/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/common/C017_constructor_logic/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C017_constructor_logic/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/common/C018_no_throw_generic_error/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C018_no_throw_generic_error/{regex-based-analyzer.js → typescript/regex-based-analyzer.js} +0 -0
- /package/rules/common/C018_no_throw_generic_error/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/common/C019_log_level_usage/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C019_log_level_usage/{pattern-analyzer.js → typescript/pattern-analyzer.js} +0 -0
- /package/rules/common/C019_log_level_usage/{system-log-analyzer.js → typescript/system-log-analyzer.js} +0 -0
- /package/rules/common/C020_unused_imports/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C021_import_organization/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C023_no_duplicate_variable/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C023_no_duplicate_variable/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/common/C024_no_scatter_hardcoded_constants/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C029_catch_block_logging/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C030_use_custom_error_classes/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C031_validation_separation/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C033_separate_service_repository/{README.md → typescript/README.md} +0 -0
- /package/rules/common/C033_separate_service_repository/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C033_separate_service_repository/{regex-based-analyzer.js → typescript/regex-based-analyzer.js} +0 -0
- /package/rules/common/C033_separate_service_repository/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/common/C035_error_logging_context/{STRATEGY.md → typescript/STRATEGY.md} +0 -0
- /package/rules/common/C035_error_logging_context/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C035_error_logging_context/{regex-based-analyzer.js → typescript/regex-based-analyzer.js} +0 -0
- /package/rules/common/C035_error_logging_context/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/common/C040_centralized_validation/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C040_centralized_validation/{regex-based-analyzer.js → typescript/regex-based-analyzer.js} +0 -0
- /package/rules/common/C040_centralized_validation/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/common/C041_no_sensitive_hardcode/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C041_no_sensitive_hardcode/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/common/C042_boolean_name_prefix/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C043_no_console_or_print/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C047_no_duplicate_retry_logic/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C047_no_duplicate_retry_logic/{c047-semantic-rule.js → typescript/c047-semantic-rule.js} +0 -0
- /package/rules/common/C047_no_duplicate_retry_logic/{symbol-analyzer-enhanced.js → typescript/symbol-analyzer-enhanced.js} +0 -0
- /package/rules/common/C047_no_duplicate_retry_logic/{symbol-config.json → typescript/symbol-config.json} +0 -0
- /package/rules/common/C048_no_bypass_architectural_layers/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C048_no_bypass_architectural_layers/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/common/C052_parsing_or_data_transformation/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C052_parsing_or_data_transformation/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/common/C060_no_override_superclass/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C060_no_override_superclass/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/common/C065_one_behavior_per_test/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C067_no_hardcoded_config/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C067_no_hardcoded_config/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/common/C070_no_real_time_tests/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C070_no_real_time_tests/{regex-analyzer.js → typescript/regex-analyzer.js} +0 -0
- /package/rules/common/C072_single_test_behavior/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C073_validate_required_config_on_startup/{README.md → typescript/README.md} +0 -0
- /package/rules/common/C073_validate_required_config_on_startup/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/common/C075_explicit_return_types/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C076_explicit_function_types/{README.md → typescript/README.md} +0 -0
- /package/rules/common/C076_explicit_function_types/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C076_explicit_function_types/{semantic-analyzer.js → typescript/semantic-analyzer.js} +0 -0
- /package/rules/security/S003_open_redirect_protection/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S004_sensitive_data_logging/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S004_sensitive_data_logging/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S005_no_origin_auth/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S005_no_origin_auth/{ast-analyzer.js → typescript/ast-analyzer.js} +0 -0
- /package/rules/security/S005_no_origin_auth/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S006_no_plaintext_recovery_codes/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S006_no_plaintext_recovery_codes/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S006_no_plaintext_recovery_codes/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S007_no_plaintext_otp/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S007_no_plaintext_otp/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S007_no_plaintext_otp/{semantic-analyzer.js → typescript/semantic-analyzer.js} +0 -0
- /package/rules/security/S007_no_plaintext_otp/{semantic-config.json → typescript/semantic-config.json} +0 -0
- /package/rules/security/S007_no_plaintext_otp/{semantic-wrapper.js → typescript/semantic-wrapper.js} +0 -0
- /package/rules/security/S009_no_insecure_encryption/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S009_no_insecure_encryption/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S010_no_insecure_encryption/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S010_no_insecure_encryption/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S011_secure_guid_generation/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S011_secure_guid_generation/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S011_secure_guid_generation/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S012_hardcoded_secrets/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S012_hardcoded_secrets/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S013_tls_enforcement/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S013_tls_enforcement/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S013_tls_enforcement/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S014_tls_version_enforcement/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S014_tls_version_enforcement/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S014_tls_version_enforcement/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S015_insecure_tls_certificate/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S015_insecure_tls_certificate/{ast-analyzer.js → typescript/ast-analyzer.js} +0 -0
- /package/rules/security/S016_no_sensitive_querystring/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S016_no_sensitive_querystring/{regex-based-analyzer.js → typescript/regex-based-analyzer.js} +0 -0
- /package/rules/security/S016_no_sensitive_querystring/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S017_use_parameterized_queries/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S017_use_parameterized_queries/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S017_use_parameterized_queries/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S019_smtp_injection_protection/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S019_smtp_injection_protection/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S020_no_eval_dynamic_code/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S020_no_eval_dynamic_code/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S020_no_eval_dynamic_code/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S022_escape_output_context/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S022_escape_output_context/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S023_no_json_injection/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S023_no_json_injection/{ast-analyzer.js → typescript/ast-analyzer.js} +0 -0
- /package/rules/security/S024_xpath_xxe_protection/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S024_xpath_xxe_protection/{regex-based-analyzer.js → typescript/regex-based-analyzer.js} +0 -0
- /package/rules/security/S024_xpath_xxe_protection/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S025_server_side_validation/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S025_server_side_validation/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S025_server_side_validation/{regex-based-analyzer.js → typescript/regex-based-analyzer.js} +0 -0
- /package/rules/security/S025_server_side_validation/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S026_json_schema_validation/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S027_no_hardcoded_secrets/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S027_no_hardcoded_secrets/{categories.json → typescript/categories.json} +0 -0
- /package/rules/security/S027_no_hardcoded_secrets/{categorized-analyzer.js → typescript/categorized-analyzer.js} +0 -0
- /package/rules/security/S028_file_upload_size_limits/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S028_file_upload_size_limits/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S028_file_upload_size_limits/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S029_csrf_protection/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S030_directory_browsing_protection/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S030_directory_browsing_protection/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S030_directory_browsing_protection/{regex-based-analyzer.js → typescript/regex-based-analyzer.js} +0 -0
- /package/rules/security/S030_directory_browsing_protection/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S031_secure_session_cookies/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S031_secure_session_cookies/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S031_secure_session_cookies/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S032_httponly_session_cookies/{FRAMEWORK_SUPPORT.md → typescript/FRAMEWORK_SUPPORT.md} +0 -0
- /package/rules/security/S032_httponly_session_cookies/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S032_httponly_session_cookies/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S032_httponly_session_cookies/{regex-based-analyzer.js → typescript/regex-based-analyzer.js} +0 -0
- /package/rules/security/S032_httponly_session_cookies/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S033_samesite_session_cookies/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S033_samesite_session_cookies/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S033_samesite_session_cookies/{regex-based-analyzer.js → typescript/regex-based-analyzer.js} +0 -0
- /package/rules/security/S033_samesite_session_cookies/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S034_host_prefix_session_cookies/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S034_host_prefix_session_cookies/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S034_host_prefix_session_cookies/{regex-based-analyzer.js → typescript/regex-based-analyzer.js} +0 -0
- /package/rules/security/S034_host_prefix_session_cookies/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S035_path_session_cookies/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S035_path_session_cookies/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S035_path_session_cookies/{regex-based-analyzer.js → typescript/regex-based-analyzer.js} +0 -0
- /package/rules/security/S035_path_session_cookies/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S036_lfi_rfi_protection/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S037_cache_headers/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S037_cache_headers/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S037_cache_headers/{regex-based-analyzer.js → typescript/regex-based-analyzer.js} +0 -0
- /package/rules/security/S037_cache_headers/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S038_no_version_headers/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S038_no_version_headers/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S038_no_version_headers/{regex-based-analyzer.js → typescript/regex-based-analyzer.js} +0 -0
- /package/rules/security/S038_no_version_headers/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S039_no_session_tokens_in_url/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S039_no_session_tokens_in_url/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S039_no_session_tokens_in_url/{regex-based-analyzer.js → typescript/regex-based-analyzer.js} +0 -0
- /package/rules/security/S039_no_session_tokens_in_url/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S040_session_fixation_protection/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S041_session_token_invalidation/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S041_session_token_invalidation/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S041_session_token_invalidation/{regex-based-analyzer.js → typescript/regex-based-analyzer.js} +0 -0
- /package/rules/security/S041_session_token_invalidation/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S042_require_re_authentication_for_long_lived/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S042_require_re_authentication_for_long_lived/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S042_require_re_authentication_for_long_lived/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S043_password_changes_invalidate_all_sessions/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S043_password_changes_invalidate_all_sessions/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S043_password_changes_invalidate_all_sessions/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S044_re_authentication_required/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S044_re_authentication_required/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S044_re_authentication_required/{regex-based-analyzer.js → typescript/regex-based-analyzer.js} +0 -0
- /package/rules/security/S044_re_authentication_required/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S045_brute_force_protection/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S045_brute_force_protection/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S045_brute_force_protection/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S048_no_current_password_in_reset/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S048_no_current_password_in_reset/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S049_short_validity_tokens/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S049_short_validity_tokens/{regex-based-analyzer.js → typescript/regex-based-analyzer.js} +0 -0
- /package/rules/security/S049_short_validity_tokens/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S051_password_length_policy/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S052_weak_otp_entropy/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S054_no_default_accounts/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S054_no_default_accounts/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S055_content_type_validation/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S055_content_type_validation/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S055_content_type_validation/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S056_log_injection_protection/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S056_log_injection_protection/{regex-based-analyzer.js → typescript/regex-based-analyzer.js} +0 -0
- /package/rules/security/S056_log_injection_protection/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S057_utc_logging/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S057_utc_logging/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S058_no_ssrf/{README.md → typescript/README.md} +0 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
{
|
|
2
|
+
"ruleId": "S058",
|
|
3
|
+
"name": "No SSRF (Server-Side Request Forgery)",
|
|
4
|
+
"description": "Prevent SSRF attacks by validating URLs from user input before making HTTP requests",
|
|
5
|
+
"category": "security",
|
|
6
|
+
"severity": "error",
|
|
7
|
+
"options": {
|
|
8
|
+
"httpClientPatterns": [
|
|
9
|
+
"fetch\\s*\\(",
|
|
10
|
+
"axios\\.(?:get|post|put|delete|patch|request)\\s*\\(",
|
|
11
|
+
"http\\.(?:get|post|put|delete|patch|request)\\s*\\(",
|
|
12
|
+
"https\\.(?:get|post|put|delete|patch|request)\\s*\\(",
|
|
13
|
+
"(?:^|\\s|=|\\()request\\s*\\(",
|
|
14
|
+
"got\\s*\\(",
|
|
15
|
+
"superagent\\.",
|
|
16
|
+
"needle\\.",
|
|
17
|
+
"bent\\(",
|
|
18
|
+
"node-fetch\\s*\\(",
|
|
19
|
+
"isomorphic-fetch\\s*\\(",
|
|
20
|
+
"ky\\s*\\(",
|
|
21
|
+
"httpClient\\.",
|
|
22
|
+
"\\.httpClient\\."
|
|
23
|
+
],
|
|
24
|
+
"userInputSources": [
|
|
25
|
+
"req\\.body",
|
|
26
|
+
"req\\.query",
|
|
27
|
+
"req\\.params",
|
|
28
|
+
"request\\.body",
|
|
29
|
+
"request\\.query",
|
|
30
|
+
"request\\.params",
|
|
31
|
+
"ctx\\.request\\.body",
|
|
32
|
+
"ctx\\.query",
|
|
33
|
+
"ctx\\.params",
|
|
34
|
+
"event\\.body",
|
|
35
|
+
"event\\.queryStringParameters",
|
|
36
|
+
"event\\.pathParameters",
|
|
37
|
+
"\\.query\\.",
|
|
38
|
+
"\\.body\\.",
|
|
39
|
+
"\\.params\\.",
|
|
40
|
+
"process\\.argv",
|
|
41
|
+
"process\\.env\\.",
|
|
42
|
+
"from.*request",
|
|
43
|
+
"from.*input",
|
|
44
|
+
"user.*input",
|
|
45
|
+
"client.*data",
|
|
46
|
+
"external.*data"
|
|
47
|
+
],
|
|
48
|
+
"dangerousProtocols": [
|
|
49
|
+
"file://",
|
|
50
|
+
"ftp://",
|
|
51
|
+
"sftp://",
|
|
52
|
+
"ldap://",
|
|
53
|
+
"ldaps://",
|
|
54
|
+
"dict://",
|
|
55
|
+
"gopher://",
|
|
56
|
+
"jar://",
|
|
57
|
+
"netdoc://",
|
|
58
|
+
"mailto:",
|
|
59
|
+
"news:",
|
|
60
|
+
"imap://",
|
|
61
|
+
"pop3://",
|
|
62
|
+
"smb://",
|
|
63
|
+
"afp://",
|
|
64
|
+
"telnet://",
|
|
65
|
+
"ssh://"
|
|
66
|
+
],
|
|
67
|
+
"blockedIPs": [
|
|
68
|
+
"127\\.0\\.0\\.1",
|
|
69
|
+
"::1",
|
|
70
|
+
"localhost",
|
|
71
|
+
"169\\.254\\.169\\.254",
|
|
72
|
+
"metadata\\.google\\.internal",
|
|
73
|
+
"169\\.254\\.",
|
|
74
|
+
"10\\.",
|
|
75
|
+
"172\\.(1[6-9]|2[0-9]|3[01])\\.",
|
|
76
|
+
"192\\.168\\."
|
|
77
|
+
],
|
|
78
|
+
"blockedPorts": [
|
|
79
|
+
"22",
|
|
80
|
+
"23",
|
|
81
|
+
"25",
|
|
82
|
+
"53",
|
|
83
|
+
"135",
|
|
84
|
+
"139",
|
|
85
|
+
"445",
|
|
86
|
+
"1433",
|
|
87
|
+
"1521",
|
|
88
|
+
"3306",
|
|
89
|
+
"3389",
|
|
90
|
+
"5432",
|
|
91
|
+
"5984",
|
|
92
|
+
"6379",
|
|
93
|
+
"8080",
|
|
94
|
+
"9200",
|
|
95
|
+
"11211",
|
|
96
|
+
"27017",
|
|
97
|
+
"50070"
|
|
98
|
+
],
|
|
99
|
+
"allowedDomains": [
|
|
100
|
+
"api\\.trusted-service\\.com",
|
|
101
|
+
"service\\.company\\.com"
|
|
102
|
+
],
|
|
103
|
+
"validationFunctions": [
|
|
104
|
+
"validateUrl",
|
|
105
|
+
"validateUrlAllowList",
|
|
106
|
+
"checkAllowedUrl",
|
|
107
|
+
"isAllowedUrl",
|
|
108
|
+
"sanitizeUrl",
|
|
109
|
+
"verifyUrl",
|
|
110
|
+
"urlValidator"
|
|
111
|
+
],
|
|
112
|
+
"policy": {
|
|
113
|
+
"requireExplicitValidation": true,
|
|
114
|
+
"enforceAllowList": true,
|
|
115
|
+
"blockPrivateIPs": true,
|
|
116
|
+
"checkProtocols": true,
|
|
117
|
+
"requireHttpsOnly": false,
|
|
118
|
+
"maxRedirects": 0
|
|
119
|
+
},
|
|
120
|
+
"thresholds": {
|
|
121
|
+
"maxSuspiciousUrls": 3,
|
|
122
|
+
"maxUnvalidatedRequests": 1
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
package/scripts/build-release.sh
CHANGED
|
@@ -46,6 +46,17 @@ node cli.js --security --typescript --input=core/ || {
|
|
|
46
46
|
echo "⚠️ Security issues detected, but continuing with release..."
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
# Copy released-rules.json from pages to config
|
|
50
|
+
echo "📋 Copying released-rules.json..."
|
|
51
|
+
RELEASED_RULES_SRC="../../pages/scripts/released-rules.json"
|
|
52
|
+
RELEASED_RULES_DEST="config/released-rules.json"
|
|
53
|
+
if [ -f "$RELEASED_RULES_SRC" ]; then
|
|
54
|
+
cp "$RELEASED_RULES_SRC" "$RELEASED_RULES_DEST"
|
|
55
|
+
echo "✅ Copied released-rules.json to config/"
|
|
56
|
+
else
|
|
57
|
+
echo "⚠️ released-rules.json not found at $RELEASED_RULES_SRC"
|
|
58
|
+
fi
|
|
59
|
+
|
|
49
60
|
# Verify critical files exist
|
|
50
61
|
echo "📁 Verifying critical files..."
|
|
51
62
|
CRITICAL_FILES=(
|
|
@@ -54,6 +65,7 @@ CRITICAL_FILES=(
|
|
|
54
65
|
"README.md"
|
|
55
66
|
"CHANGELOG.md"
|
|
56
67
|
"config/rules/rules-registry.json"
|
|
68
|
+
"config/released-rules.json"
|
|
57
69
|
"core/cli-program.js"
|
|
58
70
|
"core/cli-action-handler.js"
|
|
59
71
|
"core/typescript-engine.js"
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copy architecture-detection dist to engines/arch-detect
|
|
3
|
+
* This script is run during build to bundle architecture detection
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
const fs = require('fs');
|
|
7
|
+
const path = require('path');
|
|
8
|
+
|
|
9
|
+
const SOURCE = path.resolve(__dirname, '../../../../architecture-detection/dist');
|
|
10
|
+
const DEST = path.resolve(__dirname, '../engines/arch-detect');
|
|
11
|
+
|
|
12
|
+
function copyDir(src, dest) {
|
|
13
|
+
if (!fs.existsSync(src)) {
|
|
14
|
+
console.log('⚠️ architecture-detection/dist not found. Run "npm run build" in architecture-detection first.');
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Clean destination
|
|
19
|
+
if (fs.existsSync(dest)) {
|
|
20
|
+
fs.rmSync(dest, { recursive: true });
|
|
21
|
+
}
|
|
22
|
+
fs.mkdirSync(dest, { recursive: true });
|
|
23
|
+
|
|
24
|
+
// Copy files recursively
|
|
25
|
+
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
26
|
+
|
|
27
|
+
for (const entry of entries) {
|
|
28
|
+
const srcPath = path.join(src, entry.name);
|
|
29
|
+
const destPath = path.join(dest, entry.name);
|
|
30
|
+
|
|
31
|
+
// Skip source maps and declaration files
|
|
32
|
+
if (entry.name.endsWith('.map') || entry.name.endsWith('.d.ts')) {
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Skip CLI and LLM folders
|
|
37
|
+
if (entry.name === 'cli.js' || entry.name === 'llm' || entry.name === 'llm-primary') {
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (entry.isDirectory()) {
|
|
42
|
+
copyDir(srcPath, destPath);
|
|
43
|
+
} else {
|
|
44
|
+
fs.copyFileSync(srcPath, destPath);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
console.log('📦 Copying architecture-detection...');
|
|
52
|
+
|
|
53
|
+
if (copyDir(SOURCE, DEST)) {
|
|
54
|
+
const size = getTotalSize(DEST);
|
|
55
|
+
console.log(`✅ Copied to engines/arch-detect (${formatSize(size)})`);
|
|
56
|
+
} else {
|
|
57
|
+
console.log('⚠️ Skipped architecture-detection copy');
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function getTotalSize(dir) {
|
|
61
|
+
let size = 0;
|
|
62
|
+
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
63
|
+
for (const entry of entries) {
|
|
64
|
+
const fullPath = path.join(dir, entry.name);
|
|
65
|
+
if (entry.isDirectory()) {
|
|
66
|
+
size += getTotalSize(fullPath);
|
|
67
|
+
} else {
|
|
68
|
+
size += fs.statSync(fullPath).size;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return size;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function formatSize(bytes) {
|
|
75
|
+
if (bytes < 1024) return bytes + ' B';
|
|
76
|
+
if (bytes < 1024 * 1024) return (bytes / 1024).toFixed(1) + ' KB';
|
|
77
|
+
return (bytes / (1024 * 1024)).toFixed(1) + ' MB';
|
|
78
|
+
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
// ❌ VIOLATION: Monkey coding - Copy-paste error handling
|
|
2
|
-
|
|
3
|
-
export class ApiHandlers {
|
|
4
|
-
// Get user by ID with error handling
|
|
5
|
-
async getUserById(id: number) {
|
|
6
|
-
try {
|
|
7
|
-
const response = await fetch(`/api/users/${id}`);
|
|
8
|
-
|
|
9
|
-
if (!response.ok) {
|
|
10
|
-
const error = await response.json();
|
|
11
|
-
console.error('Error fetching user:', error);
|
|
12
|
-
throw new Error(error.message || 'Failed to fetch user');
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const data = await response.json();
|
|
16
|
-
return data;
|
|
17
|
-
|
|
18
|
-
} catch (error) {
|
|
19
|
-
console.error('Network error:', error);
|
|
20
|
-
throw new Error('Network request failed');
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// Get product by ID - SAME error handling!
|
|
25
|
-
async getProductById(id: number) {
|
|
26
|
-
// DUPLICATE: Same try-catch, error handling pattern (monkey coding!)
|
|
27
|
-
try {
|
|
28
|
-
const response = await fetch(`/api/products/${id}`);
|
|
29
|
-
|
|
30
|
-
if (!response.ok) {
|
|
31
|
-
const error = await response.json();
|
|
32
|
-
console.error('Error fetching product:', error);
|
|
33
|
-
throw new Error(error.message || 'Failed to fetch product');
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const data = await response.json();
|
|
37
|
-
return data;
|
|
38
|
-
|
|
39
|
-
} catch (error) {
|
|
40
|
-
console.error('Network error:', error);
|
|
41
|
-
throw new Error('Network request failed');
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// Get order by ID - same pattern
|
|
46
|
-
async getOrderById(id: number) {
|
|
47
|
-
try {
|
|
48
|
-
const response = await fetch(`/api/orders/${id}`);
|
|
49
|
-
|
|
50
|
-
if (!response.ok) {
|
|
51
|
-
const error = await response.json();
|
|
52
|
-
console.error('Error fetching order:', error);
|
|
53
|
-
throw new Error(error.message || 'Failed to fetch order');
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const data = await response.json();
|
|
57
|
-
return data;
|
|
58
|
-
|
|
59
|
-
} catch (error) {
|
|
60
|
-
console.error('Network error:', error);
|
|
61
|
-
throw new Error('Network request failed');
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
// ❌ VIOLATION: Monkey coding - Copy-paste data transformation
|
|
2
|
-
|
|
3
|
-
export class DataProcessor {
|
|
4
|
-
// Process user data from API
|
|
5
|
-
processUserData(rawData: any[]) {
|
|
6
|
-
return rawData
|
|
7
|
-
.filter(item => item !== null && item !== undefined)
|
|
8
|
-
.map(item => ({
|
|
9
|
-
id: item.id,
|
|
10
|
-
name: item.name?.trim() || 'Unknown',
|
|
11
|
-
email: item.email?.toLowerCase() || '',
|
|
12
|
-
status: item.active ? 'active' : 'inactive',
|
|
13
|
-
createdAt: new Date(item.created_at)
|
|
14
|
-
}))
|
|
15
|
-
.sort((a, b) => a.name.localeCompare(b.name));
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
// Process product data from API - SAME transformation logic!
|
|
19
|
-
processProductData(rawData: any[]) {
|
|
20
|
-
// DUPLICATE: Same filtering, mapping, sorting pattern (monkey coding!)
|
|
21
|
-
return rawData
|
|
22
|
-
.filter(item => item !== null && item !== undefined)
|
|
23
|
-
.map(item => ({
|
|
24
|
-
id: item.id,
|
|
25
|
-
name: item.name?.trim() || 'Unknown',
|
|
26
|
-
price: item.price || 0,
|
|
27
|
-
status: item.available ? 'active' : 'inactive',
|
|
28
|
-
createdAt: new Date(item.created_at)
|
|
29
|
-
}))
|
|
30
|
-
.sort((a, b) => a.name.localeCompare(b.name));
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// Process order data - same pattern again
|
|
34
|
-
processOrderData(rawData: any[]) {
|
|
35
|
-
return rawData
|
|
36
|
-
.filter(item => item !== null && item !== undefined)
|
|
37
|
-
.map(item => ({
|
|
38
|
-
id: item.id,
|
|
39
|
-
customer: item.customer_name?.trim() || 'Unknown',
|
|
40
|
-
total: item.total_amount || 0,
|
|
41
|
-
status: item.paid ? 'active' : 'inactive',
|
|
42
|
-
createdAt: new Date(item.order_date)
|
|
43
|
-
}))
|
|
44
|
-
.sort((a, b) => a.customer.localeCompare(b.customer));
|
|
45
|
-
}
|
|
46
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
// ✅ GOOD: No violation - These are intentional patterns (different names, simple wrappers)
|
|
2
|
-
|
|
3
|
-
import React from 'react';
|
|
4
|
-
|
|
5
|
-
// Different button variants - intentional pattern, not duplicate
|
|
6
|
-
export function PrimaryButton({ className, ...props }: React.ComponentProps<'button'>) {
|
|
7
|
-
return (
|
|
8
|
-
<button
|
|
9
|
-
className={`btn-primary ${className}`}
|
|
10
|
-
{...props}
|
|
11
|
-
/>
|
|
12
|
-
);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function SecondaryButton({ className, ...props }: React.ComponentProps<'button'>) {
|
|
16
|
-
return (
|
|
17
|
-
<button
|
|
18
|
-
className={`btn-secondary ${className}`}
|
|
19
|
-
{...props}
|
|
20
|
-
/>
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export function DangerButton({ className, ...props }: React.ComponentProps<'button'>) {
|
|
25
|
-
return (
|
|
26
|
-
<button
|
|
27
|
-
className={`btn-danger ${className}`}
|
|
28
|
-
{...props}
|
|
29
|
-
/>
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// Short functions - below minimum lines
|
|
34
|
-
export function add(a: number, b: number) {
|
|
35
|
-
return a + b;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export function subtract(a: number, b: number) {
|
|
39
|
-
return a - b;
|
|
40
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
// ❌ VIOLATION: Monkey coding - Copy-paste calculation logic
|
|
2
|
-
|
|
3
|
-
export class ProductService {
|
|
4
|
-
// Calculate price with tax for online orders
|
|
5
|
-
calculateOnlinePrice(price: number, quantity: number) {
|
|
6
|
-
const subtotal = price * quantity;
|
|
7
|
-
const tax = subtotal * 0.1; // 10% tax
|
|
8
|
-
const shipping = subtotal > 100 ? 0 : 10; // Free shipping over $100
|
|
9
|
-
const discount = subtotal > 200 ? subtotal * 0.05 : 0; // 5% discount over $200
|
|
10
|
-
const total = subtotal + tax + shipping - discount;
|
|
11
|
-
|
|
12
|
-
return {
|
|
13
|
-
subtotal,
|
|
14
|
-
tax,
|
|
15
|
-
shipping,
|
|
16
|
-
discount,
|
|
17
|
-
total
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
// Calculate price with tax for store orders - SAME calculation!
|
|
22
|
-
calculateStorePrice(price: number, quantity: number) {
|
|
23
|
-
// DUPLICATE: Exactly same calculation logic (monkey coding!)
|
|
24
|
-
const subtotal = price * quantity;
|
|
25
|
-
const tax = subtotal * 0.1; // 10% tax
|
|
26
|
-
const shipping = subtotal > 100 ? 0 : 10; // Free shipping over $100
|
|
27
|
-
const discount = subtotal > 200 ? subtotal * 0.05 : 0; // 5% discount over $200
|
|
28
|
-
const total = subtotal + tax + shipping - discount;
|
|
29
|
-
|
|
30
|
-
return {
|
|
31
|
-
subtotal,
|
|
32
|
-
tax,
|
|
33
|
-
shipping,
|
|
34
|
-
discount,
|
|
35
|
-
total
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// Wholesale pricing - slightly different but still copy-paste
|
|
40
|
-
calculateWholesalePrice(price: number, quantity: number) {
|
|
41
|
-
const subtotal = price * quantity;
|
|
42
|
-
const tax = subtotal * 0.1; // 10% tax
|
|
43
|
-
const shipping = subtotal > 100 ? 0 : 10; // Free shipping over $100
|
|
44
|
-
const discount = subtotal > 200 ? subtotal * 0.05 : 0; // 5% discount over $200
|
|
45
|
-
const wholesaleDiscount = quantity > 50 ? subtotal * 0.1 : 0; // Extra 10% for bulk
|
|
46
|
-
const total = subtotal + tax + shipping - discount - wholesaleDiscount;
|
|
47
|
-
|
|
48
|
-
return {
|
|
49
|
-
subtotal,
|
|
50
|
-
tax,
|
|
51
|
-
shipping,
|
|
52
|
-
discount,
|
|
53
|
-
wholesaleDiscount,
|
|
54
|
-
total
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
// ❌ VIOLATION: Monkey coding - Copy-paste entire functions
|
|
2
|
-
|
|
3
|
-
export class UserService {
|
|
4
|
-
// Function 1: Process user payment
|
|
5
|
-
async processUserPayment(userId: number, amount: number) {
|
|
6
|
-
const user = await this.getUserData(userId);
|
|
7
|
-
|
|
8
|
-
if (amount <= 0) {
|
|
9
|
-
throw new Error('Invalid payment amount');
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const fee = amount * 0.029 + 0.30; // Stripe fee
|
|
13
|
-
const total = amount + fee;
|
|
14
|
-
|
|
15
|
-
const result = await this.chargeCard(user.cardId, total);
|
|
16
|
-
|
|
17
|
-
if (!result.success) {
|
|
18
|
-
throw new Error('Payment failed');
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
await this.recordTransaction(userId, total, 'payment');
|
|
22
|
-
return { success: true, transactionId: result.id };
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// Function 2: Process user refund - EXACT COPY-PASTE!
|
|
26
|
-
async processUserRefund(userId: number, amount: number) {
|
|
27
|
-
const user = await this.getUserData(userId);
|
|
28
|
-
|
|
29
|
-
if (amount <= 0) {
|
|
30
|
-
throw new Error('Invalid payment amount');
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const fee = amount * 0.029 + 0.30; // Stripe fee
|
|
34
|
-
const total = amount + fee;
|
|
35
|
-
|
|
36
|
-
const result = await this.chargeCard(user.cardId, total);
|
|
37
|
-
|
|
38
|
-
if (!result.success) {
|
|
39
|
-
throw new Error('Payment failed');
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
await this.recordTransaction(userId, total, 'payment');
|
|
43
|
-
return { success: true, transactionId: result.id };
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
private async getUserData(userId: number) { return {}; }
|
|
47
|
-
private async chargeCard(cardId: string, amount: number) { return { success: true, id: '123' }; }
|
|
48
|
-
private async recordTransaction(userId: number, amount: number, type: string) { }
|
|
49
|
-
}
|