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

Add missing permissions to InstallationPermissions #1180

Merged
merged 3 commits into from
Jun 19, 2019

Conversation

tarebyte
Copy link
Contributor

This adds the remaining GitHub App installation permissions defined in https://developer.github.com/v3/apps/permissions/#metadata-permissions that are related to GitHub App installations.

These do not include permissions such as emails or gpg_keys as these are user permissions.

I think I found the relevant test(s) to update, but if there are more I can add please let me know.

✨ Thanks ✨

This adds the remaining GitHub App installation permissions defined in
https://developer.github.com/v3/apps/permissions/#metadata-permissions
that are related to GitHub App installations.

These do not include permissions such as `emails` or `gpg_keys`
as these are user permissions.
@googlebot googlebot added the cla: yes Indication that the PR author has signed a Google Contributor License Agreement. label May 31, 2019
@codecov
Copy link

codecov bot commented May 31, 2019

Codecov Report

Merging #1180 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1180   +/-   ##
=======================================
  Coverage   70.25%   70.25%           
=======================================
  Files          84       84           
  Lines        5867     5867           
=======================================
  Hits         4122     4122           
  Misses        956      956           
  Partials      789      789
Impacted Files Coverage Δ
github/apps.go 65.51% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8354c07...a8d3df2. Read the comment docs.

@gmlewis
Copy link
Collaborator

gmlewis commented May 31, 2019

Thank you, @tarebyte!

I'm looking around the GitHub API v3 Developer docs, and am having troubles finding these added fields. Where did you find these?
Are they really all strings?
If you have a documentation URL, could you please add it to a comment before the expanded struct?

@tarebyte
Copy link
Contributor Author

I'm looking around the GitHub API v3 Developer docs, and am having troubles finding these added fields. Where did you find these?

The permissions are listed here: https://developer.github.com/v3/apps/permissions

Are they really all strings?

Yup! The string is either read/write/admin and if it's not one of those then the field isn't part of the JSON response.

An example of this would be the permissions key in this response https://developer.github.com/v3/apps/#get-an-installation

If you have a documentation URL, could you please add it to a comment before the expanded struct?

Happy to, is https://developer.github.com/v3/apps/permissions/ sufficient?

@gmlewis
Copy link
Collaborator

gmlewis commented May 31, 2019

Hmmm... I'm still confused. Let's take an example.
Where did you find the string organization_pre_receive_hooks ?

@tarebyte
Copy link
Contributor Author

Where did you find the string organization_pre_receive_hooks ?

That's an Enterprise only permission, it's located in https://developer.github.com/enterprise/2.17/v3/apps/permissions/

@gmlewis
Copy link
Collaborator

gmlewis commented May 31, 2019

Ah! Great, thanks. Then can you please add the two URLs in the comment?
Something like:

// Hook names taken from:
//   https://developer.github.com/v3/apps/permissions/
//   https://developer.github.com/enterprise/2.17/v3/apps/permissions/

Thank you!

@tarebyte
Copy link
Contributor Author

Ah! Great, thanks. Then can you please add the two URLs in the comment?

Done in a8d3df2

//
// Permission names taken from:
// https://developer.github.com/v3/apps/permissions/
// https://developer.github.com/enterprise/v3/apps/permissions/
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Collaborator

@gmlewis gmlewis left a comment

Choose a reason for hiding this comment

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

LGTM.

Awaiting second LGTM before merging.

@gmlewis gmlewis requested a review from gauntface May 31, 2019 15:45
ContentReferences *string `json:"content_references,omitempty"`
Deployments *string `json:"deployments,omitempty"`
Issues *string `json:"issues,omitempty"`
Metadata *string `json:"metadata,omitempty"`

Choose a reason for hiding this comment

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

According to the following documentation:
https://developer.github.com/apps/building-github-apps/creating-github-apps-using-url-parameters/#github-app-permissions

It seems like this should be RepositoryMetadata, and more importantly, the JSON key should be repository_metadata?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@itsdalmo that seems to be an error in the docs, the key from the response is definitely metadata.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks, @itsdalmo and @tarebyte!

Would one of you please volunteer to contact [email protected] and let them know about the documentation error? They are typically very responsive, friendly, and helpful, and this would be appreciated feedback. Thank you!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Would one of you please volunteer to contact [email protected] and let them know about the documentation error?

I can file an internal issue, I work for GitHub 😃

They are typically very responsive, friendly, and helpful, and this would be appreciated feedback. Thank you!

💖

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh, uh, Wow! I'm humbled and honored that you are helping us out here, @tarebyte!!!

You and your team have been an absolute joy to work with! I have a bunch of virtual friends at GitHub Tech Support. Thanks for all you do!

So let's see... all I need is another LGTM and we are good to merge.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, uh, Wow! I'm humbled and honored that you are helping us out here, @tarebyte!!!

You and your team have been an absolute joy to work with! I have a bunch of virtual friends at GitHub Tech Support. Thanks for all you do!

It's my pleasure! Thank you for working on such a ✨ library

@gmlewis
Copy link
Collaborator

gmlewis commented Jun 14, 2019

@itsdalmo - since you reviewed the code, can I please get an LGTM from you and we can merge this?

Copy link

@itsdalmo itsdalmo left a comment

Choose a reason for hiding this comment

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

Quick review, as requested by @gmlewis. I've based it on the following documentation:
https://developer.github.com/apps/building-github-apps/creating-github-apps-using-url-parameters/#github-app-permissions

According to the documentation there seems to be some missing permissions still:

  • blocking
  • emails
  • followers
  • gpg_keys
  • keys
  • packages
  • plan
  • starring
  • watching

With the exception of watching, all of these seem to be present in the V3 documentation as well:
https://developer.github.com/v3/apps/permissions/#github-app-permissions

Unless both docs are wrong I think we should add these missing permissions as well? 😅

@tarebyte
Copy link
Contributor Author

@itsdalmo, those are all user permissions that aren’t granted to an app installation.

These are only requested and granted when a user goes through the authorization flow and the GitHub App gets a “user to server” token.

@tarebyte
Copy link
Contributor Author

Ooo actually I think packages might be a installation permission.

I’ll double check.

Copy link

@itsdalmo itsdalmo left a comment

Choose a reason for hiding this comment

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

These are only requested and granted when a user goes through the authorization flow and the GitHub App gets a “user to server” token.

Thanks for clarifying @tarebyte - LGTM

@gmlewis
Copy link
Collaborator

gmlewis commented Jun 19, 2019

It looks like we have two LGTMs but also some more commits coming in.

Just FYI, @tarebyte, we try not to use force pushes for PRs in this repo as it makes it more challenging for the reviewers to see what changed, but no big deal. Sometimes we have to use them to clear up the CLA checker and make it happy. 😄

So I'm just checking in with you on the status... are we good to merge, or do you think there are other changes that need making first?

@tarebyte
Copy link
Contributor Author

Good to know thanks!

This is good to go from my perspective, the missing packages permission was all I needed to add.

@gmlewis
Copy link
Collaborator

gmlewis commented Jun 19, 2019

Thank you, @tarebyte and @itsdalmo!
Merging.

@gmlewis gmlewis merged commit 7a8ff7a into google:master Jun 19, 2019
n1lesh pushed a commit to n1lesh/go-github that referenced this pull request Oct 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Indication that the PR author has signed a Google Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants