# gakukohinata/timeidor architecture

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

- Interactive diagram: https://gitdiagram.com/gakukohinata/timeidor
- Repository: https://github.com/gakukohinata/timeidor

## Overview

##### Project type and purpose
- This is a small Node.js–based security demo (TimeIDOR) illustrating a time-based IDOR vulnerability in a “shop” web app.
- It includes a static frontend served from a public directory, a monolithic backend (server.js), and an external Python exploit script (exploit.py).

##### File structure
- Top-level files:
- server.js – the Node HTTP server
- exploit.py – attacker’s Python exploit script
- package.json / package-lock.json + node_modules – standard Node dependencies
- public/ – static assets and HTML pages:
- index.html – shop homepage
- cart.html – shopping cart page
- victim_inbox.html – victim’s mailbox UI
- attacker_inbox.html – attacker’s mailbox UI

##### README for additional insights
- The server listens on port 3388 and exposes three URLs: shop, victim mailbox, attacker mailbox.
- There is no external database; state is likely held in memory or in temporary files by server.js.
- The Python script connects to the same server to exploit the vulnerability.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Clients
    subgraph "Clients"
        direction TB
        Victim["Victim Browser"]:::victim
        Attacker["Attacker Browser"]:::attacker
        Exploit["Exploit.py Script"]:::attacker
    end

    %% Server Components
    subgraph "Server"
        direction TB
        Server["Node.js HTTP Server"]:::server
        Static["Public Static Assets"]:::storage
        Storage["In-memory Storage"]:::storage
    end

    %% Codebase Files
    subgraph "Codebase"
        direction TB
        ServerFile["server.js"]:::code
        ExploitFile["exploit.py"]:::code
        PublicDir["public/"]:::code
        IndexHTML["index.html"]:::code
        CartHTML["cart.html"]:::code
        VictimInboxHTML["victim_inbox.html"]:::code
        AttackerInboxHTML["attacker_inbox.html"]:::code
        NodeModules["node_modules/"]:::code
        PackageJSON["package.json"]:::code
        PackageLock["package-lock.json"]:::code
        Readme["README.md"]:::code
    end

    %% Flows
    Victim -->|"HTTP GET/POST"| Server
    Attacker -->|"HTTP GET/POST"| Server
    Exploit -.->|"Automated HTTP Requests"| Server
    Server -->|"Serves Static Files"| Static
    Static -->|"Delivers HTML/CSS/JS"| Victim
    Static -->|"Delivers HTML/CSS/JS"| Attacker
    Server -->|"Reads/Writes Messages"| Storage
    Exploit -.->|"Abuses IDOR to read victim mailbox"| Server

    %% Codebase relationships
    ServerFile --> Server
    ExploitFile --> Exploit
    PublicDir --> Static
    PublicDir --> IndexHTML
    PublicDir --> CartHTML
    PublicDir --> VictimInboxHTML
    PublicDir --> AttackerInboxHTML
    NodeModules --> ServerFile
    PackageJSON --> ServerFile
    PackageLock --> ServerFile
    Readme -.-> ServerFile

    %% Click Events
    click ServerFile "https://github.com/gakukohinata/timeidor/blob/main/server.js"
    click ExploitFile "https://github.com/gakukohinata/timeidor/blob/main/exploit.py"
    click PublicDir "https://github.com/gakukohinata/timeidor/tree/main/public/"
    click IndexHTML "https://github.com/gakukohinata/timeidor/blob/main/public/index.html"
    click CartHTML "https://github.com/gakukohinata/timeidor/blob/main/public/cart.html"
    click VictimInboxHTML "https://github.com/gakukohinata/timeidor/blob/main/public/victim_inbox.html"
    click AttackerInboxHTML "https://github.com/gakukohinata/timeidor/blob/main/public/attacker_inbox.html"
    click NodeModules "https://github.com/gakukohinata/timeidor/tree/main/node_modules/"
    click PackageJSON "https://github.com/gakukohinata/timeidor/blob/main/package.json"
    click PackageLock "https://github.com/gakukohinata/timeidor/blob/main/package-lock.json"
    click Readme "https://github.com/gakukohinata/timeidor/blob/main/README.md"

    %% Styles
    classDef victim fill:#dcfce7,stroke:#10b981,color:#065f46
    classDef attacker fill:#fee2e2,stroke:#ef4444,color:#991b1b
    classDef server fill:#dbeafe,stroke:#3b82f6,color:#1e40af
    classDef storage fill:#fef3c7,stroke:#f59e0b,color:#92400e
    classDef code fill:#f3f4f6,stroke:#9ca3af,color:#374151,stroke-dasharray: 2 2
```
