Skip to content

chore(Workflows): pin commit SHA to prevent TOCTOU attack on fork deployments - #1682

Open
Marcosld wants to merge 4 commits into
masterfrom
commit-sha-input-for-fork-deployments
Open

chore(Workflows): pin commit SHA to prevent TOCTOU attack on fork deployments#1682
Marcosld wants to merge 4 commits into
masterfrom
commit-sha-input-for-fork-deployments

Conversation

@Marcosld

@Marcosld Marcosld commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • label-trigger-deploy now passes pr.head.sha as commitSha when dispatching the fork preview workflow, capturing the reviewed commit at the exact moment the safe-to-deploy label fires.
  • deploy-fork-pr-preview accepts commitSha as a required input, validates its format, and compares it against the live pr.head.sha before any checkout — failing immediately if the fork branch has been updated since the label was added.
  • Checkout now uses the pinned commit SHA directly instead of the dynamic merge ref.

Test plan

  • Add safe-to-deploy to a fork PR and verify the workflow dispatches and deploys successfully.
  • Push a new commit to the fork branch immediately after adding the label; verify the workflow fails with the SHA mismatch error before reaching the checkout step.
  • Attempt to dispatch the workflow manually with an invalid commitSha (e.g. wrong length); verify it fails validation.

🤖 Generated with Claude Code

…loyments

Pass pr.head.sha at label-time from label-trigger-deploy and validate it
against the live PR head in deploy-fork-pr-preview before any checkout,
so a fork author cannot sneak in malicious code after safe-to-deploy is added.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Marcosld
Marcosld requested a review from a team as a code owner August 3, 2026 11:41
@Marcosld Marcosld added the AI AI Generated label Aug 3, 2026
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

Size stats

master this branch diff
Total JS 15.7 MB 15.7 MB -1 B
JS without icons 1.93 MB 1.93 MB -1 B
Lib overhead 96.9 kB 96.9 kB 0 B
Lib overhead (gzip) 21.3 kB 21.3 kB 0 B

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

Deploy preview for mistica-web ready!

Project:mistica-web
Status: ✅  Deploy successful!
Preview URL:https://mistica-oehkvw1ux-flows-projects-65bb050e.vercel.app
Latest Commit:f53bb4e

Deployed with vercel-action

@Marcosld
Marcosld force-pushed the commit-sha-input-for-fork-deployments branch from 1a36c5b to 24f5ca5 Compare August 3, 2026 11:54
Marcosld and others added 3 commits August 3, 2026 12:56
Document the safe-to-deploy label flow, the CI approval gate, and
the SHA-pinning behaviour so contributors know what to expect and
what to do when they push new commits after the label is applied.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Marcosld
Marcosld requested a review from tsotnikov August 3, 2026 12:04
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

Accessibility report
✔️ No issues found

ℹ️ You can run this locally by executing yarn audit-accessibility.

@Marcosld
Marcosld enabled auto-merge August 3, 2026 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI AI Generated

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants