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

Bitbucket Server: add token validator #9108

Merged
merged 1 commit into from
Apr 8, 2022
Merged

Bitbucket Server: add token validator #9108

merged 1 commit into from
Apr 8, 2022

Conversation

AlexTugarev
Copy link
Member

@AlexTugarev AlexTugarev commented Apr 4, 2022

Description

This PR implements a token validator for Bitbucket Server which is used to guess missing git permissions when using git.

Without this change every attempt to push a commit will cause this notification even if you are trying to push to your own repo:

Screen Shot 2022-04-01 at 08 28 38

Related Issue(s)

Fixes #9062

How to test

  • push to a BBS repo with no write permissions => it should tell you that your token is missing write permissions.
  • push to a BBS repo with write permissions => it should be quiet!
  • repeat for GitLab or GitHub repos to verify this PR doesn't break the rest.

Release Notes

Bitbucket Server: implements token validation for Git operations.

@AlexTugarev AlexTugarev requested a review from a team April 4, 2022 14:08
@github-actions github-actions bot added the team: webapp Issue belongs to the WebApp team label Apr 4, 2022
@AlexTugarev AlexTugarev marked this pull request as draft April 4, 2022 14:09
@AlexTugarev AlexTugarev marked this pull request as ready for review April 4, 2022 14:54
@geropl geropl self-assigned this Apr 6, 2022
@geropl
Copy link
Member

geropl commented Apr 6, 2022

@AlexTugarev I feel I'm doing sth wrong. I got this screent, depsite obviously being able to push, and having all permissions ticked (checked afterwards):
image

@AlexTugarev
Copy link
Member Author

AlexTugarev commented Apr 6, 2022

@geropl, thanks testing. is it https://bitbucket.gitpod-self-hosted.com/projects/FOO/repos/repo123/browse what you used for testing?

What do these resources tell you when navigation in browser while being logged in with a regular BBS user?
https://bitbucket.gitpod-self-hosted.com/rest/api/1.0/projects/foo/repos/repo123/permissions/users
https://bitbucket.gitpod-self-hosted.com/rest/api/1.0/projects/foo/permissions/users

@geropl
Copy link
Member

geropl commented Apr 7, 2022

@AlexTugarev I get this for bot requests (regular user):
image

Copy link
Contributor

@jldec jldec left a comment

Choose a reason for hiding this comment

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

Successfully tested all 3 cases as described in OP ✅

/hold in case you want to investigate what happened with @geropl

@geropl
Copy link
Member

geropl commented Apr 8, 2022

@jldec No, happy to see it worked for you 🙏 - not need to block this any further, then! 🎉

/unhold

@roboquat roboquat merged commit d7f1255 into main Apr 8, 2022
@roboquat roboquat deleted the at/bbs branch April 8, 2022 12:51
@roboquat roboquat added deployed: webapp Meta team change is running in production deployed Change is completely running in production labels Apr 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deployed: webapp Meta team change is running in production deployed Change is completely running in production release-note size/XL team: webapp Issue belongs to the WebApp team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bitbucket Server] False permission suggestions on git push
4 participants