-
-
Notifications
You must be signed in to change notification settings - Fork 53
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
Checking for user permissions will fail if user is a member of the nested team #120
Comments
Hi @yafanasiev Thank you for reporting this and for your proactive effort to understand the problem. The original version of the slash-command-dispatch/src/github-helper.ts Lines 45 to 53 in 0495b44
I modified it to use the GraphQL API in this PR so that the action could support the The original version used this REST API. Perhaps this API works for users in a nested team. I don't know if there is a single GitHub API that works for fetching the permission of users in a nested team AND returns the |
So I did a little bit of digging and it seems like there is no clear way to resolve this. The REST API that was used before still does not include new permissions, despite a lot of requests on community forums. I played a bit with List repository collaborators API and it looks like it does contain the necessary information:
albeit the naming is a bit off - |
Thank you for looking into it further. It's disappointing that there doesn't seem to be a good solution for this at the moment. I would like to avoid having switchable behaviour for this if possible. Also, I'm not keen on using the List repository collaborators API. I think it will be too much of a performance hit for large orgs. What about having a fallback to the Get repository permissions for a user API I was using originally? The limitation would be that you can't use So what I'm thinking for the |
That could be a workaround, but I think that would complicate the logic too much. If we could detect the nested team and warn user before evaluating permissions then it would be viable, but as of now this looks a bit too complex. I suggest to stay aligned with Github's API on that and add a warning in the docs for nested team users. Hopefully Github will update their API in the near future and problem will kinda resolve itself. I will raise the issue with our team internally to move away from nested teams at all as this functionality looks unfinished from Github's side. |
It's not ideal, sure, but I think it would be acceptable in this case if it's the only realistic way nested team users can use the action. I wouldn't be too hopeful that GitHub will fix this soon. In your case it sounds like you are able to transition to non-nested teams, so that's good news. I'll leave this issue open and pinned for others to find, and if we have more caught by this problem then I'll consider implementing something. Thanks again for raising this issue. |
@peter-evans we moved away from nested teams eventually. It adds some overhead, but in the end is more reliable for any kind of automation. I added a PR to add a note in the docs about this. |
This comment was marked as off-topic.
This comment was marked as off-topic.
We started seeing this issue for config that don't have permission check as well. Config
Log
|
This comment was marked as off-topic.
This comment was marked as off-topic.
I have unfortunately hit exactly this issue right now again. Since the situation hasn't improved, could we maybe implement a workaround (one that doesn't entail moving away from subteams)? |
Hi! First of all, thanks for a wonderful action. We do use it a lot.
We hit an issue where users who have write access to the repository can't trigger slash commands when
permission
property is set towrite
. After investigation, I found out that the issue occurs if user has permissions on repository through the nested team (so the teammain
is assignedwrite
permissions on the repo, it has sub-teamsub
, and user is a member of teamsub
). I tried to reproduce the calls that actions does locally (specificallyslash-command-dispatch/src/github-helper.ts
Line 57 in 12905bc
and this is something that could change in the future, but not right now.
I do understand that this is something relatively specific to our use case, but I am adding this in case someone hits the same problem and does not waste as much time as we did. I also checked REST API version of this request , and it returns the correct list of collaborators. This could server as a substitute for current implementation, but would require getting all of the collaborators and then filtering by current actor name, which is not quite neat as the GraphQL version. So it is up to mainteners to make the call, but at least this could be added to README somewhere to save others some time.
The text was updated successfully, but these errors were encountered: