Scaffold vault-plugin-secrets-ghp secrets engine #1
Reference in New Issue
Block a user
Delete Branch "benvin/scaffold-ghp-engine"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
Machine callers of ghp (CI identities, agents) should never hold standing ghp
tokens. This engine mints ephemeral, scoped ghp access tokens on demand and
deletes them from ghp when the Vault lease is revoked or expires. It mirrors the
working
vault-plugin-secrets-giteaengine, adjusted for ghp specifics: a staticservice token instead of a rotated admin password, ghp's
POST /api/tokens/DELETE /api/tokens/{id}admin API, agent-token semantics, and ghp'sserver-side token expiry as defence-in-depth on top of the lease.
Changes
configpath:base_url(defaulthttps://ghp.unkin.net) + write-onlyadmin_token(ghpsvc_ service token) + TLS fields; verify the token is a ghpadmin (
GET /api/users) on write. Deliberately noconfig/rotate-root— theservice token is static and operator-managed.
roles/<name>path:token_type(agent default / proxy),installation_id,app_record_id,repositories,scopes(
permission:level),session_prefix,ttl,max_ttl.creds/<role>path: mint a lease-bound token; set the ghp-sidedurationto the lease ceiling so the token self-expires even if revocation never reaches
ghp.
ghp_tokendynamic secret: idempotent revoke (404 = success) + lease renew.plugin
cmdentrypoint.revocation, non-admin rejection) plus a mock-ghp e2e harness on Vault + OpenBao.
pre-commit/build/test(pull_request) andrelease(tag)pipelines — every step sets k8s resources +
serviceAccountName: default— aMakefilewithpatch|minor|majortag targets, and nfpm RPM packaging.Test
gofmt,go vet,go build ./..., andgo test -race ./...all pass.Mints ephemeral, scoped ghp access tokens via ghp's admin token API (POST /api/tokens), bound to a Vault lease and revoked on lease expiry (DELETE /api/tokens/{id}). - config: base_url + write-only admin_token (ghpsvc_ service token), TLS settings; verifies the token is a ghp admin on write. No rotate-root: the service token is static and operator-managed. - roles: token_type (agent/proxy), installation_id, app_record_id, repositories, scopes (permission:level), session_prefix, ttl/max_ttl. - creds: mint a lease-bound token; ghp-side duration bounded by the lease ceiling as defence in depth. - secret ghp_token: idempotent revoke + lease renew. - Unit tests (config/role/creds/client/scopes/revocation), mock-ghp e2e on Vault + OpenBao, Woodpecker pre-commit/build/test/release, Makefile patch/minor/major, nfpm RPM packaging.