# woodruffw/zizmor architecture

> Architecture diagram of the GitHub repository woodruffw/zizmor, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/woodruffw/zizmor
- Repository: https://github.com/woodruffw/zizmor

## Overview

##### Main Components

a) Input Processing Layer
- GitHub Actions Workflow Files (.yml)
- Configuration Files

b) Core Analysis Engine
- This in the center as the main processing unit
- Subdivide into audit modules (shown in src/audit/)
- Expression parser (src/expr/)

c) Output Generation Layer
- SARIF Report Generation
- Finding Reporting
- Render this at the bottom

##### Component Relationships

**Input Layer → Core Engine → Output Layer**

**With detailed flows:**
**Workflow Files → Parser → Audit Modules → Findings → Renderer**

##### Detailed Component Breakdown

Core Analysis Engine should show these modules (from src/audit/):
- Artipacked Analysis
- Cache Poisoning Detection
- Dangerous Triggers Analysis
- Permissions Analysis
- GitHub Environment Security
- Container Credential Check
- Impostor Commit Detection
- Command Security Analysis
- Action Version Analysis
- Template Injection Detection

##### Supporting Systems

Auxiliary components:
- GitHub API Interface (github_api.rs)
- Configuration Manager (config.rs)
- State Management (state.rs)
- Registry Handler (registry.rs)

##### Integration Points

External integration points:
- GitHub API Communication
- File System Interaction
- SARIF Report Generation

- Input Processing
- Analysis Pipeline
- Result Generation

- Any abbreviations

## Diagram (Mermaid)

```mermaid
graph TB
    %% Input Layer
    subgraph Input
        WF[GitHub Actions Workflows]
        CF[Configuration Files]
    end

    %% Core Analysis Engine
    subgraph CoreEngine
        Parser["Expression Parser"]:::parser
        
        subgraph AuditModules["Audit Modules"]
            AA["Artipacked Analysis"]:::audit
            CP["Cache Poisoning"]:::audit
            DT["Dangerous Triggers"]:::audit
            PA["Permissions Analysis"]:::audit
            GE["GitHub Environment"]:::audit
            CC["Container Credentials"]:::audit
            IC["Impostor Commit"]:::audit
            CS["Command Security"]:::audit
            AV["Action Version"]:::audit
            TI["Template Injection"]:::audit
        end
    end

    %% Output Layer
    subgraph Output
        FR["Finding Reporter"]:::output
        SR["SARIF Report"]:::output
        RD["Renderer"]:::output
    end

    %% Supporting Systems
    subgraph Support
        GH["GitHub API"]:::support
        CM["Configuration Manager"]:::support
        SM["State Manager"]:::support
        RH["Registry Handler"]:::support
        UT["Utilities"]:::support
    end

    %% Relationships
    WF --> Parser
    CF --> CM
    Parser --> AuditModules
    AuditModules --> FR
    FR --> SR
    FR --> RD
    
    AuditModules -.-> GH
    CM -.-> SM
    SM -.-> RH

    %% Click Events
    click Parser "https://github.com/woodruffw/zizmor/tree/main/src/expr/"
    click AA "https://github.com/woodruffw/zizmor/blob/main/src/audit/artipacked.rs"
    click CP "https://github.com/woodruffw/zizmor/blob/main/src/audit/cache_poisoning.rs"
    click DT "https://github.com/woodruffw/zizmor/blob/main/src/audit/dangerous_triggers.rs"
    click PA "https://github.com/woodruffw/zizmor/blob/main/src/audit/excessive_permissions.rs"
    click GE "https://github.com/woodruffw/zizmor/blob/main/src/audit/github_env.rs"
    click CC "https://github.com/woodruffw/zizmor/blob/main/src/audit/hardcoded_container_credentials.rs"
    click IC "https://github.com/woodruffw/zizmor/blob/main/src/audit/impostor_commit.rs"
    click CS "https://github.com/woodruffw/zizmor/blob/main/src/audit/insecure_commands.rs"
    click AV "https://github.com/woodruffw/zizmor/blob/main/src/audit/unpinned_uses.rs"
    click TI "https://github.com/woodruffw/zizmor/blob/main/src/audit/template_injection.rs"
    click FR "https://github.com/woodruffw/zizmor/tree/main/src/finding/"
    click SR "https://github.com/woodruffw/zizmor/blob/main/src/sarif.rs"
    click RD "https://github.com/woodruffw/zizmor/blob/main/src/render.rs"
    click GH "https://github.com/woodruffw/zizmor/blob/main/src/github_api.rs"
    click CM "https://github.com/woodruffw/zizmor/blob/main/src/config.rs"
    click SM "https://github.com/woodruffw/zizmor/blob/main/src/state.rs"
    click RH "https://github.com/woodruffw/zizmor/blob/main/src/registry.rs"
    click UT "https://github.com/woodruffw/zizmor/blob/main/src/utils.rs"

    %% Styles
    classDef parser fill:#90EE90,stroke:#333,stroke-width:2px
    classDef audit fill:#FFD700,stroke:#333,stroke-width:2px
    classDef output fill:#87CEEB,stroke:#333,stroke-width:2px
    classDef support fill:#D3D3D3,stroke:#333,stroke-width:2px

    %% Legend
    subgraph Legend
        L1["Parser Component"]:::parser
        L2["Audit Module"]:::audit
        L3["Output Component"]:::output
        L4["Support System"]:::support
        L5["--> Required Flow"]
        L6["--> Optional Flow"]
    end
```
