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

File name hook incorrectly prevents a merge whereby the source branch is from a private fork repository #48

Open
syee514 opened this issue Oct 30, 2018 · 1 comment

Comments

@syee514
Copy link

syee514 commented Oct 30, 2018

For the following scenario:

  • File name hook enabled
  • Branch permissions configured to allow changes to specific individuals

The pull request is:

  • created from a fork repository whereby no one has access but the fork repository owner
  • files in the commit do not match the file name hook configuration

For the above pull request, the individual who has write access to the destination branch should be able to merge but the "Merge" button is grayed/disabled:

  • "Repository hook org.christiangalsterer.stash-filehooks-plugin:filename-hook failed" message is displayed when hovering over the grayed/disabled "Merge" button
  • "There is 1 issue preventing you from merging the pull request. You are not permitted to access this resource" message is displayed if the grayed/disabled "Merge" button is clicked.

The file name hook is incorrectly preventing the merge from occurring. If the fork repository owner grants read access to the individual who has write access to the destination branch, the "Merge" button is no longer grayed/disabled and can proceed with the merge.

@ssorgl
Copy link

ssorgl commented Oct 30, 2018

I suspect the issue is that the hook is attempting to access the fork repo using the logged in users credentials. Because the logged in user (the one that is going to merge in the main repo) does not have permission in the fork, the hook fails to read info from the fork.

However, if the hook changed to not attempt to access the fork at all, but instead use the bitbucket created refs/pull-requests/<pr id>/from branch, there would be no permissions issues.

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

No branches or pull requests

2 participants