Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow approval of pull request target workflows #28

Merged
merged 2 commits into from
Feb 27, 2025
Merged

Conversation

klutchell
Copy link
Collaborator

@klutchell klutchell commented Feb 24, 2025

The previous pending workflow query was based on the reviewed
commit SHA but this would not return any pull_request_target events since the commit would be out-of-tree.

This change updates the filter to find all pending workflows based
on the branch, then reduces the list further by approved commits
or event type.

Also exclude workflows that were created within one minute of the review being submitted.
This is to prevent time-of-check to time-of-use (TOCTOU) attacks.

@deploynaut-testing
Copy link

One or more environments require approval before deploying workflow runs.

Maintainers, please inspect changes carefully for improper handling of secrets or other sensitive information.

To approve pending deployments, submit an approved review, or a commented review with /deploy.

1 similar comment
@deploynaut-testing
Copy link

One or more environments require approval before deploying workflow runs.

Maintainers, please inspect changes carefully for improper handling of secrets or other sensitive information.

To approve pending deployments, submit an approved review, or a commented review with /deploy.

The previous pending workflow query was based on the reviewed
commit SHA but this would not return any pull_request_target events.

This change updates the filter to find all pending workflows based
on the branch, then reduces the list further by approved commits
or event type.

The events must already be in a pending state before the approval
is received, this is unchanged.

Change-type: patch
Signed-off-by: Kyle Harding <[email protected]>
@klutchell klutchell changed the title Fix approval of pull request target workflows with base SHA Fix approval of pull request target workflows with same branch Feb 24, 2025
@klutchell klutchell marked this pull request as ready for review February 24, 2025 15:47
Exclude workflows that were created within one minute of the review being submitted.
This is to prevent time-of-check to time-of-use (TOCTOU) attacks.

Change-type: minor
Signed-off-by: Kyle Harding <[email protected]>
@klutchell klutchell changed the title Fix approval of pull request target workflows with same branch Exclude workflows created within 1 minute of the review Feb 26, 2025
@klutchell klutchell changed the title Exclude workflows created within 1 minute of the review Allow approval of pull request target workflows Feb 26, 2025
Copy link
Contributor

@rcooke-warwick rcooke-warwick left a comment

Choose a reason for hiding this comment

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

/deploy

@flowzone-app flowzone-app bot enabled auto-merge February 27, 2025 14:38
Copy link

@cywang117 cywang117 left a comment

Choose a reason for hiding this comment

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

LGTM, nice work! I think a 1 min wait time is better UX than 5 min.

@flowzone-app flowzone-app bot merged commit 0a9f3cf into main Feb 27, 2025
54 checks passed
@flowzone-app flowzone-app bot deleted the kyle/prt branch February 27, 2025 20:13
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.

3 participants