How owasp/threat-dragon works
Main Components
• Back-End Server (td.server): This Node.js/Express back-end contains configuration (environment and security headers), a suite of controllers (for auth, threat model management, etc.), environmental integrations for external providers, and repository layers to communicate with external systems. It also contains unit and integration tests.
• External Services/Repositories: The integration modules (providers and repositories) support external data sources such as GitHub, Bitbucket, and GitLab. They are represented by dedicated directories and files (e.g., providers in td.server/src/providers, repositories in td.server/src/repositories).
• Container & Deployment Environment: Dockerfile, GitHub workflows, and related configuration files indicate that the system is containerized and integrated with CI/CD pipelines.
• Additional Libraries & Helpers: Various helper modules (for encryption, logging, JWT handling, etc.) and configuration settings (eslintrc, babel, etc.) support both front-end and back-end components.
Relationships and Data Flow
• The Front-End communicates with the Back-End server through RESTful API endpoints (documented in service/api modules in td.vue and configured on td.server).
• The Back-End processes and verifies data, handles authentication, performs threat modeling CRUD operations, accesses external repositories through provider modules, and returns responses to the front-end.
• External integrations are invoked by both the back-end (for repository/file management, third-party authentication) and sometimes even from the front-end (during OAuth flows).
• CI/CD pipelines, container builds, and Docker images connect to the deployment process, stressing the importance of automated testing (shown in td.server/test and td.vue/tests) and containerized runtime.
Architectural Patterns and Design Principles
• Separation of Concerns: The clear split between the “td.vue” front-end and “td.server” back-end. Each has its own dependencies, tests, and service layers.
• Modularization: The project is organized into modules (controllers, providers, repositories, helpers for the back-end; components, views, store modules, services for the front-end), ensuring that changes in one area are isolated from others.
• Integration with External Platforms: The environment-specific provider modules (for GitHub, Bitbucket, GitLab, Google) show a pattern for pluggable integrations.
• Test-Driven Architecture: With extensive unit and end-to-end tests, the design ensures reliability and maintainability.