# mup-off/devsec-demo architecture

> Architecture diagram of the GitHub repository mup-off/devsec-demo, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mup-off/devsec-demo
- Repository: https://github.com/mup-off/devsec-demo

## Overview

This Django application provides user authentication and profile management, with role-based authorization, account lockout, security auditing, and guarded file uploads. The main request path runs from the user through URL routing and views; views coordinate forms, models, and security helpers. Signals add profile lifecycle and audit hooks, while context processing exposes role flags to templates. The README describes the repository as a security-learning assignment, not a deployed product. Several view capabilities are represented from partial excerpts and the source index; unsampled wiring is not inferred.

Main entry points: [`mupenz_fulgence/views.py`](https://github.com/mup-off/devsec-demo/blob/main/mupenz_fulgence/views.py) (Auth and profile views), [`mupenz_fulgence/models.py`](https://github.com/mup-off/devsec-demo/blob/main/mupenz_fulgence/models.py) (User profiles), [`mupenz_fulgence/forms.py`](https://github.com/mup-off/devsec-demo/blob/main/mupenz_fulgence/forms.py) (Account and profile forms), [`mupenz_fulgence/signals.py`](https://github.com/mup-off/devsec-demo/blob/main/mupenz_fulgence/signals.py) (Auth and profile signals)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Identity workflow"]
  node_routes["URL routes<br/>[urls.py]"]
  node_views["Auth and profile views<br/>[views.py]"]
  node_forms["Account and profile forms<br/>[forms.py]"]
end

subgraph group_authorization["Roles and access"]
  node_rbac["Role enforcement<br/>[rbac.py]"]
  node_context["Template role flags"]
  node_group_setup["Group provisioning<br/>[setup_groups.py]"]
end

subgraph group_security["Security controls"]
  node_lockout["Login lockout"]
  node_cache[("Django cache")]
  node_audit["Security audit<br/>[audit_logger.py]"]
  node_signals["Auth and profile signals<br/>[signals.py]"]
  node_app_config["Signal registration<br/>[apps.py]"]
end

subgraph group_profile["Profile data"]
  node_models["User profiles<br/>[models.py]"]
  node_database[("Application database")]
  node_validators["Upload validators<br/>[validators.py]"]
end

node_user(("User"))

node_user -->|"requests"| node_routes
node_routes -->|"routes to"| node_views
node_views -->|"uses forms"| node_forms
node_views -->|"reads and updates"| node_models
node_views -->|"checks lockout"| node_lockout
node_views -->|"records events"| node_audit
node_views -->|"checks roles"| node_rbac
node_forms -->|"updates profiles"| node_models
node_forms -->|"validates uploads"| node_validators
node_models -->|"validates and names files"| node_validators
node_models -->|"persists profiles"| node_database
node_lockout -->|"stores counters"| node_cache
node_app_config -->|"registers handlers"| node_signals
node_signals -->|"creates and saves profiles"| node_models
node_signals -->|"logs auth events"| node_audit
node_context -->|"gets user role"| node_rbac
node_group_setup -->|"uses profile model"| node_models
node_group_setup -->|"provisions groups"| node_database

click node_routes "https://github.com/mup-off/devsec-demo/blob/main/mupenz_fulgence/urls.py"
click node_views "https://github.com/mup-off/devsec-demo/blob/main/mupenz_fulgence/views.py"
click node_forms "https://github.com/mup-off/devsec-demo/blob/main/mupenz_fulgence/forms.py"
click node_models "https://github.com/mup-off/devsec-demo/blob/main/mupenz_fulgence/models.py"
click node_validators "https://github.com/mup-off/devsec-demo/blob/main/mupenz_fulgence/validators.py"
click node_lockout "https://github.com/mup-off/devsec-demo/blob/main/mupenz_fulgence/login_protection.py"
click node_audit "https://github.com/mup-off/devsec-demo/blob/main/mupenz_fulgence/audit_logger.py"
click node_signals "https://github.com/mup-off/devsec-demo/blob/main/mupenz_fulgence/signals.py"
click node_app_config "https://github.com/mup-off/devsec-demo/blob/main/mupenz_fulgence/apps.py"
click node_rbac "https://github.com/mup-off/devsec-demo/blob/main/mupenz_fulgence/rbac.py"
click node_context "https://github.com/mup-off/devsec-demo/blob/main/mupenz_fulgence/context_processors.py"
click node_group_setup "https://github.com/mup-off/devsec-demo/blob/main/mupenz_fulgence/management/commands/setup_groups.py"

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_routes,node_views,node_forms,node_user toneBlue
class node_rbac,node_context,node_group_setup toneAmber
class node_lockout,node_cache,node_audit,node_signals,node_app_config toneMint
class node_models,node_database,node_validators toneRose
```

## Components

### Identity workflow

- [URL routes](https://github.com/mup-off/devsec-demo/blob/main/mupenz_fulgence/urls.py): `mupenz_fulgence/urls.py`
- [Auth and profile views](https://github.com/mup-off/devsec-demo/blob/main/mupenz_fulgence/views.py): `mupenz_fulgence/views.py`
- [Account and profile forms](https://github.com/mup-off/devsec-demo/blob/main/mupenz_fulgence/forms.py): `mupenz_fulgence/forms.py`

### Roles and access

- [Role enforcement](https://github.com/mup-off/devsec-demo/blob/main/mupenz_fulgence/rbac.py): `mupenz_fulgence/rbac.py`
- [Template role flags](https://github.com/mup-off/devsec-demo/blob/main/mupenz_fulgence/context_processors.py): `mupenz_fulgence/context_processors.py`
- [Group provisioning](https://github.com/mup-off/devsec-demo/blob/main/mupenz_fulgence/management/commands/setup_groups.py): `mupenz_fulgence/management/commands/setup_groups.py`

### Security controls

- [Login lockout](https://github.com/mup-off/devsec-demo/blob/main/mupenz_fulgence/login_protection.py): `mupenz_fulgence/login_protection.py`
- **Django cache**
- [Security audit](https://github.com/mup-off/devsec-demo/blob/main/mupenz_fulgence/audit_logger.py): `mupenz_fulgence/audit_logger.py`
- [Auth and profile signals](https://github.com/mup-off/devsec-demo/blob/main/mupenz_fulgence/signals.py): `mupenz_fulgence/signals.py`
- [Signal registration](https://github.com/mup-off/devsec-demo/blob/main/mupenz_fulgence/apps.py): `mupenz_fulgence/apps.py`

### Profile data

- [User profiles](https://github.com/mup-off/devsec-demo/blob/main/mupenz_fulgence/models.py): `mupenz_fulgence/models.py`
- **Application database**
- [Upload validators](https://github.com/mup-off/devsec-demo/blob/main/mupenz_fulgence/validators.py): `mupenz_fulgence/validators.py`

### Other components

- **User**

## Connections

- User → URL routes: requests
- URL routes → Auth and profile views: routes to (evidence: `mupenz_fulgence/urls.py`)
- Auth and profile views → Account and profile forms: uses forms (evidence: `mupenz_fulgence/views.py`)
- Auth and profile views → User profiles: reads and updates (evidence: `mupenz_fulgence/views.py`)
- Auth and profile views → Login lockout: checks lockout (evidence: `mupenz_fulgence/views.py`)
- Auth and profile views → Security audit: records events (evidence: `mupenz_fulgence/views.py`)
- Auth and profile views → Role enforcement: checks roles (evidence: `mupenz_fulgence/views.py`)
- Account and profile forms → User profiles: updates profiles (evidence: `mupenz_fulgence/forms.py`)
- Account and profile forms → Upload validators: validates uploads (evidence: `mupenz_fulgence/forms.py`)
- User profiles → Upload validators: validates and names files (evidence: `mupenz_fulgence/models.py`)
- User profiles → Application database: persists profiles (evidence: `mupenz_fulgence/models.py`)
- Login lockout → Django cache: stores counters (evidence: `mupenz_fulgence/login_protection.py`)
- Signal registration → Auth and profile signals: registers handlers (evidence: `mupenz_fulgence/apps.py`)
- Auth and profile signals → User profiles: creates and saves profiles (evidence: `mupenz_fulgence/signals.py`)
- Auth and profile signals → Security audit: logs auth events (evidence: `mupenz_fulgence/signals.py`)
- Template role flags → Role enforcement: gets user role (evidence: `mupenz_fulgence/context_processors.py`)
- Group provisioning → User profiles: uses profile model (evidence: `mupenz_fulgence/management/commands/setup_groups.py`)
- Group provisioning → Application database: provisions groups (evidence: `mupenz_fulgence/management/commands/setup_groups.py`)
