# step-security/harden-runner architecture

> Architecture diagram of the GitHub repository step-security/harden-runner, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/step-security/harden-runner
- Repository: https://github.com/step-security/harden-runner

## Overview

Harden-Runner is a GitHub Actions security monitor for CI/CD runners. A workflow invokes the action; its runtime has a main step and setup/cleanup steps, while the README describes monitoring network and file activity and presenting security insights. The sampled sources show entry-point checks, cleanup dispatch, policy and TLS API helpers, and summary retrieval. Setup and agent installation are substantial product stages, but their implementation was not sampled, so their internal connections are omitted. README-described monitoring capabilities are retained without asserting unsampled call paths.

Main entry points: [`src/index.ts`](https://github.com/step-security/harden-runner/blob/main/src/index.ts) (Action entry), [`src/cleanup.ts`](https://github.com/step-security/harden-runner/blob/main/src/cleanup.ts) (Runner cleanup), [`src/tls-inspect.ts`](https://github.com/step-security/harden-runner/blob/main/src/tls-inspect.ts) (TLS status check), [`src/common.ts`](https://github.com/step-security/harden-runner/blob/main/src/common.ts) (Runtime reporting)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Action runtime"]
  node_entry["Action entry<br/>[index.ts]"]
  node_setup["Runner setup<br/>[setup.ts]"]
  node_cleanup["Runner cleanup<br/>[cleanup.ts]"]
  node_agentinstall["Agent installation<br/>[install-agent.ts]"]
  node_runnerchecks["Runner checks<br/>[utils.ts]"]
  node_arc["ARC detection<br/>[arc-runner.ts]"]
end

subgraph group_policy["Policy and configuration"]
  node_config["Runtime configuration<br/>[configs.ts]"]
  node_policyfetch["Policy retrieval<br/>[policy-utils.ts]"]
  node_bravoconfig["Bravo configuration<br/>[bravo-config.ts]"]
  node_interfaces["Configuration types<br/>[interfaces.ts]"]
  node_checksum["Agent verification<br/>[checksum.ts]"]
end

subgraph group_monitoring["Runner monitoring"]
  node_tls["TLS status check<br/>[tls-inspect.ts]"]
  node_agent["Runtime security agent"]
  node_cache["Agent cache support<br/>[cache.ts]"]
end

subgraph group_insights["Security insights"]
  node_common["Runtime reporting<br/>[common.ts]"]
end

node_workflow(("GitHub workflow"))
node_stepapi["StepSecurity API"]
node_insightsui["Security insights"]

node_workflow -->|"invokes"| node_entry
node_entry -->|"prints insights link"| node_common
node_entry -->|"checks runner"| node_tls
node_entry -->|"checks platform"| node_runnerchecks
node_cleanup -->|"adds summary"| node_common
node_cleanup -->|"checks runner"| node_tls
node_cleanup -->|"checks ARC"| node_arc
node_cleanup -->|"checks platform"| node_runnerchecks
node_entry -->|"configures API URL"| node_stepapi
node_common -->|"fetches summary"| node_stepapi
node_tls -->|"checks TLS status"| node_stepapi
node_policyfetch -->|"fetches policy"| node_stepapi
node_workflow -->|"sets up runner"| node_setup
node_workflow -->|"completes run"| node_cleanup
node_agent -->|"provides monitoring insights"| node_insightsui
node_workflow -->|"reviews results"| node_insightsui

click node_entry "https://github.com/step-security/harden-runner/blob/main/src/index.ts"
click node_setup "https://github.com/step-security/harden-runner/blob/main/src/setup.ts"
click node_cleanup "https://github.com/step-security/harden-runner/blob/main/src/cleanup.ts"
click node_agentinstall "https://github.com/step-security/harden-runner/blob/main/src/install-agent.ts"
click node_runnerchecks "https://github.com/step-security/harden-runner/blob/main/src/utils.ts"
click node_arc "https://github.com/step-security/harden-runner/blob/main/src/arc-runner.ts"
click node_config "https://github.com/step-security/harden-runner/blob/main/src/configs.ts"
click node_policyfetch "https://github.com/step-security/harden-runner/blob/main/src/policy-utils.ts"
click node_bravoconfig "https://github.com/step-security/harden-runner/blob/main/src/bravo-config.ts"
click node_interfaces "https://github.com/step-security/harden-runner/blob/main/src/interfaces.ts"
click node_checksum "https://github.com/step-security/harden-runner/blob/main/src/checksum.ts"
click node_tls "https://github.com/step-security/harden-runner/blob/main/src/tls-inspect.ts"
click node_cache "https://github.com/step-security/harden-runner/blob/main/src/cache.ts"
click node_common "https://github.com/step-security/harden-runner/blob/main/src/common.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_entry,node_setup,node_cleanup,node_agentinstall,node_runnerchecks,node_arc toneBlue
class node_config,node_policyfetch,node_bravoconfig,node_interfaces,node_checksum toneAmber
class node_tls,node_agent,node_cache,node_stepapi toneMint
class node_common toneRose
class node_workflow,node_insightsui toneIndigo
```

## Components

### Action runtime

- [Action entry](https://github.com/step-security/harden-runner/blob/main/src/index.ts): `src/index.ts`
- [Runner setup](https://github.com/step-security/harden-runner/blob/main/src/setup.ts): `src/setup.ts`
- [Runner cleanup](https://github.com/step-security/harden-runner/blob/main/src/cleanup.ts): `src/cleanup.ts`
- [Agent installation](https://github.com/step-security/harden-runner/blob/main/src/install-agent.ts): `src/install-agent.ts`
- [Runner checks](https://github.com/step-security/harden-runner/blob/main/src/utils.ts): `src/utils.ts`
- [ARC detection](https://github.com/step-security/harden-runner/blob/main/src/arc-runner.ts): `src/arc-runner.ts`

### Policy and configuration

- [Runtime configuration](https://github.com/step-security/harden-runner/blob/main/src/configs.ts): `src/configs.ts`
- [Policy retrieval](https://github.com/step-security/harden-runner/blob/main/src/policy-utils.ts): `src/policy-utils.ts`
- [Bravo configuration](https://github.com/step-security/harden-runner/blob/main/src/bravo-config.ts): `src/bravo-config.ts`
- [Configuration types](https://github.com/step-security/harden-runner/blob/main/src/interfaces.ts): `src/interfaces.ts`
- [Agent verification](https://github.com/step-security/harden-runner/blob/main/src/checksum.ts): `src/checksum.ts`

### Runner monitoring

- [TLS status check](https://github.com/step-security/harden-runner/blob/main/src/tls-inspect.ts): `src/tls-inspect.ts`
- **Runtime security agent**
- [Agent cache support](https://github.com/step-security/harden-runner/blob/main/src/cache.ts): `src/cache.ts`

### Security insights

- [Runtime reporting](https://github.com/step-security/harden-runner/blob/main/src/common.ts): `src/common.ts`

### Other components

- **GitHub workflow**
- **StepSecurity API**
- **Security insights**

## Connections

- GitHub workflow → Action entry: invokes (evidence: `README.md`)
- Action entry → Runtime reporting: prints insights link (evidence: `src/index.ts`)
- Action entry → TLS status check: checks runner (evidence: `src/index.ts`)
- Action entry → Runner checks: checks platform (evidence: `src/index.ts`)
- Runner cleanup → Runtime reporting: adds summary (evidence: `src/cleanup.ts`)
- Runner cleanup → TLS status check: checks runner (evidence: `src/cleanup.ts`)
- Runner cleanup → ARC detection: checks ARC (evidence: `src/cleanup.ts`)
- Runner cleanup → Runner checks: checks platform (evidence: `src/cleanup.ts`)
- Action entry → StepSecurity API: configures API URL (evidence: `src/index.ts`)
- Runtime reporting → StepSecurity API: fetches summary (evidence: `src/common.ts`)
- TLS status check → StepSecurity API: checks TLS status (evidence: `src/tls-inspect.ts`)
- Policy retrieval → StepSecurity API: fetches policy (evidence: `src/policy-utils.ts`)
- GitHub workflow → Runner setup: sets up runner (evidence: `README.md`)
- GitHub workflow → Runner cleanup: completes run (evidence: `README.md`)
- Runtime security agent → Security insights: provides monitoring insights (evidence: `README.md`)
- GitHub workflow → Security insights: reviews results (evidence: `README.md`)
