# anpk1011/webgoat architecture

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

- Interactive diagram: https://gitdiagram.com/anpk1011/webgoat
- Repository: https://github.com/anpk1011/webgoat

## Overview

#### Purpose and Runtime

WebGoat is an OWASP deliberately insecure, educational web application for practicing server-side web-security attacks. It is a Java 25, Maven, Spring Boot system packaged for standalone execution or Docker. It runs two local web applications: WebGoat (default `:8080/WebGoat`) and WebWolf (default `:9090/WebWolf`), the auxiliary attacker-support service. Primary launch wiring is in `src/main/java/org/owasp/webgoat/server/StartWebGoat.java` and `src/main/java/org/owasp/webgoat/server/ParentConfig.java`; container packaging is `Dockerfile`.

#### Two Application Boundaries

WebGoat and WebWolf have separate Spring MVC/security configurations, properties, templates, static assets, and user/data models. WebGoat is the lesson portal; WebWolf provides capabilities exercises can target or use, including mailbox, file server, request tracing, and JWT tools. Their principal application roots are `src/main/java/org/owasp/webgoat/container/WebGoat.java` and `src/main/java/org/owasp/webgoat/webwolf/WebWolf.java`; configuration is split between `src/main/resources/application-webgoat.properties` and `src/main/resources/application-webwolf.properties`.

#### WebGoat Request, Identity, and Progress Flow

Browser requests enter Spring MVC and Spring Security, then route through current-user/session and lesson-tracking infrastructure. Registration and authenticated users are persisted through repositories/services; user progress records completion per lesson/assignment. Key boundary components are `src/main/java/org/owasp/webgoat/container/WebSecurityConfig.java`, `src/main/java/org/owasp/webgoat/container/users/UserService.java`, and `src/main/java/org/owasp/webgoat/container/service/LessonProgressService.java`. The database is initialized via `src/main/resources/db/container/V1__init.sql`, with lesson-specific migrations under resource lesson directories.

#### Lesson Discovery and Content Assembly

Lessons are modular Java classes implementing shared lesson/assignment metadata, dynamically discovered alongside their resource bundles. Course/menu services turn discovered lessons into navigable categories and render each lesson’s HTML, AsciiDoc documentation, localized labels, and assets. The core abstractions and loading path are `src/main/java/org/owasp/webgoat/container/lessons/Lesson.java`, `src/main/java/org/owasp/webgoat/container/LessonResourceScanner.java`, and `src/main/java/org/owasp/webgoat/container/LessonTemplateResolver.java`. A representative complete lesson bundle spans `src/main/java/org/owasp/webgoat/lessons/sqlinjection/` and `src/main/resources/lessons/sqlinjection/`.

#### Exercise Execution and Validation

Lesson-specific HTTP endpoints intentionally expose vulnerable or mitigated behavior. Assignments submit attack attempts to a common endpoint/result model; validation produces an `AttackResult`, hints are available separately, and tracking persists successful work. This creates a controlled framework boundary between generic progression logic and intentionally unsafe lesson code. Central classes: `src/main/java/org/owasp/webgoat/container/assignments/AssignmentEndpoint.java`, `src/main/java/org/owasp/webgoat/container/assignments/AttackResult.java`, and `src/main/java/org/owasp/webgoat/container/assignments/LessonTrackerInterceptor.java`.

#### Client UI and WebWolf Services

WebGoat serves a server-hosted shell with a legacy JavaScript application (Backbone/jQuery) that loads menus, lesson content, hints, assignment status, and report cards from backend endpoints. Main client routing/content pieces are `src/main/resources/webgoat/static/js/goatApp/view/GoatRouter.js`, `src/main/resources/webgoat/static/js/goatApp/controller/LessonController.js`, and `src/main/resources/webgoat/templates/main_new.html`. WebWolf independently exposes mailbox, uploaded files, and captured requests through `src/main/java/org/owasp/webgoat/webwolf/mailbox/MailboxController.java`, `src/main/java/org/owasp/webgoat/webwolf/FileServer.java`, and `src/main/java/org/owasp/webgoat/webwolf/requests/Requests.java`.

#### Deployment and Exposure Constraints

The application is intentionally vulnerable and designed to bind locally; Docker maps both application ports explicitly. Runtime host names can be configured for proxy-based lessons, and category/lesson exclusions alter the generated menu/course. Material external interaction is browser/proxy tooling (ZAP or Burp) and Docker; WebWolf is an internal companion service rather than a remote dependency.

Main entry points: [`src/main/java/org/owasp/webgoat/webwolf/WebWolf.java`](https://github.com/anpk1011/webgoat/blob/main/src/main/java/org/owasp/webgoat/webwolf/WebWolf.java) (WebWolf application), [`src/main/java/org/owasp/webgoat/container/WebGoat.java`](https://github.com/anpk1011/webgoat/blob/main/src/main/java/org/owasp/webgoat/container/WebGoat.java) (WebGoat application), [`src/main/java/org/owasp/webgoat/server/StartWebGoat.java`](https://github.com/anpk1011/webgoat/blob/main/src/main/java/org/owasp/webgoat/server/StartWebGoat.java) (Dual-app launcher), [`src/main/java/org/owasp/webgoat/container/LessonResourceScanner.java`](https://github.com/anpk1011/webgoat/blob/main/src/main/java/org/owasp/webgoat/container/LessonResourceScanner.java) (Lesson discovery)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime"]
  node_docker{{"Docker packaging<br/>container packaging"}}
  node_launcher["Dual-app launcher<br/>Spring Boot bootstrap<br/>[StartWebGoat.java]"]
  node_parentconfig["Parent configuration<br/>Spring configuration<br/>[ParentConfig.java]"]
end

subgraph group_webgoat["WebGoat portal"]
  node_webgoatapp["WebGoat application<br/>Spring MVC app<br/>[WebGoat.java]"]
  node_security["Security and sessions<br/>Spring Security config"]
  node_users["Users and identity<br/>user service<br/>[UserService.java]"]
  node_progress["Lesson progress<br/>progress service"]
  node_database[("Application database<br/>relational database<br/>[V1__init.sql]")]
  node_ui["Portal UI shell<br/>Backbone/jQuery client<br/>[main_new.html]"]
end

subgraph group_lessons["Lesson system"]
  node_lesson["Lesson abstraction<br/>lesson metadata<br/>[Lesson.java]"]
  node_scanner["Lesson discovery<br/>resource scanner"]
  node_templates["Lesson content renderer<br/>template resolver"]
  node_sqlbundle["SQL injection lesson<br/>representative lesson<br/>[SqlInjection.java]"]
  node_assignment["Assignment execution<br/>assignment endpoint"]
  node_tracking["Completion interceptor<br/>lesson tracker"]
end

subgraph group_webwolf["WebWolf companion"]
  node_webwolfapp["WebWolf application<br/>Spring MVC app<br/>[WebWolf.java]"]
  node_mailbox["Mailbox service<br/>WebWolf controller"]
  node_fileserver["File service<br/>WebWolf file server<br/>[FileServer.java]"]
  node_requests["Request capture<br/>WebWolf request service<br/>[Requests.java]"]
end

node_browser(("Browser / proxy tools<br/>external client"))

node_docker -->|"packages and runs"| node_launcher
node_parentconfig -->|"shared wiring"| node_launcher
node_launcher -->|"starts :8080"| node_webgoatapp
node_launcher -->|"starts :9090"| node_webwolfapp
node_browser -->|"portal requests"| node_webgoatapp
node_browser -->|"companion requests"| node_webwolfapp
node_webgoatapp -->|"secures requests"| node_security
node_security -->|"resolves user"| node_users
node_users -->|"persists users"| node_database
node_webgoatapp -->|"serves shell"| node_ui
node_webgoatapp -->|"discovers lessons"| node_scanner
node_scanner -->|"loads metadata"| node_lesson
node_scanner -->|"finds lesson"| node_sqlbundle
node_lesson -->|"renders content"| node_templates
node_ui -->|"submits attempts"| node_assignment
node_sqlbundle -->|"vulnerable endpoints"| node_assignment
node_assignment -->|"successful result"| node_tracking
node_tracking -->|"records completion"| node_progress
node_progress -->|"persists progress"| node_database
node_webwolfapp -->|"exposes"| node_mailbox
node_webwolfapp -->|"exposes"| node_fileserver
node_webwolfapp -->|"exposes"| node_requests
node_sqlbundle -.->|"uses companion capabilities"| node_webwolfapp

click node_docker "https://github.com/anpk1011/webgoat/tree/main/Dockerfile"
click node_launcher "https://github.com/anpk1011/webgoat/blob/main/src/main/java/org/owasp/webgoat/server/StartWebGoat.java"
click node_parentconfig "https://github.com/anpk1011/webgoat/blob/main/src/main/java/org/owasp/webgoat/server/ParentConfig.java"
click node_webgoatapp "https://github.com/anpk1011/webgoat/blob/main/src/main/java/org/owasp/webgoat/container/WebGoat.java"
click node_security "https://github.com/anpk1011/webgoat/blob/main/src/main/java/org/owasp/webgoat/container/WebSecurityConfig.java"
click node_users "https://github.com/anpk1011/webgoat/blob/main/src/main/java/org/owasp/webgoat/container/users/UserService.java"
click node_progress "https://github.com/anpk1011/webgoat/blob/main/src/main/java/org/owasp/webgoat/container/service/LessonProgressService.java"
click node_database "https://github.com/anpk1011/webgoat/blob/main/src/main/resources/db/container/V1__init.sql"
click node_ui "https://github.com/anpk1011/webgoat/blob/main/src/main/resources/webgoat/templates/main_new.html"
click node_lesson "https://github.com/anpk1011/webgoat/blob/main/src/main/java/org/owasp/webgoat/container/lessons/Lesson.java"
click node_scanner "https://github.com/anpk1011/webgoat/blob/main/src/main/java/org/owasp/webgoat/container/LessonResourceScanner.java"
click node_templates "https://github.com/anpk1011/webgoat/blob/main/src/main/java/org/owasp/webgoat/container/LessonTemplateResolver.java"
click node_sqlbundle "https://github.com/anpk1011/webgoat/blob/main/src/main/java/org/owasp/webgoat/lessons/sqlinjection/introduction/SqlInjection.java"
click node_assignment "https://github.com/anpk1011/webgoat/blob/main/src/main/java/org/owasp/webgoat/container/assignments/AssignmentEndpoint.java"
click node_tracking "https://github.com/anpk1011/webgoat/blob/main/src/main/java/org/owasp/webgoat/container/assignments/LessonTrackerInterceptor.java"
click node_webwolfapp "https://github.com/anpk1011/webgoat/blob/main/src/main/java/org/owasp/webgoat/webwolf/WebWolf.java"
click node_mailbox "https://github.com/anpk1011/webgoat/blob/main/src/main/java/org/owasp/webgoat/webwolf/mailbox/MailboxController.java"
click node_fileserver "https://github.com/anpk1011/webgoat/blob/main/src/main/java/org/owasp/webgoat/webwolf/FileServer.java"
click node_requests "https://github.com/anpk1011/webgoat/blob/main/src/main/java/org/owasp/webgoat/webwolf/requests/Requests.java"

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_docker,node_launcher,node_parentconfig toneBlue
class node_webgoatapp,node_security,node_users,node_progress,node_database,node_ui toneAmber
class node_lesson,node_scanner,node_templates,node_sqlbundle,node_assignment,node_tracking toneMint
class node_webwolfapp,node_mailbox,node_fileserver,node_requests toneRose
class node_browser toneNeutral
```

## Components

### Runtime

Standalone or Docker launches both local applications.

- [Docker packaging](https://github.com/anpk1011/webgoat/tree/main/Dockerfile): container packaging · Maps the WebGoat and WebWolf ports. · `Dockerfile`
- [Dual-app launcher](https://github.com/anpk1011/webgoat/blob/main/src/main/java/org/owasp/webgoat/server/StartWebGoat.java): Spring Boot bootstrap · Starts the two local application contexts. · `src/main/java/org/owasp/webgoat/server/StartWebGoat.java`
- [Parent configuration](https://github.com/anpk1011/webgoat/blob/main/src/main/java/org/owasp/webgoat/server/ParentConfig.java): Spring configuration · Provides shared launch wiring. · `src/main/java/org/owasp/webgoat/server/ParentConfig.java`

### WebGoat portal

Lesson portal, identity, progress, and exercise framework.

- [WebGoat application](https://github.com/anpk1011/webgoat/blob/main/src/main/java/org/owasp/webgoat/container/WebGoat.java): Spring MVC app · Serves the lesson portal at /WebGoat. · `src/main/java/org/owasp/webgoat/container/WebGoat.java`
- [Security and sessions](https://github.com/anpk1011/webgoat/blob/main/src/main/java/org/owasp/webgoat/container/WebSecurityConfig.java): Spring Security config · Protects portal requests and establishes current-user context. · `src/main/java/org/owasp/webgoat/container/WebSecurityConfig.java`
- [Users and identity](https://github.com/anpk1011/webgoat/blob/main/src/main/java/org/owasp/webgoat/container/users/UserService.java): user service · Persists registration and authenticated users. · `src/main/java/org/owasp/webgoat/container/users/UserService.java`
- [Lesson progress](https://github.com/anpk1011/webgoat/blob/main/src/main/java/org/owasp/webgoat/container/service/LessonProgressService.java): progress service · Records completion by lesson and assignment. · `src/main/java/org/owasp/webgoat/container/service/LessonProgressService.java`
- [Application database](https://github.com/anpk1011/webgoat/blob/main/src/main/resources/db/container/V1__init.sql): relational database · Initialized with core and lesson-specific migrations. · `src/main/resources/db/container/V1__init.sql`
- [Portal UI shell](https://github.com/anpk1011/webgoat/blob/main/src/main/resources/webgoat/templates/main_new.html): Backbone/jQuery client · Loads menus, lesson content, hints, status, and reports. · `src/main/resources/webgoat/templates/main_new.html`

### Lesson system

Modular educational content and intentionally vulnerable exercises.

- [Lesson abstraction](https://github.com/anpk1011/webgoat/blob/main/src/main/java/org/owasp/webgoat/container/lessons/Lesson.java): lesson metadata · Shared lesson and assignment contract. · `src/main/java/org/owasp/webgoat/container/lessons/Lesson.java`
- [Lesson discovery](https://github.com/anpk1011/webgoat/blob/main/src/main/java/org/owasp/webgoat/container/LessonResourceScanner.java): resource scanner · Discovers modular lessons and resource bundles. · `src/main/java/org/owasp/webgoat/container/LessonResourceScanner.java`
- [Lesson content renderer](https://github.com/anpk1011/webgoat/blob/main/src/main/java/org/owasp/webgoat/container/LessonTemplateResolver.java): template resolver · Assembles HTML, AsciiDoc, labels, and assets. · `src/main/java/org/owasp/webgoat/container/LessonTemplateResolver.java`
- [SQL injection lesson](https://github.com/anpk1011/webgoat/blob/main/src/main/java/org/owasp/webgoat/lessons/sqlinjection/introduction/SqlInjection.java): representative lesson · Representative intentionally vulnerable lesson implementation. · `src/main/java/org/owasp/webgoat/lessons/sqlinjection/introduction/SqlInjection.java`
- [Assignment execution](https://github.com/anpk1011/webgoat/blob/main/src/main/java/org/owasp/webgoat/container/assignments/AssignmentEndpoint.java): assignment endpoint · Accepts attack attempts and returns AttackResult validation. · `src/main/java/org/owasp/webgoat/container/assignments/AssignmentEndpoint.java`
- [Completion interceptor](https://github.com/anpk1011/webgoat/blob/main/src/main/java/org/owasp/webgoat/container/assignments/LessonTrackerInterceptor.java): lesson tracker · Persists successful assignment work. · `src/main/java/org/owasp/webgoat/container/assignments/LessonTrackerInterceptor.java`

### WebWolf companion

Local attacker-support application.

- [WebWolf application](https://github.com/anpk1011/webgoat/blob/main/src/main/java/org/owasp/webgoat/webwolf/WebWolf.java): Spring MVC app · Local auxiliary service at /WebWolf. · `src/main/java/org/owasp/webgoat/webwolf/WebWolf.java`
- [Mailbox service](https://github.com/anpk1011/webgoat/blob/main/src/main/java/org/owasp/webgoat/webwolf/mailbox/MailboxController.java): WebWolf controller · Provides exercise-targetable mailbox capabilities. · `src/main/java/org/owasp/webgoat/webwolf/mailbox/MailboxController.java`
- [File service](https://github.com/anpk1011/webgoat/blob/main/src/main/java/org/owasp/webgoat/webwolf/FileServer.java): WebWolf file server · Exposes uploaded files for exercises. · `src/main/java/org/owasp/webgoat/webwolf/FileServer.java`
- [Request capture](https://github.com/anpk1011/webgoat/blob/main/src/main/java/org/owasp/webgoat/webwolf/requests/Requests.java): WebWolf request service · Makes captured requests available to exercises. · `src/main/java/org/owasp/webgoat/webwolf/requests/Requests.java`

### Other components

- **Browser / proxy tools**: external client · Users interact directly or through security proxy tooling.

## Connections

- Docker packaging → Dual-app launcher: packages and runs
- Parent configuration → Dual-app launcher: shared wiring
- Dual-app launcher → WebGoat application: starts :8080
- Dual-app launcher → WebWolf application: starts :9090
- Browser / proxy tools → WebGoat application: portal requests
- Browser / proxy tools → WebWolf application: companion requests
- WebGoat application → Security and sessions: secures requests
- Security and sessions → Users and identity: resolves user
- Users and identity → Application database: persists users
- WebGoat application → Portal UI shell: serves shell
- WebGoat application → Lesson discovery: discovers lessons
- Lesson discovery → Lesson abstraction: loads metadata
- Lesson discovery → SQL injection lesson: finds lesson
- Lesson abstraction → Lesson content renderer: renders content
- Portal UI shell → Assignment execution: submits attempts
- SQL injection lesson → Assignment execution: vulnerable endpoints
- Assignment execution → Completion interceptor: successful result
- Completion interceptor → Lesson progress: records completion
- Lesson progress → Application database: persists progress
- WebWolf application → Mailbox service: exposes
- WebWolf application → File service: exposes
- WebWolf application → Request capture: exposes
- SQL injection lesson → WebWolf application: uses companion capabilities
