Skip to content

CodeScan-Fix: Add missing workflow permissions to gradle-build#10

Open
meysholdt wants to merge 1 commit intomainfrom
codescan-fix/missing-workflow-permissions
Open

CodeScan-Fix: Add missing workflow permissions to gradle-build#10
meysholdt wants to merge 1 commit intomainfrom
codescan-fix/missing-workflow-permissions

Conversation

@meysholdt
Copy link
Contributor

@meysholdt meysholdt commented Mar 8, 2026

Code Scanning Alert

Field Value
Alert View alert
Rule actions/missing-workflow-permissions
Severity medium
Tool CodeQL
File .github/workflows/gradle-build.yml:15
Message Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: contents: read

What changed

Added a top-level permissions: contents: read block to the Gradle CI workflow. This restricts the GITHUB_TOKEN to read-only repository access, which is the minimum scope needed for checkout and build, resolving the least-privilege violation flagged by CodeQL.

Verification

  • ./gradlew compileJava — passed
  • ./gradlew check (includes test, checkstyleMain, checkstyleTest, checkFormatMain, checkFormatTest, checkstyleNohttp) — all 18 tasks passed
  • Workflow YAML structure validated — permissions block correctly placed at workflow root level

@meysholdt meysholdt force-pushed the codescan-fix/missing-workflow-permissions branch from caa1a29 to 9b821b8 Compare March 9, 2026 13:25
@meysholdt meysholdt changed the title CodeScan-Fix: Add missing workflow permissions CodeScan-Fix: Add missing workflow permissions to gradle-build Mar 9, 2026
@meysholdt meysholdt force-pushed the main branch 2 times, most recently from f2c9931 to 1695684 Compare March 9, 2026 13:44
@meysholdt meysholdt force-pushed the codescan-fix/missing-workflow-permissions branch from 9b821b8 to 318a70b Compare March 9, 2026 13:59
Restrict GITHUB_TOKEN to contents:read in the Gradle CI workflow,
resolving CodeQL alert actions/missing-workflow-permissions.

Co-authored-by: Ona <no-reply@ona.com>
@meysholdt meysholdt force-pushed the codescan-fix/missing-workflow-permissions branch from 318a70b to bc5f8e6 Compare March 9, 2026 14:12
@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 9, 2026

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