How codefingers809/logspec works
1. Repository shape
- This is a three-part system: client/ is the Laravel + React product UI, backend/ is the Python security-analysis engine, and dasht/ is a separate DAST service stack for live web scanning.
- The architecture is intentionally split between a user-facing control plane and a scan-execution plane.
2. Client app: UI, auth, and report presentation
- client/ is a Laravel 13 app using Inertia.js + React 19 + TailwindCSS as the presentation layer.
- It owns browser sessions, Fortify-based authentication, settings/profile flows, and the main dashboard pages for repositories, scans, findings, threat intel, and DAST.
- Controllers such as RepositoryController, ScanController, FindingController, DastController, and ThreatIntelController act as the Laravel-facing orchestration layer.
3. Backend app: scan API and analysis engine
- backend/ is a FastAPI service that exposes versioned REST endpoints under app/api/v1.
- Its role is not the UI; it is the analysis and persistence backend that receives authenticated requests, starts scan workflows, and serves scan/finding data back to the client.
- The API boundary is explicit: routers for repos, scans, findings, reports, tools, providers, files, health, and model metadata.
4. Async job pipeline
- The backend uses Celery with Redis as the queueing layer for long-running scans.
- HTTP requests trigger scan jobs, but the actual work is done asynchronously by workers, which is important for the architecture because scans are multi-step and expensive.
- This separates request/response latency from scan execution.
5. Scanner execution subsystem
- The backend/app/scanners package is the core execution layer for SAST-style analysis.
- It includes dependency scanning, code scanning, secret detection, IaC/policy checks, container/Dockerfile linting, and preflight/incremental/triage logic.
- Concrete scanners include Semgrep, Gitleaks, Checkov, Hadolint, Conftest, Trivy, and fingerprinting/dedup helpers.
6. Analysis and orchestration graph
- The backend also has a graph-based agent layer in app/graph with agent/tool nodes and a shared state model.
- This is the LLM-driven analysis path: source files and scan context are fed into an agent workflow to produce context-aware findings that complement the rule-based scanners.
- app/tools provides the tool registry used by that agent layer.
7. LLM provider abstraction
- LLM access is abstracted behind provider interfaces in backend/app/llm/providers.
- Supported providers include OpenAI, Anthropic, Groq, and AWS Bedrock, with a factory and a Bedrock-specific client.
- This is a key boundary: the rest of the system talks to a provider-agnostic LLM interface rather than a single vendor API.
8. Data persistence and repository layer
- The backend persists scan results, repos, users, provider keys, credentials, scan context, and scanner runs through a repository pattern in backend/app/db/repositories.
- MySQL is the main relational store for findings and scan metadata; the schema evolves through SQL migrations in backend/app/db/migrations.
- This repository layer is the main persistence boundary between API/service logic and the database.
9. Client/backend security boundary
- Auth is handled on the Laravel side with Fortify and JWT cookies, which are then used for server-to-server communication with the Python backend.
- That means the browser authenticates to Laravel, while Laravel acts as the trusted bridge to backend APIs.
- This is a meaningful trust boundary in the architecture diagram: browser → Laravel session/auth → JWT-authenticated backend calls.
10. Report generation and summaries
- The system produces a consolidated report with deduplicated findings, severity breakdowns, and AI-generated remediation guidance.
- Laravel includes a scan_report.blade.php view for presentation/PDF generation, while the backend has report and summary services for aggregated scan output.
- The reporting flow sits downstream of scan ingestion and deduplication, not in the live scan path.
11. DAST subsystem
- dasht/ is a separate Docker Compose-based service that wraps web attack scanners.
- It combines ZAP, Wapiti, and WPScan sidecars, with a Python API layer for report merging and result normalization.
- This is a distinct runtime from the main backend because it scans live targets, not source code.
12. External integrations
- The architecture depends on external security tooling and cloud services: OSV/Trivy for dependency intel, Pulsedive for IOC reputation lookups, and multiple LLM providers for remediation and summarization.
- Docker is also a structural dependency because several scanners and the DAST stack run as containerized subprocesses or sidecars.
13. Operational concerns
- The backend includes lifespan and logging modules, plus scanner lifecycle helpers, showing that startup/shutdown and execution control are first-class concerns.
- Tests are present in both Python and Laravel sides, with end-to-end scripts in the backend, indicating the repo is designed around integrated scan workflows rather than isolated libraries.
14. How to draw it
- A good diagram should show three major blocks: Laravel UI/control plane, Python scan engine, and DAST service.
- Inside the Python block, draw separate lanes for API, queue/worker execution, scanner modules, LLM provider adapters, and MySQL repositories.
- The main flows are: user request → Laravel auth/UI → backend scan dispatch → Celery workers → scanners/LLM → persisted findings → report/summary output back to the client.
Main entry points: Controllers App controllers · repositories Repositories · v1 API routers · services Scan services
Components 19
Laravel control plane
Browser-facing UI, auth, dashboards, and report presentation.
- UI shell · Inertia/React presentation layer for dashboards, repositories, scans, findings, and settings.
client/resources/js - Auth flow · Browser session handling, login, registration, password reset, and 2FA.
client/app/Providers/FortifyServiceProvider.php - App controllers · Controllers coordinating repositories, scans, findings, DAST, and threat intel views.
client/app/Http/Controllers - Report views · Consolidated scan report presentation and PDF-friendly rendering.
client/resources/views/scan_report.blade.php - Client models · Frontend-facing repository, scan, finding, and user models used by the control plane.
client/app/Models - Backend bridge · Trusted server-to-server calls from Laravel to the Python backend using JWT cookies.
client/app/Services/LogSpecClient.php
Python analysis engine
API, async workers, scanners, persistence, and LLM-assisted analysis.
- API routers · Versioned REST boundary for repos, scans, findings, reports, tools, providers, files, and health.
backend/app/api/v1 - JWT auth · Backend authentication support for Laravel-issued trusted requests.
backend/app/auth/jwt_cookie.py - Scan services · Repo, scan, report, and summary services that coordinate scan lifecycle and persisted output.
backend/app/services - Celery queue · Long-running scan dispatch and worker execution through Redis-backed task processing.
backend/app/tasks - Scanner suite · Rule-based scanners for dependencies, code, secrets, IaC, containers, preflight, incremental, and triage.
backend/app/scanners - Agent graph · Graph-based agent and tool nodes that analyze files and scan context for richer findings.
backend/app/graph - Tool registry · Tool definitions exposed to the analysis graph.
backend/app/tools - LLM adapters · Provider-agnostic interfaces and adapters for OpenAI, Anthropic, Groq, and Bedrock.
backend/app/llm/providers - Repositories · Repository pattern for scans, findings, repos, users, credentials, provider keys, and scanner runs.
backend/app/db/repositories - MySQL store · Primary database for findings, scan metadata, users, and scan context.
backend/app/db/migrations - VCS access · Git and GitHub URL handling for repository acquisition and context.
backend/app/vcs
DAST service
Containerized live-target scanning stack with report normalization.
- DAST API · Live-scan API that merges and normalizes web scanner output.
dasht/api/main.py - DAST sidecars · ZAP, Wapiti, and WPScan sidecar services for live target scanning.
dasht/wapiti-sidecar/server.py
Connections 20
- UI shell → App controllers: routes to · UI pages are driven by Laravel controllers.
- Auth flow → UI shell: protects · Authenticated sessions gate the presentation layer.
- App controllers → Backend bridge: calls backend · Controllers use the trusted bridge to reach Python APIs.
- App controllers → Report views: renders · Controllers feed report presentation and PDF output.
- Client models → App controllers: binds data · Models shape dashboard and view state.
- Backend bridge → JWT auth: authenticates · Laravel requests are accepted via JWT-backed auth.
- API routers → Scan services: delegates · Routers hand requests to service-layer workflow logic.
- API routers → Celery queue: dispatches · Scan requests enqueue asynchronous work.
- Celery queue → Scanner suite: executes · Workers run multi-step scan pipelines.
- Celery queue → Agent graph: invokes · Worker jobs can trigger agent-based analysis workflows.
- Agent graph → Tool registry: uses · Graph nodes consume registered tools.
- Agent graph → LLM adapters: queries · Agent workflow calls provider-agnostic LLM adapters.
- Scanner suite → VCS access: reads repos · Scanners consume repository content and Git context.
- Scanner suite → Repositories: stores runs · Scanner outcomes are persisted through repositories.
- Scan services → Repositories: persists · Services write repos, scans, findings, and summaries.
- Repositories → MySQL store: reads/writes · Repository layer mediates database access.
- Scan services → LLM adapters: summarizes · Report and summary services may use LLM-assisted guidance.
- API routers → Repositories: reads · APIs serve scan and finding data from persistence.
- DAST API → DAST sidecars: orchestrates · DAST API coordinates live scanner sidecars.
- DAST API → App controllers: returns results · DAST outcomes are surfaced back through the UI/control plane.