Skip to content

ci: fork PRs in regen workflow#48001

Closed
l0lawrence wants to merge 4 commits into
Azure:mainfrom
l0lawrence:l0lawrence-block-forks-in-regen-workflow
Closed

ci: fork PRs in regen workflow#48001
l0lawrence wants to merge 4 commits into
Azure:mainfrom
l0lawrence:l0lawrence-block-forks-in-regen-workflow

Conversation

@l0lawrence

@l0lawrence l0lawrence commented Jul 10, 2026

Copy link
Copy Markdown
Member

Problem

The typespec-python-regenerate.yml workflow accepts a microsoft/typespec pull request URL via workflow_dispatch. The 'Resolve TypeSpec repo/ref' step resolves that PR to its head repository + SHA (headRepositoryOwner.login / headRepository.name)

Change

After resolving the PR's head repo owner/name - if it is anything else (a fork), the step fails with an actionable ::error:: and exits non-zero.

The regenerate workflow resolves a microsoft/typespec PR URL to its head repo and SHA, then checks out and executes that code with a write-scoped token. When the PR originates from a fork, this runs untrusted code in a privileged job. Validate that the resolved PR head repository is microsoft/typespec and fail with an actionable error otherwise.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@l0lawrence l0lawrence changed the title ci: block fork PRs in typespec-python-regenerate workflow ci: restrict fork PRs in typespec-python-regenerate workflow Jul 10, 2026
@l0lawrence l0lawrence changed the title ci: restrict fork PRs in typespec-python-regenerate workflow ci: fork PRs in typespec-python-regenerate workflow Jul 10, 2026
Comment thread .github/workflows/typespec-python-regenerate.yml Outdated
Comment thread .github/workflows/typespec-python-regenerate.yml Outdated
@l0lawrence l0lawrence changed the title ci: fork PRs in typespec-python-regenerate workflow ci: fork PRs in regen workflow Jul 10, 2026
@l0lawrence
l0lawrence requested a review from xirzec July 10, 2026 19:53
Comment thread .github/workflows/typespec-python-regenerate.yml Outdated
@l0lawrence l0lawrence closed this Jul 10, 2026
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.

1 participant