How jatin-vidhani17/securescan works
1. System shape
SecureScan is a two-tier application: a React + Tailwind frontend in frontend/ and a Flask backend in backend/. The backend exposes a scan API, runs the vulnerability checks, and returns structured results that the UI visualizes.
2. User-facing workflow
The main flow is: user enters a target URL in the frontend → frontend sends a request to the backend POST /api/scan → backend validates the target and performs a scan → results are returned as JSON → frontend renders scores, findings, OWASP mappings, charts, logs, and export options.
3. Frontend subsystem
frontend/src/App.jsx orchestrates the UI. The supporting components split the scan output into separate views:
- ScoreCard.jsx for summary/severity
- VulnerabilityList.jsx for findings
- Charts.jsx for visual breakdowns
- OWASPTable.jsx for OWASP-style categorization
- ScanLogs.jsx for execution traces
- ReportExport.jsx for exporting reports
frontend/src/api.js is the client boundary to the Flask API.
4. Backend entry point and API layer
backend/app.py is the Flask entry point and HTTP boundary. It likely wires routes, middleware, response headers, rate limiting, and the scan endpoint. The README indicates the backend also adds secure response headers and rate limiting around scan requests.
5. Scan orchestration
backend/scanner.py and backend/core/engine.py appear to be the central orchestration layer. This is where a target URL is validated, a crawl or request sequence is initiated, detectors are invoked, and a final result object is assembled. backend/core/scoring.py likely converts raw findings into a severity/score summary.
6. Target validation and SSRF protections
backend/security.py is an important boundary before any outbound request is made. Based on the README, it enforces:
- HTTP/HTTPS-only URLs
- rejection of embedded credentials
- blocking localhost/private/internal IP ranges
- timeout and redirect constraints
This subsystem is the main guardrail preventing the scanner from being abused as an SSRF primitive.
7. Crawler and request discovery
backend/crawler/crawler.py is the discovery layer. It likely fetches pages and extracts links/forms or other targets for deeper inspection. The README’s “next steps” mention crawler depth control, so the crawler is already a distinct module, but probably still simple and centrally invoked by the scan engine.
8. Detection modules
backend/detectors/ contains the vulnerability-specific checks:
- xss.py
- sqli.py
- sensitive_data.py
These are independent analyzers that receive crawled pages, responses, or payload contexts and return findings. This modular structure means new checks can be added without changing the UI or API contract.
9. OWASP and scoring layer
backend/core/owasp_tests.py and backend/core/scoring.py suggest a mapping from raw detector outputs into OWASP-style categories and a weighted severity model. The architecture likely separates “what was found” from “how serious it is,” which is useful for the frontend’s charts and summary cards.
10. Reporting and persistence
backend/reports/report.py handles report generation/formatting for scan output. backend/database.py and the bundled backend/securescan.db indicate SQLite-backed persistence, though the README says scan history persistence is a next step; so the current repo likely has partial or experimental DB support. backend/fix_db.py suggests schema repair or migration utilities.
11. Execution artifacts and diagnostics
scan_logs.json and sample_scan_output.json show that the project stores example scan traces/output for development or demo purposes. view_db.py and the test scripts (test_crawler.py, test_crawler2.py, tmp_sql_test.py) indicate local validation tooling around crawler behavior, SQL injection checks, and database inspection.
12. Demo/test target
vuln_app.py appears to be a deliberately vulnerable sample application used as a scan target during development. Architecturally, this is a separate test fixture rather than a production subsystem.
13. Runtime and deployment boundaries
The backend runs on Flask/Python, while the frontend is built with Vite/React/Tailwind. Communication is purely HTTP/JSON between browser and API. There is no evidence of a message queue or microservice split; the scanner executes synchronously within the Flask process.
14. Key diagram boundaries to show
For an architecture diagram, the most important boundaries are:
- Browser/UI vs Flask API
- API vs security gatekeeper
- Scanner orchestration vs detector modules
- Scanner vs external target website
- Scanner vs SQLite/reporting artifacts
The external target site is the only intentional third-party dependency in the scan path, and it is tightly constrained by the security controls above.
Main entry points: engine.py Scan Engine · App.jsx Scan UI · scanner.py Scan API · api.js API Client
Components 23
Frontend
React UI and browser-side API client
- Scan UI · Main browser interface that orchestrates the scan experience
frontend/src/App.jsx - API Client · Browser-side boundary for calling the backend scan API
frontend/src/api.js - Score Card · Shows overall severity and scan score
frontend/src/components/ScoreCard.jsx - Findings List · Renders detected vulnerabilities and details
frontend/src/components/VulnerabilityList.jsx - Charts · Displays severity and category breakdowns
frontend/src/components/Charts.jsx - OWASP Table · Maps findings into OWASP-style categories
frontend/src/components/OWASPTable.jsx - Scan Logs · Shows execution trace and progress messages
frontend/src/components/ScanLogs.jsx - Export Report · Handles report download and export actions
frontend/src/components/ReportExport.jsx
Backend
Flask app, scan pipeline, and persistence
- Flask API · Backend entry point exposing scan routes and response controls
backend/app.py - Scan API · Accepts scan requests and returns structured results
backend/scanner.py - Security Gate · Validates targets and blocks unsafe outbound requests
backend/security.py - Scan Engine · Coordinates crawl, detection, scoring, and result assembly
backend/core/engine.py - Crawler · Discovers links, forms, and targets for deeper inspection
backend/crawler/crawler.py - XSS Detector · Checks pages and responses for cross-site scripting issues
backend/detectors/xss.py - SQLi Detector · Checks inputs and responses for injection signals
backend/detectors/sqli.py - Data Leak Detector · Finds exposed secrets or sensitive content
backend/detectors/sensitive_data.py - OWASP Mapping · Maps raw findings into OWASP-style categories
backend/core/owasp_tests.py - Scoring · Converts findings into a weighted score and severity summary
backend/core/scoring.py - Reporting · Formats scan results into report output
backend/reports/report.py - SQLite Store · Stores scan history and related records
backend/database.py
Artifacts
Example outputs, local tools, and demo target
- Sample Output · Example scan result payload for development and demos
sample_scan_output.json - Log Sample · Example scan trace output
scan_logs.json - Demo Target · Deliberately vulnerable app used as a scan target
vuln_app.py
Connections 23
- Scan UI → API Client: submit target · User input is sent to the backend scan API
- API Client → Flask API: HTTP JSON · Frontend communicates with the Flask backend over JSON requests
- Flask API → Scan API: dispatch · The app routes scan requests into the scan entrypoint
- Scan API → Security Gate: validate · Targets are checked before any outbound request is made
- Security Gate → Scan Engine: allow scan · Safe targets proceed into orchestration
- Scan Engine → Crawler: discover · The engine uses the crawler to find pages and inputs
- Scan Engine → XSS Detector: run check · Runs the XSS detector on discovered content
- Scan Engine → SQLi Detector: run check · Runs the SQL injection detector on discovered content
- Scan Engine → Data Leak Detector: run check · Runs the sensitive data detector on responses and pages
- Scan Engine → OWASP Mapping: classify · Raw findings are mapped into OWASP-style buckets
- Scan Engine → Scoring: score · Findings are converted into a severity score
- Scan Engine → Reporting: format · Results are packaged for export and presentation
- Scan Engine → SQLite Store: persist · Scan data can be stored in SQLite
- Scan Engine → Sample Output: emit example · Representative result payload for demos and development
- Scan Engine → Log Sample: emit trace · Example execution logs mirror the scanner output
- Scan API → Scan UI: return results · Structured JSON results flow back to the frontend
- Scan UI → Score Card: render · The app renders the summary score card
- Scan UI → Findings List: render · The app renders detected findings
- Scan UI → Charts: render · The app renders severity and category charts
- Scan UI → OWASP Table: render · The app renders OWASP categorization
- Scan UI → Scan Logs: render · The app renders scan progress and logs
- Scan UI → Export Report: render · The app exposes report export actions
- Crawler → Demo Target: scan target · The crawler can exercise the demo vulnerable application