Repository navigation
CI: require maintainer approval for Docker image pushes - #471
Conversation
PRs (same-repo, fork, Dependabot) now build the image only, with no AWS credentials. The push job runs only on push to master (environment ecr-main, master branch only) and on dispatch or re-run (environment ecr-approval, maintainer reviewers). github.ref no longer goes straight into shell code. Branch and PR pushes no longer publish :staging automatically. A maintainer dispatches and approves instead. .github/SETUP.md gives the new role GitHubActions-ECR-Push-pybot, its trust (two exact immutable environment subjects) and ECR policy, the environment rules, and the safe switch-over order. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Pybot no longer changes the old shared role GitHubActions-ECR-Push: no trust edit, no permission edit, no session revoke. The guide says the old role is not gated and stays open to branch workflows of both repos until it is deleted. Back-end SETUP.md owns that deletion and the CloudTrail check of both ECR repos; this guide only points to it. The move now ends with a check of one master push through the new role (CloudTrail AssumeRoleWithWebIdentity or the run log). The new role uses an inline policy and create commands, as in back-end. ecr-approval reviewers are irvingpop and kylemh, the owner's choice. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| needs: [ci-success] | ||
| # First attempt of a push to master: reviewed by a code owner before merge, so no wait. | ||
| # Dispatch and re-runs (any ref, any writer): a maintainer must approve. | ||
| environment: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/master' && github.run_attempt == '1') && 'ecr-main' || 'ecr-approval' }} |
There was a problem hiding this comment.
medium security, confidence medium, pass security
Approval-free ecr-main depends on external branch-policy config
The no-approval path depends on the ecr-main environment being restricted to the master branch and on the AWS trust policy. The workflow file cannot enforce this, because a writer can edit it on a branch. If the environment is missing or lacks the master-only branch rule, GitHub auto-creates it with no protection. A branch workflow could then claim ecr-main and obtain AWS credentials without approval. The SETUP.md documents the requirement, but the PR does not verify it.
Model output from untrusted input. Check it before you act on it.
🟡 Clear to proceed: Claude of Duty logged 1 item to considerMission: Review the code. Protect the branch. Deploy the future. Note 1 finding to consider. It does not block this PR.
Run 45238057754, attempt 1 for head Claude of Duty never approves a PR. A human reviewer gives the final approval. 📋 Full review record: reasons, checks, signals, finding details, model summaries, token usageReviewed snapshot
Reasons the gate failed None. No reason applies. Checks (code, no model)
Signals (context only, never block)
Dependency changes None. Finding details
Blocking is decided by code from category and severity, never by the model. A finding in a blocking category blocks only at high or critical severity. Each row above merges findings of several passes at the same file, line and gate effect.
The Supply chain pass completed and reported no findings. Model summaries
Token usage
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| needs: [ci-success] | ||
| # First attempt of a push to master: reviewed by a code owner before merge, so no wait. | ||
| # Dispatch and re-runs (any ref, any writer): a maintainer must approve. | ||
| environment: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/master' && github.run_attempt == '1') && 'ecr-main' || 'ecr-approval' }} |
There was a problem hiding this comment.
medium bug, confidence medium, pass review
Environment expression compares run_attempt to string; may fall to ecr-approval
github.run_attempt is a number in expression contexts. GitHub's loose equality coerces '1' to a number so it likely works. However, the `ecr-main` environment is restricted to the master branch, and this expression is the only selector. If the comparison ever fails, every master push would silently require approval and hang. This is a low-likelihood fragility.
Model output from untrusted input. Check it before you act on it.
| needs: [ci-success] | ||
| # First attempt of a push to master: reviewed by a code owner before merge, so no wait. | ||
| # Dispatch and re-runs (any ref, any writer): a maintainer must approve. | ||
| environment: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/master' && github.run_attempt == '1') && 'ecr-main' || 'ecr-approval' }} |
There was a problem hiding this comment.
medium security, confidence medium, pass security
ecr-main push path has no approval and depends on external settings
Any push to master gets AWS credentials with no reviewer wait. Safety rests on the branch-only rule for master in the ecr-main environment and on the org ruleset requiring code-owner review. None of this is verifiable in the PR. If the environment is misconfigured, or a writer or admin bypasses the ruleset, a push to master can push :prod. The old shared role also remains assumable from any branch workflow until it is deleted, which the docs acknowledge, so the gate is not effective until then.
Model output from untrusted input. Check it before you act on it.
Why
Any same-repo PR can assume the shared AWS role
GitHubActions-ECR-Pushand pushpybot:staging. The role also has push rights to the back-end ECR repo. Dependabot PRs fail the Docker job because they get no AWS secrets. This is the same fix as OperationCode/back-end#423.What changes
.github/workflows/ci.yml: PRs build only, and the push job runs in a GitHub Environment..github/SETUP.md: the environments, the new role, the switch-over order, and how a maintainer pushes to staging.Behavior change: branch and PR pushes no longer publish
:stagingautomatically. A maintainer approves a manual run instead.Before merge
The environments and the new role (managed in operationcode_infra Terraform) must exist, and
AWS_ROLE_ARNmust point to the new role. See.github/SETUP.md. The old shared role is deleted after both repos have moved.Review
🤖 Generated with Claude Code