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 specific permissions to workflows under .github/workflows #2584

Merged
merged 1 commit into from
Sep 10, 2021
Merged

Add specific permissions to workflows under .github/workflows #2584

merged 1 commit into from
Sep 10, 2021

Conversation

varunsh-coder
Copy link
Contributor

This PR adds specific permissions to the existing workflows under .github/workflows.

Background

I have implemented a GitHub App to automatically restrict permissions for the GITHUB_TOKEN in workflows. This is a security best practice as per the GitHub Actions hardening guide.

I am trying the App out on public repositories, by forking them, installing the App on the fork, and manually creating PRs with the fixed workflows. The App automatically fixes permissions when a PR is created that creates a new workflow, so feel free to install it for future workflows, or try it out on other repos.

I have manually reviewed the changes, and they do look good to me. If something looks off, please let me know. If you have feedback, would love to hear it. Thanks!

@ljharb
Copy link
Member

ljharb commented Sep 10, 2021

I'm confused. Is this a config option that Github Actions itself supports, or is this just metadata for your arbitrary third-party tool?

@ljharb
Copy link
Member

ljharb commented Sep 10, 2021

Separately, because you've unfortunately made a PR from a fork you don't own, I won't be able to land this PR unless you add me to https://github.com/step-security/nvm (please don't create a different PR)

@varunsh-coder
Copy link
Contributor Author

I'm confused. Is this a config option that Github Actions itself supports, or is this just metadata for your arbitrary third-party tool?

GitHub Actions itself supports it: https://github.blog/changelog/2021-04-20-github-actions-control-permissions-for-github_token/

My tool sets the proper values for it based on the workflow.

@varunsh-coder
Copy link
Contributor Author

Separately, because you've unfortunately made a PR from a fork you don't own, I won't be able to land this PR unless you add me to https://github.com/step-security/nvm (please don't create a different PR)

I did not get you. I do own https://github.com/step-security/nvm. The fork is in an organization that I own. Let me know what needs to be done to address this...

@ljharb
Copy link
Member

ljharb commented Sep 10, 2021

Right, but github has a bug where if you don't make a PR from your username's fork - not an organization's fork - then the maintainer won't be able to force push to your PR branch.

If you can add me to your organization's fork with "write" permissions until this PR is landed, I'll be able to rebase it as needed and merge it.

@varunsh-coder
Copy link
Contributor Author

Right, but github has a bug where if you don't make a PR from your username's fork - not an organization's fork - then the maintainer won't be able to force push to your PR branch.

If you can add me to your organization's fork with "write" permissions until this PR is landed, I'll be able to rebase it as needed and merge it.

Sent you an invite to get access. Thanks!

@ljharb ljharb added the testing Stuff related to testing nvm itself. label Sep 10, 2021
@ljharb ljharb merged commit 59532c7 into nvm-sh:master Sep 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testing Stuff related to testing nvm itself.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants