Add GitHub Actions JWT auth mount for IUCLabs #175

Merged
benvin merged 6 commits from benvin/github-oidc-mount into master 2026-11-10 23:25:32 +11:00
Member

IUCLabs GitHub Actions workflows need read access to their own KV secrets without per-repo role and policy plumbing.

  • add auth/jwt/github/iuclabs JWT mount trusting GitHub Actions OIDC
  • add org-wide default role (mount default_role): audience https://vault.service.consul:8200, user_claim=jti, metadata mappings, 15m/1h TTLs
  • restrict to repository_owner=IUCLabs, events push/release/schedule/pull_request, refs heads/tags/pull-merge; validation rejects anything wider
  • attach templated read-only policy on kv/github/<repo>/event/<event>/* and kv/github/<repo>/ref/<ref>/.secrets/*
  • add tofu test cases, run by make test and pre-commit
  • document login, KV layout, event-path scope, + ref caveat and entity growth

Pairs with the terraform-git ref-name ruleset.

IUCLabs GitHub Actions workflows need read access to their own KV secrets without per-repo role and policy plumbing. - add `auth/jwt/github/iuclabs` JWT mount trusting GitHub Actions OIDC - add org-wide `default` role (mount `default_role`): audience `https://vault.service.consul:8200`, `user_claim=jti`, metadata mappings, 15m/1h TTLs - restrict to `repository_owner=IUCLabs`, events push/release/schedule/pull_request, refs heads/tags/pull-merge; validation rejects anything wider - attach templated read-only policy on `kv/github/<repo>/event/<event>/*` and `kv/github/<repo>/ref/<ref>/.secrets/*` - add `tofu test` cases, run by `make test` and pre-commit - document login, KV layout, event-path scope, `+` ref caveat and entity growth Pairs with the terraform-git ref-name ruleset.
unkin-agent added 1 commit 2026-11-10 22:26:52 +11:00
Add GitHub Actions JWT auth mount for IUCLabs
ci/woodpecker/pr/plan Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful
b20193ed40
Author
Member
  • modules/vault_cluster/modules/auth_jwt_role/variables.tf:28 — bound_claims validation only checks key presence; repository: IUCLabs/* or ref: refs/* / * (with bound_claims_type glob) passes and matches refs/pull/N/merge, defeating the stated goal → when bound_claims_type is glob, reject */?/[ in repository, ref and environment (or drop glob support); also reject empty/null values (ref: "" passes contains(keys))
  • modules/vault_cluster/modules/auth_jwt_role/variables.tf:28 — ref: refs/heads/main does not exclude pull_request_target runs (ref is the base branch, checkout can be PR code) → also require an event_name/job_workflow_ref bound claim (e.g. event_name != pull_request_target via exact event_name: push/workflow_dispatch), or at least document it
  • README.md:44 — environment alone is documented as sufficient, but a same-repo PR can add environment: <env> to its workflow unless the environment has deployment-branch/reviewer protection → document that the environment must restrict branches, or require ref always
  • tests/test_auth_jwt_role.py:11 — test re-implements the rule in Python instead of exercising the terraform validation, and test_repo_roles is vacuous (no roles shipped); no wildcard/empty-value cases → move the checks into one shared place (or test the glob/empty cases against the same rule) and add cases for refs/*, IUCLabs/*, ""
  • nit: modules/vault_cluster/main.tf:130 — strict var.policy_auth_map[...] matches auth_kubernetes_role, but a role yaml without a policy entry fails plan with Invalid index → acceptable per convention; say so in the README snippet
- modules/vault_cluster/modules/auth_jwt_role/variables.tf:28 — bound_claims validation only checks key presence; `repository: IUCLabs/*` or `ref: refs/*` / `*` (with bound_claims_type glob) passes and matches refs/pull/N/merge, defeating the stated goal → when bound_claims_type is glob, reject `*`/`?`/`[` in repository, ref and environment (or drop glob support); also reject empty/null values (`ref: ""` passes contains(keys)) - modules/vault_cluster/modules/auth_jwt_role/variables.tf:28 — `ref: refs/heads/main` does not exclude pull_request_target runs (ref is the base branch, checkout can be PR code) → also require an `event_name`/`job_workflow_ref` bound claim (e.g. event_name != pull_request_target via exact `event_name: push`/`workflow_dispatch`), or at least document it - README.md:44 — `environment` alone is documented as sufficient, but a same-repo PR can add `environment: <env>` to its workflow unless the environment has deployment-branch/reviewer protection → document that the environment must restrict branches, or require `ref` always - tests/test_auth_jwt_role.py:11 — test re-implements the rule in Python instead of exercising the terraform validation, and test_repo_roles is vacuous (no roles shipped); no wildcard/empty-value cases → move the checks into one shared place (or test the glob/empty cases against the same rule) and add cases for `refs/*`, `IUCLabs/*`, `""` - nit: modules/vault_cluster/main.tf:130 — strict `var.policy_auth_map[...]` matches auth_kubernetes_role, but a role yaml without a policy entry fails plan with Invalid index → acceptable per convention; say so in the README snippet
unkin-agent added 1 commit 2026-11-10 22:36:47 +11:00
Require exact repository, ref and event_name on JWT roles
ci/woodpecker/pr/plan Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful
7e17e51a18
unkin-agent added 1 commit 2026-11-10 22:44:40 +11:00
Replace per-repo JWT roles with an org role reading templated KV paths
ci/woodpecker/pr/plan Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful
0608019276
unkin-agent added 1 commit 2026-11-10 22:51:48 +11:00
Terminate ref KV paths with a .secrets segment
ci/woodpecker/pr/plan Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful
d6c1e24e70
Author
Member
  • modules/vault_cluster/modules/auth_jwt_role/main.tf:3 — event/<event_name>/* is not ref-scoped: a push to any branch (or tag) by any repo writer reads every event/push/* secret, so README:55 (event/push/deploy) puts a deploy token behind any-branch push → state this in the README and point deploy secrets at ref/refs/heads/main/.secrets/, or add ref scoping to the event paths.
  • nit: modules/vault_cluster/modules/auth_jwt_role/tests/bound_claims.tftest.hcl:385 — accept_exact_refs has no assert, so it only proves the plan does not fail → assert the role renders the exact refs or drop the case.
- modules/vault_cluster/modules/auth_jwt_role/main.tf:3 — `event/<event_name>/*` is not ref-scoped: a push to any branch (or tag) by any repo writer reads every `event/push/*` secret, so README:55 (`event/push/deploy`) puts a deploy token behind any-branch push → state this in the README and point deploy secrets at `ref/refs/heads/main/.secrets/`, or add `ref` scoping to the event paths. - nit: modules/vault_cluster/modules/auth_jwt_role/tests/bound_claims.tftest.hcl:385 — `accept_exact_refs` has no assert, so it only proves the plan does not fail → assert the role renders the exact refs or drop the case.
unkin-agent added 1 commit 2026-11-10 23:06:18 +11:00
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
5c33f2d433
Author
Member

No findings.

No findings.
unkin-agent added 1 commit 2026-11-10 23:17:21 +11:00
Rename JWT role to default and set it as mount default_role
ci/woodpecker/pr/plan Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful
9e3c7d250d
Author
Member

No findings.

No findings.
benvin merged commit b9ae4a6802 into master 2026-11-10 23:25:32 +11:00
benvin deleted branch benvin/github-oidc-mount 2026-11-10 23:25:32 +11:00
This repo is archived. You cannot comment on pull requests.
No Reviewers
No Label
1 Participants
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: unkin/terraform-vault#175