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

Inform people that repository collaborators can read PATs or discourage people from using them #75

Closed
brxxn opened this issue Nov 25, 2019 · 7 comments · Fixed by #123
Closed
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@brxxn
Copy link

brxxn commented Nov 25, 2019

Inside the README, people are encouraged to use a PAT to access repository content, but this adds a risk to the repository owner's account, allowing people to read any private repository if they get access to it. As stated in the GitHub Documentation, anyone with write access can read the PAT and all private repositories a user has access to.

People should be discouraged from using PATs and should be encouraged to keep the action in their within their own repository to prevent repository collaborators from having more access to a user's account than they should.

@ericsciple ericsciple self-assigned this Dec 13, 2019
@ericsciple ericsciple added the documentation Improvements or additions to documentation label Dec 13, 2019
@eine
Copy link

eine commented Dec 16, 2019

For completeness, deployment keys should be usable instead of PATs for most contexts. For example, this commit shows the two procedures (token or key): umarcor/issue-runner@4a57a1a

@JohannesHoppe
Copy link

Hello, I manage a library that right now encourages people to use a personal access token.
see https://github.com/angular-schule/angular-cli-ghpages
I know that a PAT with repository access is a serious security risk, but in the past this was the best option.

My last information is, that the GH_TOKEN won't work to push to a new branch, see angular-schule/angular-cli-ghpages#73 (comment).
Could somebody tell me what are the best practices now? I'm right now working on an article, regarding this topic. Of course, I do not want to recommend anything wrong:

PR for article angular-schule/website-articles#7 (will be published at https://angular.schule/blog)

You can see a preview of the article here.

@ericsciple
Copy link
Contributor

@brxxn It looks like https://github.com/<org>/<repo>/settings/secrets provides guidance. And also provides a link to https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets

@ericsciple
Copy link
Contributor

@andymckay for thoughts?

@eine
Copy link

eine commented Dec 23, 2019

My last information is, that the GH_TOKEN won't work to push to a new branch,

I'm not sure about this... I have found deployment keys to be required in order to push to a different repo, but not for a different branch in the same repo. See, e.g. https://github.com/eine/tip/blob/master/.github/update_gha-tip.sh.

The issue with gh-pages is NOT that you cannot push. Actually, you can. However, the website is not updated. In other words, you will see the commits pushed to the branch, but nothing in https://github.com/*/*/deployments. See actions/toolkit#247.

Hence, for now, you can use GHA and the default GITHUB_TOKEN to keep a gh-pages branch up to date. However, for the website to be updated, you need to:

git checkout -b gh-pages origin/gh-pages
git commit --amend --reset-author
git push origin +gh-pages
git checkout master
git branch -D gh-pages

For completeness, this is how to use a deployment key instead: https://github.com/VUnit/vunit/blob/master/.github/workflows/docs.yml

@andymckay
Copy link
Contributor

@andymckay for thoughts?

There's a definite risk there. Might be worth calling out in the README to make it clearer.

@ericsciple
Copy link
Contributor

i added a link in the description, to the help topic about secrets

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants