Document event-path scope and + ref caveat; assert exact refs
ci/woodpecker/pr/plan Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful

This commit is contained in:
2026-11-10 23:06:11 +11:00
parent d6c1e24e70
commit 5c33f2d433
2 changed files with 9 additions and 2 deletions
+4 -2
View File
@@ -55,14 +55,16 @@ steps:
role: iuclabs
jwtGithubAudience: https://vault.service.consul:8200
secrets: |
kv/data/github/IUCLabs/<repo>/event/push/deploy token | DEPLOY_TOKEN
kv/data/github/IUCLabs/<repo>/ref/refs/heads/main/.secrets/deploy token | DEPLOY_TOKEN
```
The role attaches a templated read-only policy, so each run reads only its own KV-v2 secrets:
- `kv/github/<org>/<repo>/event/<event_name>/*`
- `kv/github/<org>/<repo>/event/<event_name>/*` is not ref-scoped: any run of that event in the repo, on any branch or tag a writer pushes, can read it; keep it for secrets every such run may use
- `kv/github/<org>/<repo>/ref/<full ref>/.secrets/*`, e.g. `ref/refs/heads/main/.secrets/`, `ref/refs/tags/v1.2.3/.secrets/`; git refnames can't contain a `.`-prefixed component, so branch `x` can never read branch `x/y`'s secrets
On OpenBao older than the fork's v2.6, a ref path component of exactly `+` acts as a single-segment wildcard in the templated policy. Public IUCLabs repos block such refs via a terraform-git ruleset; private repos are not protected, so a writer in a private repo can read that repo's other refs' secrets.
`user_claim` is `jti`, so every run creates its own Vault identity entity; Vault never garbage-collects these, so entity count grows with CI volume.
Extra policies are granted via a policy yaml `auth: {jwt/github/iuclabs: [iuclabs]}`; the KV read policy is attached automatically.
@@ -52,6 +52,11 @@ run "ref_paths_cannot_overlap_child_refs" {
run "accept_exact_refs" {
command = plan
variables { bound_claims = { repository_owner = "IUCLabs", event_name = "push,release,schedule,pull_request", ref = "refs/heads/main,refs/tags/v1.2.3,refs/pull/7/merge" } }
assert {
condition = vault_jwt_auth_backend_role.role.bound_claims.ref == "refs/heads/main,refs/tags/v1.2.3,refs/pull/7/merge"
error_message = "exact refs must pass through to bound_claims unchanged"
}
}
run "accept_with_repository" {