Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 20 additions & 30 deletions detectors/express_detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -923,16 +923,6 @@ def _is_express_file(self, content: str) -> bool:
if re.search(indicator, content, re.IGNORECASE | re.MULTILINE):
return True

# Check for modern Express patterns
for pattern in self.modern_patterns:
if re.search(pattern, content, re.IGNORECASE | re.MULTILINE):
return True

# Check for proxy and gateway patterns (common in microservices)
for pattern in self.proxy_patterns:
if re.search(pattern, content, re.IGNORECASE | re.MULTILINE):
return True

# Enhanced content-based detection
express_keywords = [
'express', 'router', 'middleware', 'app.listen',
Expand Down Expand Up @@ -962,8 +952,8 @@ def can_handle_file(self, file_path: str, content: str) -> bool:
r'\.test\.(js|ts|jsx|tsx)$',
r'\.spec\.(js|ts|jsx|tsx)$',
r'__tests__/',
r'tests?/',
r'test/',
r'/tests?/',
r'/test/',

# Build and config files
r'webpack\.config\.(js|ts)$',
Expand All @@ -981,25 +971,25 @@ def can_handle_file(self, file_path: str, content: str) -> bool:
# Documentation
r'README\.(md|txt)$',
r'\.md$',
r'docs?/',
r'documentation/',
r'/docs?/',
r'/documentation/',

# Build outputs and dependencies
r'node_modules/',
r'dist/',
r'build/',
r'coverage/',
r'/node_modules/',
r'/dist/',
r'/build/',
r'/coverage/',
r'\.nyc_output/',
r'\.cache/',

# Scripts and utilities
r'scripts?/k6/',
r'scripts?/build/',
r'scripts?/deploy/',
r'utils?/',
r'helpers/',
r'lib/',
r'common/',
r'/scripts?/k6/',
r'/scripts?/build/',
r'/scripts?/deploy/',
r'/utils?/',
r'/helpers/',
r'/lib/',
r'/common/',

# Service and utility files (CRITICAL: prevents auth.service.js false positives)
r'\.service\.(js|ts)$',
Expand All @@ -1014,14 +1004,14 @@ def can_handle_file(self, file_path: str, content: str) -> bool:
r'\.decorator\.(js|ts)$',

# Migration and seed files
r'migrations?/',
r'seeds?/',
r'seeders/',
r'/migrations?/',
r'/seeds?/',
r'/seeders/',

# Type definitions
r'\.d\.(ts|js)$',
r'types?/',
r'@types/',
r'/types?/',
r'/@types/',

# Generated files
r'\.generated\.(js|ts)$',
Expand Down
9 changes: 8 additions & 1 deletion endpointhawk_core/endpointhawk.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

import click
from rich.console import Console
from rich.progress import Progress, SpinnerColumn, TextColumn
from rich.progress import Progress, SpinnerColumn, TextColumn, BarColumn, TimeElapsedColumn
from rich.table import Table
from rich.panel import Panel
from rich import print as rprint
Expand Down Expand Up @@ -75,6 +75,13 @@ def __init__(self, config: ScanConfig, config_manager = None):
self.logger = self._setup_logging()
self.config_manager = config_manager

# Handle auto-detection if frameworks list is empty
if not self.config.frameworks:
self.logger.info("No frameworks specified, auto-detecting...")
auto_detected = auto_detect_frameworks(self.config.repo_path)
self.config.frameworks = auto_detected if auto_detected else [Framework.EXPRESS] # Default fallback
self.logger.info(f"Auto-detected frameworks: {self.config.frameworks}")

# Initialize detectors
self.detectors = self._initialize_detectors()

Expand Down