# akto-api-security/tests-library architecture

> Architecture diagram of the GitHub repository akto-api-security/tests-library, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/akto-api-security/tests-library
- Repository: https://github.com/akto-api-security/tests-library

## Overview

- Test Library: Directories like “Broken-Function-Level-Authorization”, “Broken-User-Authentication”, “Command-Injection”, “Cross-Site-Scripting”, etc. contain YAML files that define specific vulnerability tests.
- Compliance Module: The “compliance” directory contains .conf files that likely define compliance test settings, thresholds, or policies.
- Remediation Content: The “remediation” directory holds Markdown (.md) documents that offer guidelines on how to fix each vulnerability, providing the “answers” to the tests.
- Resources: A “resources” folder that includes support files (e.g., a Geo-Country MMDB, HAR files, token files, and word lists) which likely support test execution or enrichment.
- License and Top-level README: These provide context for overall usage and deployment.

a. API Inventory Module – This is where APIs are ingested from various traffic sources (BurpSuite, AWS logs, gateways, Postman, etc). It maintains a continuous inventory.
b. Test Engine/Execution Module – This component uses the extensive test library (organized by vulnerability types in separate directories) to run business logic and security tests against the collected APIs.
c. Results and Vulnerability Analysis Module – This part collects test outcomes and flags vulnerabilities (from tests like BOLA, command injection, XSS, misconfigurations, etc.).
d. Remediation and Compliance Module – This reads from the “remediation” and “compliance” directories and maps detected issues to remediation steps and compliance validations.
e. Integration and Data Connectors – These represent how the system interfaces with different external traffic sources or tools (APIs from BurpSuite logs, AWS, gateways, etc.) and with CI/CD pipelines.
f. User and Reporting Interface – Although not extensively described in the file tree, based on the “How it works” flow (inventory creation, test execution, runtime vulnerability finding), an interface component is implied that displays dashboards and reports.

##### Interactions and Data Flows
c. Test Execution: The engine can run a diverse set of tests (each vulnerability category – e.g., “Broken-Object-Level-Authorization”, “CORS-Misconfiguration”, etc.) and outputs test results.
d. Analysis and Reporting: Test results are passed to the Results and Vulnerability Analysis Module. This module then either flags issues to be remediated or logs them for further analysis.
e. Remediation Guidance: When tests detect vulnerabilities, the system maps results to the remediation documentation. This connection assures that security teams know how to fix issues.
f. Dashboard/Interface: Finally, a reporting/user interface shows the API inventory, test results, remediation guidelines, and compliance status for continuous monitoring.

##### Architectural Patterns and Design Principles
a. Modular/Microservices-like design: Separate modules for test logic, inventory, and compliance. Although in the repo the tests exist as files, at runtime they are integrated into a larger “engine”.
b. Plug-n-Play Integration: “Akto” is advertised as “plug-n-play,” which suggests that connectors to external traffic sources (e.g., BurpSuite, AWS, gateways) are loosely coupled.
c. Separation of Concerns: Each vulnerability category is organized into its own directory, and remediation instructions are separated from test definitions. This maintains clarity and ease of updates.
d. CI/CD Integration: The design should highlight a pipeline connection that triggers security tests in CI/CD and pushes updated results to a central dashboard.

##### Final Touches
– Show external integrations (traffic ingestion, CI/CD pipeline) and internal repositories (test library, remediation guidelines) as distinct layers.
– Consider including a “Deployment” layer showing the underlying use of Docker containers for self-hosting based on the provided deploy script.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Inputs
    EC["External Connectors<br/>(BurpSuite, AWS, Gateways, Postman)"]:::external
    CICD["CI/CD Pipeline"]:::external

    %% Core Processing Layers
    API["API Inventory Manager"]:::service

    subgraph "Test Engine/Execution Module"
        TE_Main["Execution Engine"]:::service
        subgraph "Test Library"
            T1["Broken-Function-Level-Authorization"]:::component
            T2["Broken-Object-Level-Authorization"]:::component
            T3["Broken-User-Authentication"]:::component
            T4["Command-Injection"]:::component
            T5["Cross-Site-Scripting"]:::component
        end
    end

    VA["Results & Vulnerability Analysis Module"]:::service
    RC["Remediation & Compliance Module"]:::service
    UI["User & Reporting Interface"]:::frontend

    %% Data Repositories
    subgraph "Data Repositories"
        C["Compliance Configurations"]:::db
        R["Remediation Documents"]:::db
        RES["Resources"]:::db
        subgraph Documentation
            D1["LICENSE"]:::db
            D2["README.md"]:::db
        end
    end

    %% Data Flow Connections
    EC -->|"ingests API traffic"| API
    CICD -->|"triggers tests"| TE_Main
    API -->|"passes API data"| TE_Main
    RES -->|"supports testing"| TE_Main
    TE_Main -->|"executes tests"| VA
    T1 -.->|"test detail"| TE_Main
    T2 -.->|"test detail"| TE_Main
    T3 -.->|"test detail"| TE_Main
    T4 -.->|"test detail"| TE_Main
    T5 -.->|"test detail"| TE_Main
    VA -->|"analyzes results"| RC
    C -->|"config inputs"| RC
    R -->|"remediation info"| RC
    RC -->|"reports outcomes"| UI
    D1 ---|"documentation"| UI
    D2 ---|"documentation"| UI

    %% Click Events
    click T1 "https://github.com/akto-api-security/tests-library/tree/master/Broken-Function-Level-Authorization"
    click T2 "https://github.com/akto-api-security/tests-library/tree/master/Broken-Object-Level-Authorization"
    click T3 "https://github.com/akto-api-security/tests-library/tree/master/Broken-User-Authentication"
    click T4 "https://github.com/akto-api-security/tests-library/tree/master/Command-Injection"
    click T5 "https://github.com/akto-api-security/tests-library/tree/master/Cross-Site-Scripting"
    click C "https://github.com/akto-api-security/tests-library/tree/master/compliance"
    click R "https://github.com/akto-api-security/tests-library/tree/master/remediation"
    click RES "https://github.com/akto-api-security/tests-library/tree/master/resources"
    click D1 "https://github.com/akto-api-security/tests-library/tree/master/LICENSE"
    click D2 "https://github.com/akto-api-security/tests-library/blob/master/README.md"

    %% Styles
    classDef external fill:#fde2e2,stroke:#d9534f,stroke-width:2px;
    classDef service fill:#d9edf7,stroke:#31708f,stroke-width:2px;
    classDef component fill:#fcf8e3,stroke:#8a6d3b,stroke-width:2px;
    classDef db fill:#dff0d8,stroke:#3c763d,stroke-width:2px;
    classDef frontend fill:#d0e9c6,stroke:#3c763d,stroke-width:2px;
```
