Tools
Rhdh
OpenClaw plugin from JslYoon/openclaw-rhdh-plugin
Configuration Example
backend:
auth:
externalAccess:
- type: static
options:
subject: oce-agent # the RBAC identity this token carries
token: ${OCE_AGENT_TOKEN}
README
# openclaw-rhdh-plugin
An [OpenClaw](https://openclaw.io) plugin for **Red Hat Developer Hub (RHDH)**
and any [Backstage](https://backstage.io)-based portal. It gives an agent two
capabilities:
1. **Catalog reads** — query entities, read relations, and analyze blast
radius through the standard Backstage REST API.
2. **TechDocs publishing** — generate a maintainer manual from service source
code and publish it as a MkDocs site through a pull request.
The wire protocol is the standard Backstage catalog REST API, so the plugin
works against RHDH, backstage.io, or any Backstage distribution without
changes. RHDH is Red Hat's supported distribution of Backstage.
## What the agent can do
- `rhdh-catalog get|query|relations` — read entities, filter lists, and walk
the relation graph (read-only).
- `rhdh-publish` — commit a generated `mkdocs.yml` + `docs/` tree to a branch
and open a pull request. Never pushes to protected branches.
## Configuration
| Variable | Purpose |
| --- | --- |
| `RHDH_BASE_URL` | Portal base URL, e.g. `https://rhdh.example.com` |
| `RHDH_TOKEN` | Portal backend token, sent as Bearer. **Issue one token per agent identity** so portal RBAC policies scope each agent (see below). |
| `GITHUB_TOKEN` | Git provider token with read + pull-request write access to the docs repositories (publishing only) |
## Obtaining a portal token
There is no token-issuing endpoint to call: an RHDH backend token is a
random string you mint and register in the portal's config.
1. Generate a long random string:
```sh
openssl rand -base64 24
```
2. Register it in RHDH as a static external-access credential. In
app-config:
```yaml
backend:
auth:
externalAccess:
- type: static
options:
subject: oce-agent # the RBAC identity this token carries
token: ${OCE_AGENT_TOKEN}
```
Where this lands depends on the deployment: the RHDH Helm chart takes
it under the root-level `appConfig` values key (older charts:
`upstream.backstage.appConfig`); the RHDH Operator takes it in the
Backstage custom resource's `spec.application.appConfig`. Keep the
literal token in a Kubernetes Secret and reference it (`${...}`),
never in the values file committed to git.
3. Restart RHDH so the config takes effect. The token is now valid as
`Authorization: Bearer <token>` against the backend API.
4. Scope it: give the subject catalog read permission in the RBAC
plugin (CSV policy or admin UI) and nothing else. A static token
with no access restrictions can reach every plugin. See
[Permissions](#permissions).
5. Hand it to the agent as `RHDH_TOKEN` (or a workspace token file) and
verify:
```sh
rhdh-catalog query --filter kind=Component --fields metadata.name,spec.owner
```
A 401/403 means the token or the RBAC policy is wrong; report it, do
not retry.
Note: `backend.auth.externalAccess` with `type: static` requires a
recent Backstage core (current RHDH versions have it). Old RHDH 1.x
only supports the legacy `backend.auth.keys` scheme, where the token is
a signed JWT minted with the `backend-tokens` CLI instead of an
arbitrary string.
## Permissions
The portal token is subject to the portal's RBAC policies. Give each agent
its own service identity in RHDH and attach policies to it:
- A docs agent: narrow catalog read, one team's repos.
- A dependency-radar agent: broad catalog read.
Enforcement is two-layered: the token holder only reaches what RHDH RBAC
allows, and git-side permissions govern write scope. Catalog reads and write
authorization never share a credential.
## Security notes
- The token is never printed, logged, or committed by the tooling.
- Catalog commands are read-only; publishing is PR-gated.
- `rhdh-catalog` refuses to retry after HTTP 401/403 (report instead of
hammering the token).
## Integrate with OpenClaw Enterprise
See [OCE-INTEGRATION.md](OCE-INTEGRATION.md) for the full path from this
repository to a deployed agent reading your catalog, including the package
generator (`scripts/build-oce-package.sh`) and the deployment sequence.
## Status
Pilot. Tested against the Backstage catalog REST contract
(`/api/catalog/entities*`). See `skills/rhdh/SKILL.md` for the agent-facing
workflow documentation.
## License
Apache-2.0
tools
Comments
Sign in to leave a comment