# dsrodriguezse/api_security_tester architecture

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

- Interactive diagram: https://gitdiagram.com/dsrodriguezse/api_security_tester
- Repository: https://github.com/dsrodriguezse/api_security_tester

## Overview

##### Project type and purpose
- This is a Python‐based, command-line tool ("API Security Tester") designed to perform automated security assessments of RESTful APIs in cloud environments.
- It implements OWASP API Security Top 10 tests, orchestrates attack payload generation, HTTP request execution, response analysis, and report generation, all driven by CLI parameters or YAML/JSON configuration files.

##### File structure
- Top-level Python modules:
- main.py            – entry point and CLI argument parsing
- config.py          – loads and validates CLI args and config files (YAML/JSON)
- attack_generator.py – builds test payloads per OWASP categories
- request_executor.py – sends HTTP requests (handles timeouts, retries, delays, auth headers)
- response_analyzer.py – inspects responses for vulnerability indicators
- report_generator.py – formats and writes JSON, Markdown, HTML reports
- Configuration artifacts:
- config.yaml(.example) and pokeconfig.yaml – sample/default configuration
- Documentation in Docs/ covering installation, design, user manual, test environments
- requirements.txt – Python dependencies (e.g., requests, PyYAML)

##### README for additional insights
- Workflows supported: simple scan, authenticated scan, config-file‐driven runs, sample config generation.
- Reporting: selectable output formats (json, markdown, html, all).
- Integrates with CI/CD via CLI interface.
- Vulnerability categories implemented map directly to modules in attack_generator.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% CLI Interface
    CLI["CLI Interface"]:::cli
    CI["CI/CD Pipeline"]:::external

    %% Data Stores
    ConfigStore[(Configuration Files)]:::datastore
    Reports[(Output Reports)]:::datastore

    %% External System
    ExternalAPI(("External API Under Test")):::external

    %% Core Engine Grouping
    subgraph "Core Engine"
        Attack["Attack Generator"]:::core
        Request["Request Executor"]:::core
        Response["Response Analyzer"]:::core
        Report["Report Generator"]:::core
    end

    %% Config Loader
    Config["Configuration Loader"]:::core

    %% Flow
    CI -->|"invokes CLI"| CLI
    CLI -->|"CLI flags"| Config
    Config -->|"loads YAML/JSON"| ConfigStore
    Config -->|"config object"| Attack
    Attack -->|"attack payloads"| Request
    Request -->|"HTTP requests\n(timeouts,retries,delays)"| ExternalAPI
    ExternalAPI -->|"responses"| Response
    Response -->|"findings"| Report
    Report -->|"writes JSON, MD, HTML"| Reports
    Report -->|"exit status"| CLI

    %% Click Events
    click CLI "https://github.com/dsrodriguezse/api_security_tester/blob/main/main.py"
    click Config "https://github.com/dsrodriguezse/api_security_tester/blob/main/config.py"
    click ConfigStore "https://github.com/dsrodriguezse/api_security_tester/blob/main/config.yaml"
    click ConfigStore "https://github.com/dsrodriguezse/api_security_tester/blob/main/config.yaml.example"
    click ConfigStore "https://github.com/dsrodriguezse/api_security_tester/blob/main/pokeconfig.yaml"
    click Attack "https://github.com/dsrodriguezse/api_security_tester/blob/main/attack_generator.py"
    click Request "https://github.com/dsrodriguezse/api_security_tester/blob/main/request_executor.py"
    click Response "https://github.com/dsrodriguezse/api_security_tester/blob/main/response_analyzer.py"
    click Report "https://github.com/dsrodriguezse/api_security_tester/blob/main/report_generator.py"
    click CI "https://github.com/dsrodriguezse/api_security_tester/blob/main/README.md"

    %% Styles
    classDef cli fill:#FFFFE0,stroke:#333,stroke-width:1px
    classDef core fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef datastore fill:#90EE90,stroke:#333,stroke-width:1px
    classDef external fill:#D3D3D3,stroke:#333,stroke-width:1px
```
