Skip to content

Simplify deploy preview authorization to label-only check#431

Open
lmcrean wants to merge 5 commits intomainfrom
claude/secure-ci-pipeline-Rijms
Open

Simplify deploy preview authorization to label-only check#431
lmcrean wants to merge 5 commits intomainfrom
claude/secure-ci-pipeline-Rijms

Conversation

@lmcrean
Copy link
Owner

@lmcrean lmcrean commented Feb 20, 2026

Description

This PR simplifies the branch preview deployment authorization workflow by removing the collaborator permission check and making the deploy-preview label the sole authorization mechanism.

Changes Made

Workflow Security (deploy-branch-preview.yml)

  • Removed collaborator permission level checking logic
  • Simplified authorization to only check for deploy-preview label presence
  • Removed environment-based approval mechanism that allowed auto-deployment after initial approval
  • Streamlined comment posting logic to avoid duplicate notifications
  • Added security documentation comments explaining pull_request_target protection

Documentation

  • Added new CI_SECURITY.md explaining the security model:
    • How the label-based authorization works
    • Why pull_request_target prevents workflow bypass attacks
    • Guidance for maintainers on reviewing PRs before labeling
    • Incident response procedures
  • Updated project-config.yml to document actual required secrets (removed GCP_PROJECT_ID, added JWT_SECRET, REFRESH_SECRET, NEON_DATABASE_URL, GEMINI_API_KEY)

Cleanup

  • Removed TODO comment about CORS handling in reusable-deploy.yml

Security Rationale

The new approach is simpler and more secure:

  • Single control point: Only maintainers can add labels, preventing unauthorized deployments
  • Workflow immutability: Using pull_request_target ensures the main branch version of the workflow always executes, preventing attackers from modifying the check in their PR
  • No approval state: Removed the environment-based approval that persisted across commits, requiring explicit label addition for each deployment intent

How to Test

N/A - This is a configuration and documentation change. The workflow behavior is tested through GitHub Actions execution on PRs.

Checklist

  • Pulled the latest main branch and resolved any merge conflicts
  • No build or type errors (configuration changes only)
  • Added security documentation in CI_SECURITY.md
  • Updated project configuration to reflect actual secrets in use

Additional Notes

The simplified authorization model trades the flexibility of auto-deployment-after-approval for stronger security guarantees. Maintainers must now explicitly add the deploy-preview label for each deployment, but this ensures conscious review of each PR before deployment resources are allocated.

https://claude.ai/code/session_01FbfjQ4xZfUoxAdodg9yHd8

- Block auto-deployment when sensitive files modified (workflows, Dockerfile, etc.)
- Restrict auto-deploy to write/admin collaborators (not read-only)
- Add resource limit checks (max 10 preview services, 50 Docker images)
- Support preview-specific secrets to limit damage from exfiltration
- Add comprehensive security documentation in CI_SECURITY.md
- Update project-config.yml with security configuration section
Simplify security by requiring manual label for every PR, not just
external contributors. This prevents any malicious code from deploying
without explicit maintainer approval.
Remove extra complexity:
- Remove dangerous file detection (label check is sufficient)
- Remove preview-specific secrets
- Remove resource limit checks
- Simplify documentation

Only maintainers can add labels, so label = authorization.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants