Restrict server-edition deploy environment to main branch

Open Beginner friendly
#54 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
74/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
gcp, github-actions, terraform

Research direction

Start in terraform/gcloud_auth.tf by locating the GitHub OIDC workload identity pool provider and its deploy attribute condition. Review whether release branches need deploy access, then validate the Terraform configuration; done means non-main branch workflows cannot authenticate to the deploy environment unless an explicitly approved branch policy allows them.

Written by the indexing model from the issue text.

Description

Problem

The GitHub OIDC workload identity pool provider in terraform/gcloud_auth.tf validates repository_owner and environment claims, but does not restrict by branch. Because deploy permissions are bound to attribute.repository/fullstaq-ruby/server-edition, workflows from non-main branches in fullstaq-ruby/server-edition can potentially authenticate if they run in the deploy environment.

Proposed Change

Add a ref restriction to the deploy pool's attribute condition:

attribute_condition = "assertion.repository_owner == 'fullstaq-ruby' && assertion.environment == 'deploy' && assertion.ref == 'refs/heads/main'"

Considerations

Review whether non-main branches ever need deploy access (e.g., release branches). If so, use a prefix match instead of exact match.

Dominant language
HCL
Stars
10
Forks
2
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from fullstaq-ruby/infra

All issues in fullstaq-ruby/infra

Similar issues

More Cloud issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.