Skip to content

ci: harden CI/CD pipeline security#58

Open
ryanrishi wants to merge 4 commits into
mainfrom
secure-pipelines
Open

ci: harden CI/CD pipeline security#58
ryanrishi wants to merge 4 commits into
mainfrom
secure-pipelines

Conversation

@ryanrishi
Copy link
Copy Markdown
Member

@ryanrishi ryanrishi commented Jun 2, 2026

Summary

  • Pin all GitHub Actions to commit SHAs in CI workflow (prevents tag hijacking attacks)
  • Add top-level permissions: contents: read to CI workflow (least privilege)
  • Add if: github.repository_owner == 'twilio' guard to deploy workflow (prevents fork abuse)
  • Add github-actions ecosystem to dependabot configuration
  • Use uv sync --frozen in CI (installs exactly the vetted lockfile versions)
  • Add exclude-newer = "2 days" to [tool.uv] in pyproject.toml (quarantines freshly-published packages at uv lock / uv add time, not at install time)

Test plan

  • CI passes on this branch
  • Verify dependabot picks up the github-actions ecosystem

🤖 Generated with Claude Code

- Pin all GitHub Actions to commit SHAs in CI workflow
- Add top-level permissions: contents: read to CI
- Add repository owner guard to deploy workflow
- Add github-actions ecosystem to dependabot
- Add --exclude-newer quarantine (2-day) to uv sync in CI

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 2, 2026 20:20
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens the repository’s CI/CD posture by tightening GitHub Actions supply-chain security and minimizing default token permissions, while adding a Dependabot configuration to keep pinned actions up to date.

Changes:

  • Pin GitHub Actions in the CI workflow to specific commit SHAs and add top-level least-privilege permissions: contents: read.
  • Add a 2-day package “quarantine” to CI installs by applying uv sync --exclude-newer with a computed cutoff timestamp.
  • Prevent deploy workflow job execution outside the upstream org by guarding jobs with if: github.repository_owner == 'twilio', and enable Dependabot updates for github-actions.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
.github/workflows/deploy.yml Adds an org-owner guard to prevent fork-triggered deploy workflow execution.
.github/workflows/ci.yml Pins actions to SHAs, restricts workflow token permissions, and adds uv sync --exclude-newer quarantine behavior.
.github/dependabot.yml Adds github-actions ecosystem updates so pinned SHAs can be maintained automatically.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

ryanrouleau
ryanrouleau previously approved these changes Jun 2, 2026
xinghaohuang91
xinghaohuang91 previously approved these changes Jun 3, 2026
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ryanrishi ryanrishi dismissed stale reviews from xinghaohuang91 and ryanrouleau via 9bc1fad June 3, 2026 16:00
ryanrishi and others added 2 commits June 5, 2026 12:38
Record `exclude-newer = "2 days"` in [tool.uv] so the 2-day
supply-chain cooldown is enforced at lock time. Remove the CI
--exclude-newer flag since --frozen now respects the lockfile's
recorded option without mismatch.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.

Comment thread .github/workflows/ci.yml
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.

4 participants