Add IUCLabs release JWT role for artifactapi-writer tokens #182
@@ -0,0 +1,22 @@
|
||||
---
|
||||
bound_audiences: ["https://vault.service.consul:8200"]
|
||||
bound_claims:
|
||||
repository_owner: IUCLabs
|
||||
event_name: push
|
||||
ref: refs/tags/v*
|
||||
claim_mappings:
|
||||
repository: repository
|
||||
repository_owner: repository_owner
|
||||
ref: ref
|
||||
ref_type: ref_type
|
||||
event_name: event_name
|
||||
workflow: workflow
|
||||
job_workflow_ref: job_workflow_ref
|
||||
run_id: run_id
|
||||
run_attempt: run_attempt
|
||||
sha: sha
|
||||
actor: actor
|
||||
environment: environment
|
||||
user_claim: jti
|
||||
token_ttl: 900
|
||||
token_max_ttl: 900
|
||||
@@ -59,6 +59,22 @@ run "accept_exact_refs" {
|
||||
}
|
||||
}
|
||||
|
||||
run "accept_release_tag_glob" {
|
||||
command = plan
|
||||
variables { bound_claims = { repository_owner = "IUCLabs", event_name = "push", ref = "refs/tags/v*" } }
|
||||
|
||||
assert {
|
||||
condition = vault_jwt_auth_backend_role.role.bound_claims.ref == "refs/tags/v*"
|
||||
error_message = "release tag glob must pass through to bound_claims unchanged"
|
||||
}
|
||||
}
|
||||
|
||||
run "reject_ref_tags_other_prefix_glob" {
|
||||
command = plan
|
||||
variables { bound_claims = { repository_owner = "IUCLabs", event_name = "push", ref = "refs/tags/x*" } }
|
||||
expect_failures = [var.bound_claims]
|
||||
}
|
||||
|
||||
run "accept_with_repository" {
|
||||
command = plan
|
||||
variables { bound_claims = { repository_owner = "IUCLabs", event_name = "push,release,schedule,pull_request", ref = "refs/heads/*,refs/tags/*,refs/pull/*/merge", repository = "IUCLabs/app" } }
|
||||
|
||||
@@ -47,10 +47,10 @@ variable "bound_claims" {
|
||||
}
|
||||
validation {
|
||||
condition = alltrue([for v in split(",", lookup(var.bound_claims, "ref", "")) :
|
||||
contains(["refs/heads/*", "refs/tags/*", "refs/pull/*/merge"], trimspace(v)) ||
|
||||
contains(["refs/heads/*", "refs/tags/*", "refs/tags/v*", "refs/pull/*/merge"], trimspace(v)) ||
|
||||
can(regex("^(refs/(heads|tags)/[A-Za-z0-9._/-]+|refs/pull/[0-9]+/merge)$", trimspace(v)))
|
||||
])
|
||||
error_message = "bound_claims.ref must be refs/heads/*, refs/tags/*, refs/pull/*/merge or exact refs of those shapes."
|
||||
error_message = "bound_claims.ref must be refs/heads/*, refs/tags/*, refs/tags/v*, refs/pull/*/merge or exact refs of those shapes."
|
||||
}
|
||||
validation {
|
||||
condition = alltrue(flatten([for k, v in var.bound_claims : [
|
||||
|
||||
@@ -5,6 +5,8 @@ rules:
|
||||
- read
|
||||
|
||||
auth:
|
||||
jwt/github/iuclabs:
|
||||
- release
|
||||
k8s/au/syd1:
|
||||
- woodpecker_artifactapi_writer
|
||||
ldap:
|
||||
|
||||
Reference in New Issue
Block a user