How vulnerable-apps/juice-shop works
Purpose and Runtime
OWASP Juice Shop is an intentionally vulnerable e-commerce application for security training, CTFs, and security-tool testing. It runs on Node.js (supported 18/20; README lists 20 as primary) and serves on port 3000. The backend is TypeScript/Node; the browser client is Angular. Primary server entry points are app.ts and server.ts; container deployment starts from Dockerfile.
Application Bootstrap and Customization
Startup assembles the Express application, validates prerequisites/configuration, applies branding and challenge setup, restores intentional mutable state, and registers WebSocket events. Configuration profiles alter behavior for CTF/tutorial/rebranding modes.
• app.ts
• server.ts
• lib/startup/validatePreconditions.ts
• lib/startup/customizeApplication.ts
• config/default.yml
HTTP/API Boundary
The server exposes a broad REST-style route layer for shop workflows, user identity, uploads, privacy operations, challenge-related endpoints, and intentionally insecure surfaces. Routes are the principal boundary between Angular clients/automation and backend domain/data logic. Static Angular distribution delivery is handled separately.
• routes/login.ts
• routes/basket.ts
• routes/order.ts
• routes/angular.ts
• routes/fileUpload.ts
Persistence and Domain Model
Sequelize-style domain models represent users, products, baskets, orders-related records, challenges, feedback, and privacy data. Data initialization/cache logic seeds the vulnerable shop and challenge catalog; MongoDB support is also present for selected data/runtime modes. Initial content and challenge definitions are versioned static inputs.
• models/index.ts
• models/relations.ts
• models/user.ts
• data/datacreator.ts
• data/mongodb.ts
• data/static/challenges.yml
Angular Storefront Client
The Angular SPA is bootstrapped from main.ts, composed by the root module and route table, then calls backend APIs through service classes and an HTTP interceptor. It implements storefront/account/checkout experiences alongside score-board, code-fix, and Web3 challenge UIs.
• frontend/src/main.ts
• frontend/src/app/app.module.ts
• frontend/src/app/app.routing.ts
• frontend/src/app/Services/request.interceptor.ts
• frontend/src/app/score-board/score-board.module.ts
Challenge and Training Engine
Challenges are data-driven but coupled to deliberately vulnerable backend/frontend behavior. Challenge utility, anti-cheat, coding-challenge, and instructor modules evaluate or guide progress; challenge status is presented through the SPA score board. Static code-fix alternatives support secure-coding exercises.
• lib/challengeUtils.ts
• lib/antiCheat.ts
• lib/codingChallenges.ts
• frontend/src/hacking-instructor/index.ts
• data/static/codefixes
Stateful/External Integration Surfaces
The app handles JWT/key material and two-factor authentication, Socket.IO-style real-time notifications, file/profile/complaint uploads, chatbot data, and optional blockchain/Web3/NFT flows. These are intentionally material attack boundaries, not merely ancillary integrations.
• encryptionkeys/jwt.pub
• routes/2fa.ts
• lib/startup/registerWebsocketEvents.ts
• routes/chatbot.ts
• routes/web3Wallet.ts
• uploads/complaints
Delivery and Operations
The repository supports direct Node execution, Docker, Docker Compose test environments, Vagrant, and GitLab/Heroku-oriented deployment artifacts. Monitoring exposes metrics and supplies a Grafana dashboard; CI/release automation is GitHub Actions-based.
• Dockerfile
• docker-compose.test.yml
• vagrant/Vagrantfile
• routes/metrics.ts
• monitoring/grafana-dashboard.json
Main entry points: login.ts REST route layer · app.ts Express application · challengeUtils.ts Challenge engine · app.module.ts Storefront modules & routes
Components 22
Angular Client
- SPA bootstrap
frontend/src/main.ts - Storefront modules & routes
frontend/src/app/app.module.ts - HTTP interceptor
frontend/src/app/Services/request.interceptor.ts - Score board
frontend/src/app/score-board/score-board.module.ts - Hacking instructor
frontend/src/hacking-instructor/index.ts
Node Application
- Server entry · Starts the application on the HTTP runtime.
server.ts - Express application
app.ts - Startup customization · Validates setup, applies branding, and restores mutable state.
lib/startup/customizeApplication.ts - Runtime profiles · Controls CTF, tutorial, and rebranding modes.
config/default.yml - REST route layer · Shop, identity, upload, privacy, and challenge endpoints.
routes/login.ts - Angular static delivery
routes/angular.ts
Data & Challenges
- Domain models & relations
models/index.ts - Seed & cache initialization
data/datacreator.ts - Challenge catalog
data/static/challenges.yml - Challenge engine · Evaluates challenge status and anti-cheat behavior.
lib/challengeUtils.ts - Secure code-fix content
data/static/codefixes
Attack Surfaces
Material stateful and external-facing boundaries.
- JWT & two-factor auth
routes/2fa.ts - WebSocket events
lib/startup/registerWebsocketEvents.ts - Uploads & chatbot
routes/fileUpload.ts - Web3 wallet flow
routes/web3Wallet.ts
Delivery & Observability
- Docker runtime
Dockerfile - Metrics & dashboard
routes/metrics.ts
Connections 25
- SPA bootstrap → Storefront modules & routes: boots
- Storefront modules & routes → HTTP interceptor: uses
- Storefront modules & routes → Score board: includes
- Storefront modules & routes → Hacking instructor: includes
- HTTP interceptor → REST route layer: API calls
- Server entry → Express application: runs
- Express application → Startup customization: initializes
- Startup customization → Runtime profiles: reads
- Startup customization → Seed & cache initialization: restores and seeds
- Startup customization → WebSocket events: registers
- Express application → REST route layer: mounts
- Express application → Angular static delivery: serves SPA
- REST route layer → Domain models & relations: domain access
- Seed & cache initialization → Domain models & relations: populates
- Seed & cache initialization → Challenge catalog: loads
- REST route layer → Challenge engine: checks progress
- Challenge engine → Challenge catalog: uses definitions
- Challenge engine → Secure code-fix content: supports exercises
- Score board → Challenge engine: shows status
- Hacking instructor → Challenge engine: guides
- REST route layer → JWT & two-factor auth: identity flows
- REST route layer → Uploads & chatbot: handles input
- REST route layer → Web3 wallet flow: wallet endpoints
- Express application → Metrics & dashboard: exposes
- Docker runtime → Server entry: starts