# iyed523/vulnlab architecture

> Architecture diagram of the GitHub repository iyed523/vulnlab, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/iyed523/vulnlab
- Repository: https://github.com/iyed523/vulnlab

## Overview

VulnLab is a local web-security learning lab; the implemented runtime shown here is its intentionally vulnerable Flask ticket application. The main user journey is registration or login, then authenticated profile, ticket, and comment operations, with service-layer checks backed by PostgreSQL. The README also describes a future corrected counterpart, but its implementation is not represented in the sampled source. Edges rely on source excerpts, SOURCE INDEX references, or explicit README statements; unsampled subsystem details are omitted.

Main entry points: [`vulnerable-app/src/vulnlab_vulnerable/__init__.py`](https://github.com/iyed523/vulnlab/blob/main/vulnerable-app/src/vulnlab_vulnerable/__init__.py) (Flask application), [`vulnerable-app/src/vulnlab_vulnerable/auth.py`](https://github.com/iyed523/vulnlab/blob/main/vulnerable-app/src/vulnlab_vulnerable/auth.py) (Authentication routes), [`vulnerable-app/src/vulnlab_vulnerable/accounts.py`](https://github.com/iyed523/vulnlab/blob/main/vulnerable-app/src/vulnlab_vulnerable/accounts.py) (Profile and admin routes), [`vulnerable-app/src/vulnlab_vulnerable/tickets.py`](https://github.com/iyed523/vulnlab/blob/main/vulnerable-app/src/vulnlab_vulnerable/tickets.py) (Ticket routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_factory["Flask application<br/>[__init__.py]"]
  node_forms["Forms and validation<br/>[forms.py]"]
  node_web_controls["HTTP guards<br/>[web_controls.py]"]
  node_secure_app["Corrected counterpart<br/>[README.md]"]
end

subgraph group_identity["Identity and accounts"]
  node_auth_routes["Authentication routes<br/>[auth.py]"]
  node_sessions["Session backend<br/>[session_backend.py]"]
  node_auth_service["Authentication service<br/>[auth_service.py]"]
  node_accounts_routes["Profile and admin routes<br/>[accounts.py]"]
  node_account_service["Account service<br/>[account_service.py]"]
  node_redis[("Redis")]
end

subgraph group_tickets["Tickets and comments"]
  node_tickets_routes["Ticket routes<br/>[tickets.py]"]
  node_ticket_service["Ticket service<br/>[ticket_service.py]"]
end

subgraph group_persistence["Persistence"]
  node_models["Data models<br/>[models.py]"]
  node_database["Database access<br/>[database.py]"]
  node_postgres[("PostgreSQL")]
end

node_user(("Local user"))

node_user -->|"uses locally"| node_factory
node_factory -->|"registers routes"| node_auth_routes
node_factory -->|"registers routes"| node_accounts_routes
node_factory -->|"registers routes"| node_tickets_routes
node_auth_routes -->|"validates input"| node_forms
node_auth_routes -->|"calls"| node_auth_service
node_auth_routes -->|"configures sessions"| node_sessions
node_auth_routes -->|"checks access"| node_web_controls
node_auth_service -->|"queries users"| node_models
node_accounts_routes -->|"calls"| node_account_service
node_accounts_routes -->|"validates input"| node_forms
node_accounts_routes -->|"checks access"| node_web_controls
node_account_service -->|"queries users"| node_models
node_tickets_routes -->|"calls"| node_ticket_service
node_tickets_routes -->|"validates input"| node_forms
node_tickets_routes -->|"checks access"| node_web_controls
node_ticket_service -->|"queries tickets"| node_models
node_factory -->|"initializes access"| node_database
node_database -->|"connects to"| node_postgres
node_sessions -->|"stores sessions"| node_redis
node_user -.->|"planned comparison"| node_secure_app

click node_factory "https://github.com/iyed523/vulnlab/blob/main/vulnerable-app/src/vulnlab_vulnerable/__init__.py"
click node_auth_routes "https://github.com/iyed523/vulnlab/blob/main/vulnerable-app/src/vulnlab_vulnerable/auth.py"
click node_forms "https://github.com/iyed523/vulnlab/blob/main/vulnerable-app/src/vulnlab_vulnerable/forms.py"
click node_web_controls "https://github.com/iyed523/vulnlab/blob/main/vulnerable-app/src/vulnlab_vulnerable/web_controls.py"
click node_sessions "https://github.com/iyed523/vulnlab/blob/main/vulnerable-app/src/vulnlab_vulnerable/session_backend.py"
click node_auth_service "https://github.com/iyed523/vulnlab/blob/main/vulnerable-app/src/vulnlab_vulnerable/auth_service.py"
click node_accounts_routes "https://github.com/iyed523/vulnlab/blob/main/vulnerable-app/src/vulnlab_vulnerable/accounts.py"
click node_account_service "https://github.com/iyed523/vulnlab/blob/main/vulnerable-app/src/vulnlab_vulnerable/account_service.py"
click node_tickets_routes "https://github.com/iyed523/vulnlab/blob/main/vulnerable-app/src/vulnlab_vulnerable/tickets.py"
click node_ticket_service "https://github.com/iyed523/vulnlab/blob/main/vulnerable-app/src/vulnlab_vulnerable/ticket_service.py"
click node_models "https://github.com/iyed523/vulnlab/blob/main/vulnerable-app/src/vulnlab_vulnerable/models.py"
click node_database "https://github.com/iyed523/vulnlab/blob/main/vulnerable-app/src/vulnlab_vulnerable/database.py"
click node_secure_app "https://github.com/iyed523/vulnlab/blob/main/secure-app/README.md"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_factory,node_forms,node_web_controls,node_secure_app,node_user toneBlue
class node_auth_routes,node_sessions,node_auth_service,node_accounts_routes,node_account_service,node_redis toneAmber
class node_tickets_routes,node_ticket_service toneMint
class node_models,node_database,node_postgres toneRose
```

## Components

### Web application

- [Flask application](https://github.com/iyed523/vulnlab/blob/main/vulnerable-app/src/vulnlab_vulnerable/__init__.py): `vulnerable-app/src/vulnlab_vulnerable/__init__.py`
- [Forms and validation](https://github.com/iyed523/vulnlab/blob/main/vulnerable-app/src/vulnlab_vulnerable/forms.py): `vulnerable-app/src/vulnlab_vulnerable/forms.py`
- [HTTP guards](https://github.com/iyed523/vulnlab/blob/main/vulnerable-app/src/vulnlab_vulnerable/web_controls.py): `vulnerable-app/src/vulnlab_vulnerable/web_controls.py`
- [Corrected counterpart](https://github.com/iyed523/vulnlab/blob/main/secure-app/README.md): `secure-app/README.md`

### Identity and accounts

- [Authentication routes](https://github.com/iyed523/vulnlab/blob/main/vulnerable-app/src/vulnlab_vulnerable/auth.py): `vulnerable-app/src/vulnlab_vulnerable/auth.py`
- [Session backend](https://github.com/iyed523/vulnlab/blob/main/vulnerable-app/src/vulnlab_vulnerable/session_backend.py): `vulnerable-app/src/vulnlab_vulnerable/session_backend.py`
- [Authentication service](https://github.com/iyed523/vulnlab/blob/main/vulnerable-app/src/vulnlab_vulnerable/auth_service.py): `vulnerable-app/src/vulnlab_vulnerable/auth_service.py`
- [Profile and admin routes](https://github.com/iyed523/vulnlab/blob/main/vulnerable-app/src/vulnlab_vulnerable/accounts.py): `vulnerable-app/src/vulnlab_vulnerable/accounts.py`
- [Account service](https://github.com/iyed523/vulnlab/blob/main/vulnerable-app/src/vulnlab_vulnerable/account_service.py): `vulnerable-app/src/vulnlab_vulnerable/account_service.py`
- **Redis**

### Tickets and comments

- [Ticket routes](https://github.com/iyed523/vulnlab/blob/main/vulnerable-app/src/vulnlab_vulnerable/tickets.py): `vulnerable-app/src/vulnlab_vulnerable/tickets.py`
- [Ticket service](https://github.com/iyed523/vulnlab/blob/main/vulnerable-app/src/vulnlab_vulnerable/ticket_service.py): `vulnerable-app/src/vulnlab_vulnerable/ticket_service.py`

### Persistence

- [Data models](https://github.com/iyed523/vulnlab/blob/main/vulnerable-app/src/vulnlab_vulnerable/models.py): `vulnerable-app/src/vulnlab_vulnerable/models.py`
- [Database access](https://github.com/iyed523/vulnlab/blob/main/vulnerable-app/src/vulnlab_vulnerable/database.py): `vulnerable-app/src/vulnlab_vulnerable/database.py`
- **PostgreSQL**

### Other components

- **Local user**

## Connections

- Local user → Flask application: uses locally (evidence: `README.md`)
- Flask application → Authentication routes: registers routes (evidence: `vulnerable-app/src/vulnlab_vulnerable/__init__.py`)
- Flask application → Profile and admin routes: registers routes (evidence: `vulnerable-app/src/vulnlab_vulnerable/__init__.py`)
- Flask application → Ticket routes: registers routes (evidence: `vulnerable-app/src/vulnlab_vulnerable/__init__.py`)
- Authentication routes → Forms and validation: validates input (evidence: `vulnerable-app/src/vulnlab_vulnerable/auth.py`)
- Authentication routes → Authentication service: calls (evidence: `vulnerable-app/src/vulnlab_vulnerable/auth.py`)
- Authentication routes → Session backend: configures sessions (evidence: `vulnerable-app/src/vulnlab_vulnerable/auth.py`)
- Authentication routes → HTTP guards: checks access (evidence: `vulnerable-app/src/vulnlab_vulnerable/auth.py`)
- Authentication service → Data models: queries users (evidence: `vulnerable-app/src/vulnlab_vulnerable/auth_service.py`)
- Profile and admin routes → Account service: calls (evidence: `vulnerable-app/src/vulnlab_vulnerable/accounts.py`)
- Profile and admin routes → Forms and validation: validates input (evidence: `vulnerable-app/src/vulnlab_vulnerable/accounts.py`)
- Profile and admin routes → HTTP guards: checks access (evidence: `vulnerable-app/src/vulnlab_vulnerable/accounts.py`)
- Account service → Data models: queries users (evidence: `vulnerable-app/src/vulnlab_vulnerable/account_service.py`)
- Ticket routes → Ticket service: calls (evidence: `vulnerable-app/src/vulnlab_vulnerable/tickets.py`)
- Ticket routes → Forms and validation: validates input (evidence: `vulnerable-app/src/vulnlab_vulnerable/tickets.py`)
- Ticket routes → HTTP guards: checks access (evidence: `vulnerable-app/src/vulnlab_vulnerable/tickets.py`)
- Ticket service → Data models: queries tickets (evidence: `vulnerable-app/src/vulnlab_vulnerable/ticket_service.py`)
- Flask application → Database access: initializes access (evidence: `vulnerable-app/src/vulnlab_vulnerable/__init__.py`)
- Database access → PostgreSQL: connects to (evidence: `README.md`)
- Session backend → Redis: stores sessions (evidence: `vulnerable-app/src/vulnlab_vulnerable/session_backend.py`)
- Local user → Corrected counterpart: planned comparison (evidence: `README.md`)
