Skip to content

Scope down GitHub token permissions for ci.yml#26

Closed
AdnaneKhan wants to merge 1 commit intoawslabs:mainfrom
AdnaneKhan:update/token-scopedown
Closed

Scope down GitHub token permissions for ci.yml#26
AdnaneKhan wants to merge 1 commit intoawslabs:mainfrom
AdnaneKhan:update/token-scopedown

Conversation

@AdnaneKhan
Copy link

This PR adds minimal required permissions to the workflow following the principle of least privilege.

Issue #, if available:

Description of changes:

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

This PR adds minimal required permissions to the workflow following the principle of least privilege.

Analysis:
This workflow performs Java project building and testing operations without modifying repository state. Analysis of the steps: (1) actions/checkout@v2 - requires 'contents: read' to clone the repository; (2) gradle/wrapper-validation-action@v1 - validates the Gradle wrapper configuration, local operation; (3) actions/setup-java@v2 - sets up JDK with specified Java version (11 or 17) and Zulu distribution, no GitHub permissions needed; (4) Clean and build step - runs './gradlew clean build -Plog-tests' to compile and test the Java project, local operation. The workflow is triggered on: push to main branch and pull requests to main branch. The workflow uses a matrix strategy to run on multiple Java versions (11, 17) and operating systems (ubuntu-latest, windows-latest, macos-latest). All operations are read-only with respect to the repository - the workflow only reads repository contents via checkout and performs local Gradle build and test operations. No steps create commits, push changes, create releases, modify issues/PRs, or perform any other write operations on the GitHub repository. The workflow does not use 'secrets: inherit' and does not require any secrets. Following the principle of least privilege, the minimal required permission is 'contents: read' for the checkout action to clone the repository. The default GITHUB_TOKEN with read-only permissions is sufficient for this workflow.

Required permissions:
{
  "contents": "read"
}
@AdnaneKhan AdnaneKhan requested a review from a team as a code owner October 20, 2025 20:33
@AdnaneKhan AdnaneKhan closed this by deleting the head repository Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant