Skip to content

Comments

Potential fix for code scanning alert no. 10: Workflow does not contain permissions#1639

Merged
kevinherron merged 1 commit into1.0from
alert-autofix-10
Nov 3, 2025
Merged

Potential fix for code scanning alert no. 10: Workflow does not contain permissions#1639
kevinherron merged 1 commit into1.0from
alert-autofix-10

Conversation

@kevinherron
Copy link
Contributor

Potential fix for https://github.com/eclipse-milo/milo/security/code-scanning/10

To fix the problem, add an explicit permissions block to the workflow. The recommended minimal starting point is contents: read, which restricts the GITHUB_TOKEN to reading repository content only. If the job or any steps need additional permissions (such as write access to pull requests, releases, or any other GitHub resources), those can be added, but in this case, none of the steps shown require such access—the workflow publishes to Maven Central, installs a GPG key, and runs Maven, all without manipulating or writing GitHub resources.

Add the following block directly below the workflow name (line 1), at the root level in .github/workflows/maven-release.yml:

permissions:
  contents: read

This ensures all jobs in the workflow inherit the read-only permissions for contents, satisfying CodeQL's requirement and adhering to least privilege principles.

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

…in permissions

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@kevinherron kevinherron marked this pull request as ready for review November 3, 2025 13:20
@kevinherron kevinherron merged commit ac8aa9a into 1.0 Nov 3, 2025
6 checks passed
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