Potential fix for code scanning alert no. 3: Workflow does not contain permissions #168
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes AB#379924
Potential fix for https://github.com/equinor/Dexpi2Imf/security/code-scanning/3
How to fix:
Add a
permissionsblock to the root of the workflow (beforejobs:) specifying the least privilege required, per GitHub recommendations. For most CI jobs that build and test code but do not require repository modifications, this should bepermissions: contents: read. This ensures the GITHUB_TOKEN used in the workflow only allows reading repository content, reducing the risk if a workflow step is compromised.Implementation:
Insert the following YAML block after the workflow name and before the
on:and/orjobs:blocks, as per standard YAML formatting:This should be inserted at the root level, typically after the
namefield and beforeon:orjobs:. For clarity, in this workflow, place it aftername:and beforeon:. No changes to imports, methods, or additional configuration are required.Suggested fixes powered by Copilot Autofix. Review carefully before merging.