Skip to content

Explicitly define workflow permission#371

Merged
cobexer merged 1 commit intomasterfrom
cobexer/define-workflow-permissions
Nov 13, 2025
Merged

Explicitly define workflow permission#371
cobexer merged 1 commit intomasterfrom
cobexer/define-workflow-permissions

Conversation

@cobexer
Copy link
Copy Markdown
Member

@cobexer cobexer commented Nov 13, 2025

Potential fix for https://github.com/gradle/docker-gradle/security/code-scanning/1

The best way to fix the problem is to explicitly set the permissions key in the workflow file to restrict the GITHUB_TOKEN privileges to the minimum required for the workflow. Since this workflow only checks out code and builds/tests it (does not push, create releases, or otherwise need write permissions), specifying permissions: contents: read at the workflow root is adequate and follows best practices. This should be inserted immediately below the name: key and before the on: key to apply to all jobs in the workflow.

No changes to imports, methods, or further regions are needed—just the top-level addition of the permissions block.


Suggested fixes powered by Copilot Autofix. Review carefully before merging.

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@cobexer cobexer self-assigned this Nov 13, 2025
@cobexer cobexer marked this pull request as ready for review November 13, 2025 10:28
@cobexer cobexer requested review from a team as code owners November 13, 2025 10:28
@cobexer cobexer changed the title Potential fix for code scanning alert no. 1: Workflow does not contain permissions Explicitly define workflow permission Nov 13, 2025
@cobexer cobexer merged commit b6a86f4 into master Nov 13, 2025
27 checks passed
@cobexer cobexer deleted the cobexer/define-workflow-permissions branch November 13, 2025 10:41
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.

2 participants