Skip to content

Comments

Potential fix for code scanning alert no. 7: Workflow does not contain permissions#1640

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

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

Conversation

@kevinherron
Copy link
Contributor

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

The proper fix is to add a permissions block at the workflow or job level to explicitly specify the minimum set of privileges required by the workflow. In this particular workflow, actions/checkout and formatting tools typically do not need write access; read access is generally sufficient unless you want to commit formatting changes back (which this workflow does not appear to do). Therefore, adding permissions: contents: read to the workflow root (so it applies to all jobs) is the most straightforward and appropriate fix, and will resolve the CodeQL warning.

You need to insert the following after the name: block and before the on: keyword in .github/workflows/google-java-format.yml:

permissions:
  contents: read

No further changes, imports, or definitions are required.


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

…n 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 a90b6e8 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