Skip to content

Add performance for web security analysis#20

Merged
dinexh merged 1 commit intomainfrom
Enhancement/core
Jan 21, 2026
Merged

Add performance for web security analysis#20
dinexh merged 1 commit intomainfrom
Enhancement/core

Conversation

@dinexh
Copy link
Owner

@dinexh dinexh commented Jan 21, 2026

This pull request introduces major performance optimizations and flexibility improvements to the web security analysis workflow. The backend now supports parallel execution of independent checks using ThreadPoolExecutor, significantly reducing analysis time. Optional expensive checks (port scanning and metadata extraction) are now configurable, with defaults set for faster responses. The API, core logic, and frontend have all been updated to support these changes, and a new performance test script is included.

Backend Performance Optimization and Flexibility:

  • Refactored analyze_web_security in core/scanners/web.py to perform all independent checks concurrently using ThreadPoolExecutor, reducing analysis time from 60+ seconds to 5-10 seconds. Port scanning and metadata extraction are now optional and only performed if requested. [1] [2]
  • Updated port scanning logic to scan only essential ports by default, with an option for a full scan. Port checks are now performed in parallel for additional speedup. [1] [2]
  • Reduced timeouts for network operations throughout core/scanners/web.py to improve responsiveness. [1] [2] [3] [4] [5]
  • Added LRU caching to get_server_location to avoid redundant IP geolocation requests.

API and Documentation Updates:

  • Enhanced /api/analyze-url endpoint in api/server.py to accept optional parameters for port scanning and metadata extraction, with clear documentation and performance notes. Also supports a full query parameter to enable all checks. [1] [2]

Frontend and API Client Adaptation:

  • Updated analyzeUrl function in web/src/lib/api.ts to accept options for port scanning and metadata extraction, defaulting to UI-appropriate values.
  • Fixed a minor bug in UrlAnalyzer.tsx to handle cases where open_ports may be undefined.

Testing and Validation:

  • Added test_performance.py, a script to benchmark the optimized analysis process and summarize performance improvements.

`analyze_web_security` function.
- The script tests both basic and full analysis modes, measuring execution time and reporting results.
- Updated API and core scanner to support optional checks for port scanning and metadata extraction, enhancing performance and user control.
- Improved documentation to reflect changes in performance optimizations and optional parameters for analysis.
@dinexh dinexh self-assigned this Jan 21, 2026
@dinexh dinexh added bug Something isn't working enhancement New feature or request labels Jan 21, 2026
@dinexh dinexh merged commit 3ada194 into main Jan 21, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant