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

ci: Add GitHub token permissions for workflows #21162

Merged
merged 1 commit into from Jul 5, 2022

Conversation

varunsh-coder
Copy link
Contributor

Context

This PR adds minimum token permissions for the GITHUB_TOKEN using https://github.com/step-security/secure-workflows.

GitHub recommends defining minimum GITHUB_TOKEN permissions for securing GitHub Actions workflows

This project is part of the top 100 critical projects as per OpenSSF (https://github.com/ossf/wg-securing-critical-projects), so fixing the token permissions to improve security.

Signed-off-by: Varun Sharma varunsh@stepsecurity.io

Contributor Checklist

  • Review Contribution Guidelines
  • Make sure that all commits are signed off to indicate that you agree to the terms of Developer Certificate of Origin.
  • Make sure all contributed code can be distributed under the terms of the Apache License 2.0, e.g. the code was written by yourself or the original code is licensed under a license compatible to Apache License 2.0.
  • Check "Allow edit from maintainers" option in pull request so that additional changes can be pushed by Gradle team
  • Provide integration tests (under <subproject>/src/integTest) to verify changes from a user perspective
  • Provide unit tests (under <subproject>/src/test) to verify logic
  • Update User Guide, DSL Reference, and Javadoc for public-facing changes
  • Ensure that tests pass sanity check: ./gradlew sanityCheck
  • Ensure that tests pass locally: ./gradlew <changed-subproject>:quickTest

Gradle Core Team Checklist

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation
  • Recognize contributor in release notes

Signed-off-by: Varun Sharma <varunsh@stepsecurity.io>
Copy link
Member

@wolfs wolfs left a comment

Choose a reason for hiding this comment

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

Thank you for your PR. I feel like the permissions you added won't be sufficient for some of the workflows. Can we/you somehow check if this would work?

.github/workflows/add-to-dev-prod-project.yml Show resolved Hide resolved
@@ -21,6 +21,9 @@ env:
# Enable debug for the `gradle-build-action` cache operations
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true

permissions:
contents: read
Copy link
Member

Choose a reason for hiding this comment

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

Does the gradle build action need more access than reading the contents?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Based on my code review of https://github.com/gradle/gradle-build-action, it does not use the GITHUB_TOKEN.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I wonder if github action needs to update the commit status, which requires write access. Anyway, we can start with strictest policy and adjust it later.

@blindpirate
Copy link
Collaborator

@bot-gradle test and merge

@bot-gradle
Copy link
Collaborator

No milestone for this PR. Please set a milestone and retry.

@blindpirate blindpirate added this to the 7.6 RC1 milestone Jul 5, 2022
@blindpirate
Copy link
Collaborator

@bot-gradle test and merge

@bot-gradle
Copy link
Collaborator

OK, I've already triggered a build for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
from:contributor PR by an external contributor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants