# kac89/vulnrepo architecture

> Architecture diagram of the GitHub repository kac89/vulnrepo, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-02-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kac89/vulnrepo
- Repository: https://github.com/kac89/vulnrepo

## Overview

##### Project Type and Purpose
- Project Type: A single-page application (SPA) built with Angular.
- Purpose: It’s designed as a vulnerability report generator where all security-related data (issues, reports, attachments) are processed entirely client-side. It utilizes browser-based AES encryption for confidentiality (end-to-end encryption) and supports multiple functionalities such as importing vulnerabilities from scanners, using custom issue templates, and generating/exporting reports in various formats.

##### File Structure
- Top-Level Directories/Files:
- “src” is the heart of the Angular application (contains subdirectories for “app”, “assets”, “environments”, etc.).
- “e2e” supports end-to-end testing.
- Configuration files such as angular.json, Dockerfile, docker-compose.yml, and nginx.conf indicate support for Dockerized deployment and possibly a static file server with NGINX.
- Application Structure:
- The “src/app” folder is full of Angular components, dialogs, and services (e.g., encryption, API integration, report handling, etc.), which naturally suggests an MVC/multi-component architecture typical in Angular applications.
- There are numerous dialog components (e.g., dialog-addissue, dialog-edit, dialog-apierror, etc.) that indicate a heavy emphasis on interactive modals for user tasks.
- Service components (like api.service, message.service, and encryption/key validators) signal business logic encapsulated in reusable pieces.

##### README File for Additional Insights
- The README clarifies that the application is a front-end only solution that relies on the browser for data processing, encryption, and local storage.
- Features such as API integration hint that even though the main architecture is client-side, there might be communications with external backends or user-provided APIs via secure interfaces.

a. Main Components:
- Angular Client (Browser):
- UI/Presentation Layer: Consisting of the multiple Angular components (e.g., Home, Report, MyReports).
- Dialog/Modal Components: That handle critical interactions (edit, add, encryption dialogs, etc.).
- Services Layer:
▪ Encryption Service (AES encryption/decryption)
▪ API Integration Service (for optional backend communications)
▪ Local Storage/IndexedDB Management (to save user data locally)
▪ Utility and Message Services
- Assets & Static Content:
- JSON files, images, styles (CSS/SCSS), and vendor libraries (Bootstrap, jQuery, etc.) used by the Angular app.
- Deployment/Infrastructure components:
- Docker Container: Running the Angular application (as built by the Dockerfile and docker-compose) possibly served by an NGINX server.
- External API Endpoints (optional): Represented as integrations where users’ reports or imported scans can be sent or fetched from a backend service.

b. Relationships and Interactions:
- User interacts with the Browser-based Angular UI.
- UI components communicate with internal services (Encryption, Report Generation, API Integration).
- When a user requests to generate a report, the appropriate service formats data into chosen formats (TXT, HTML, DOCX, PDF via “print as PDF”).
- The encryption service processes sensitive data locally before any export or sharing.
- If enabled, the API integration service sends/receives data to/from external backend systems.
- Docker container and NGINX serve as the delivery mechanism for the static Angular files.

c. Architectural Patterns/Design Principles:
- Client-Side Architecture: The application is “backend-less,” emphasizing local processing for sensitive data.
- Component-Based UI: Angular’s modular component design is central.
- Service-Oriented/Dependency Injection: Angular’s services manage encryption, messaging, and API calls.
- Security by Design: Built-in encryption and local data handling as core principles.

d. Relevant Technologies, Frameworks, or Libraries:
- Angular Framework (using angular.json for configuration)
- Docker and NGINX (as seen in Dockerfile, docker-compose.yml, nginx.conf)
- Third-Party Libraries: Bootstrap, jQuery, CryptoJS (for encryption), Chart.js (for reporting visuals) as seen in the “assets/res” directories.
- Testing frameworks (Protractor, Karma) indicated by the e2e directory and test configuration files.

○ UI Components and Dialogs: “Home,” “Report,” “MyReports,” “Dialogs (Edit, Add, API errors, etc.)”
○ Service Layer: “Encryption Service,” “API Integration Service,” “Local Storage Service,” “Utility Services.”
- To the side, include the Assets block connecting with the Angular Client showing static files like logos, styles, vendor libraries.
- Below or beside, show the deployment infrastructure, linking the Angular build to a Docker container that is served via NGINX.

## Diagram (Mermaid)

```mermaid
flowchart TD
    U("User"):::user

    subgraph "Angular Client"
        AC("Angular Core"):::ui
        subgraph "UI Components"
            UI1("Home View"):::ui
            UI2("Report View"):::ui
            UI3("My Reports View"):::ui
        end
        subgraph "Dialog Components"
            D1("Add Issue Dialog"):::dialog
            D2("Edit Dialog"):::dialog
            D3("Encrypt Report Dialog"):::dialog
        end
        subgraph "Service Layer"
            S1("API Integration Service"):::service
            S2("Encryption Service"):::service
            S3("Local Data Management"):::service
            S4("Message Service"):::service
            S5("Utility Service"):::service
        end
    end

    A("Assets & Static Content"):::asset

    subgraph "Deployment & Infrastructure"
        DEP1("Docker Container Setup"):::deployment
        DEP2("NGINX Configuration"):::deployment
        DEP3("E2E Testing"):::deployment
    end

    EAPI("External API (Optional)"):::external

    %% Relationships and Dataflow
    U -->|"UserInput"| UI1
    AC -->|"initiate"| UI1
    A -->|"StaticAssets"| UI1
    UI1 -->|"EncryptData"| S2
    UI1 -->|"APICall"| S1
    UI2 -->|"EncryptReport"| S2
    UI3 -->|"RetrieveData"| S3
    S2 -->|"StoreData"| S3
    S1 ---|"externalCall"| EAPI
    DEP1 -->|"Deploy"| AC
    DEP2 -->|"Serve"| AC
    D1 -->|"AddIssue"| S3
    D2 -->|"Notify"| S4
    D3 -->|"EncryptInput"| S2

    %% Styles
    classDef ui fill:#ADD8E6,stroke:#000,stroke-width:1px;
    classDef dialog fill:#90EE90,stroke:#000,stroke-width:1px;
    classDef service fill:#FFD700,stroke:#000,stroke-width:1px;
    classDef deployment fill:#FFA07A,stroke:#000,stroke-width:1px;
    classDef external fill:#D3D3D3,stroke:#000,stroke-width:1px;
    classDef asset fill:#FFB6C1,stroke:#000,stroke-width:1px;
    classDef user fill:#E6E6FA,stroke:#000,stroke-width:1px;

    %% Click Events
    click AC "https://github.com/kac89/vulnrepo/tree/master/src/app"
    click UI1 "https://github.com/kac89/vulnrepo/blob/master/src/app/home/home.component.ts"
    click UI2 "https://github.com/kac89/vulnrepo/blob/master/src/app/report/report.component.ts"
    click UI3 "https://github.com/kac89/vulnrepo/blob/master/src/app/myreports/myreports.component.ts"
    click D1 "https://github.com/kac89/vulnrepo/blob/master/src/app/dialog-addissue/dialog-addissue.component.ts"
    click D2 "https://github.com/kac89/vulnrepo/blob/master/src/app/dialog-edit/dialog-edit.component.ts"
    click D3 "https://github.com/kac89/vulnrepo/blob/master/src/app/dialog-encrypt-report/dialog-encrypt-report.component.ts"
    click S1 "https://github.com/kac89/vulnrepo/blob/master/src/app/api.service.ts"
    click S2 "https://github.com/kac89/vulnrepo/blob/master/src/app/seckey-validator.service.ts"
    click S3 "https://github.com/kac89/vulnrepo/blob/master/src/app/indexeddb.service.ts"
    click S4 "https://github.com/kac89/vulnrepo/blob/master/src/app/message.service.ts"
    click S5 "https://github.com/kac89/vulnrepo/blob/master/src/app/utils.service.ts"
    click A "https://github.com/kac89/vulnrepo/tree/master/src/assets"
    click DEP1 "https://github.com/kac89/vulnrepo/tree/master/Dockerfile"
    click DEP2 "https://github.com/kac89/vulnrepo/blob/master/nginx.conf"
    click DEP3 "https://github.com/kac89/vulnrepo/tree/master/e2e"
```
