How hackmanit/template-injection-playground works
The Template Injection Playground is a multi-language web application designed as a test bed for numerous template engines and their injection vulnerabilities. Its primary purpose is to provide isolated, ready-to-run web applications—each built using different template engines across various programming languages (such as .NET, Elixir, Go, Java, JavaScript, PHP, Python, and Ruby)—so that users can experiment with and detect template injection issues. The accompanying README emphasizes features such as optional countermeasures (sandboxing, encoding, denylisting) and provides detailed usage instructions via Docker Compose. This clearly identifies the project as a full-stack, multi-container playground for security testing and research.
Main Components
• Docker Compose Orchestrator: At the top level, include the orchestrator that uses docker-compose to build and run the multiple containers.
• Reverse Proxy (nginx): This container receives client requests (on port 13370 by default) and routes them to the appropriate backend services.
• Individual Backend Containers: Represent each language-specific application as separate backend components such as:
• .NET container (hosting the webapp3 application)
• Elixir container (hosting the Phoenix webapp)
• Go container (with main.go)
• Java container (Spring-based application)
• JavaScript container (Express-based demo)
• PHP container (example-app based on Laravel/Blade or similar)
• Python container (Flask webapp)
• Ruby container (running the Ruby webapp)
• Template Engines & Security Options: Optionally, annotate that each backend has different template engine configurations and enhanced settings (e.g., sandboxing, header injection simulation).
Relationships and Interactions
• That every backend container encapsulates a specific set of template engines and associated configurations, under the control of Docker.
Architectural Patterns
• Microservices/Containerized Architecture: Emphasize that the backend services are isolated microservices each dedicated to one technology stack.
• Docker-based Deployment: Indicate that all components are containerized and orchestrated using Docker Compose and include configuration files (like docker-compose.yml and Dockerfiles).
Relevant Technologies, Frameworks, and Libraries
• .NET: Uses ASP.NET Core with Razor, DotLiquid, Fluid, and Scriban.
• Elixir: Deploys a Phoenix application.
• Go: Uses the standard html/text/template package.
• Java: Incorporates frameworks like Spring, with template engines including Freemarker, Thymeleaf, Velocity, etc.
• JavaScript: Implements an Express server using multiple JavaScript template engines.
• PHP: Uses Laravel-like structure with Blade and other PHP template engines.
• Python: Demonstrates usage of Flask along with engines like Jinja2, Django templates, etc.
• Ruby: Implements a lightweight Ruby webapp using ERB, Haml, and others.
• Docker & Nginx: The infrastructure is managed via Docker Compose with each service container linked to the nginx reverse proxy.