> For AI agents: the complete documentation index is available at https://docs.hod.sh/llms.txt, the full documentation bundle is available at https://docs.hod.sh/llms-full.txt.

# Components

Pipelines use published components (`uses: hod/setup-go@v1`) pinned in
`hod.lock` ([`hod.lock` reference](https://docs.hod.sh/reference/lock.md)). Before a run
compiles, the server fetches each locked digest with its own registry
credentials, caches the files, and checks the org's policy: the source is
allowed, the version isn't blocked, and the signature is the source's.
Runners get the files from the server, never from the registry. `hod
component update` on a machine logged in to the server resolves through
it, under the same policy.

## Policy

```toml
[components]
cooldown_days = 3                                  # third-party versions wait this long
prefixes = { "acme/" = "registry.acme.com/ci/" }   # short names; hod/ is built in
own = ["registry.acme.com/ci/**"]                  # the org's own: no cooldown, runs: job allowed
runs_job = ["ghcr.io/vendor/setup-*"]              # third-party runs: job components allowed
gateway = ["ghcr.io/vendor/guard"]                # guards that may be a job's gateway, besides hod/*
blocked = ["ghcr.io/vendor/tool@1.2.3", "sha256:…", "ghcr.io/evil/**"]

[[components.sources]]                             # the first match decides
repository = "ghcr.io/vendor/**"
keyless = { issuer = "https://token.actions.githubusercontent.com", identity = "https://github.com/vendor/*/.github/workflows/release.yml@refs/tags/*" }

[[components.sources]]
repository = "registry.acme.com/ci/**"
name = "acme"
key_file = "/etc/hod/acme-components.pub"          # a P-256 public key, PEM

[[components.registries]]                          # the server's credentials
host = "registry.acme.com"
username = "hod"
password_file = "/run/secrets/registry-token"
```

- **Globs** are anchored: `*` stays within a `/`-separated segment, `**`
  crosses segments. Identities are matched the same way, never as regexes.
- **`hod/`** components are signed with the Hod project key, built into
  Hod. Pulling one reaches `registry.hod.sh` and
  `pkg-containers.githubusercontent.com` (GHCR's blobs), so egress allow
  lists need both. `hod_prefix` and `hod_key_file` point `hod/` at a
  mirror signed with a key of your own.
- **The cooldown** counts from the signature's proved time, or from when
  the server first saw the version; never from a date the publisher wrote.
- **The policy** is stored per org in Postgres and replaced from this file on
  every start. Blocking a version stops the next run that uses it, even if
  it is already locked.

## Secrets sealed to components

- **A secret sealed to components** (`hod secret set DEPLOY_KEY --component hod/deploy`) is released only to steps running one of them
  with `runs: container`, in a container of its own. Those steps can't set
  `env:` or `dir:`, and they get none of the job's `env:` or what earlier
  components exported, only Hod's own variables, their inputs and their
  grants, with their image's own `PATH`. Pass what the component needs as
  `with:` inputs. A `runs: job` component runs among the job's processes,
  which could read its secret, so the seal refuses it.
- **The seal also pins where the secret goes.** A component marks the
  inputs that say where it sends things (`destination: true`, such as a
  registry). A sealed step must leave each at its default, or set it to a
  value the secret pins:

  ```sh
  hod secret set NPM_TOKEN --component hod/npm-publish \
    --with registry=https://npm.acme.internal/
  ```

  Repeat `--with` for more inputs, or for more values of one. Values are
  compared exactly, and must be known when the job starts, not read from
  earlier steps. A destination with no default needs a pin. `--component`
  without `--with` keeps the pins if it names the same components, and
  clears them if it names others, so pins never carry over to other
  components; `--no-with` removes the pins; `--no-components` removes the
  seal and its pins.
- **A component's `network:` may name an input** (`inputs.registry`): the
  egress guard allows that input's host, so a pinned internal registry is
  the host it opens, not the public one.
