Skip to content

Comments

Potential fix for code scanning alert no. 19: Workflow does not contain permissions#652

Merged
javuto merged 1 commit intomainfrom
alert-autofix-19
May 28, 2025
Merged

Potential fix for code scanning alert no. 19: Workflow does not contain permissions#652
javuto merged 1 commit intomainfrom
alert-autofix-19

Conversation

@javuto
Copy link
Collaborator

@javuto javuto commented May 28, 2025

Potential fix for https://github.com/jmpsec/osctrl/security/code-scanning/19

To fix the issue, we will add a permissions block to the workflow. At the root level, we will set the default permissions to contents: read, which is sufficient for most CI workflows. For jobs that require additional permissions, such as push_docker_images, we will define job-specific permissions to grant only the necessary access.


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>
@javuto javuto added cicd CICD related issues github actions Pull requests that update GitHub Actions code labels May 28, 2025
@javuto javuto marked this pull request as ready for review May 28, 2025 20:47
@javuto javuto requested a review from Copilot May 28, 2025 20:47
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a default permissions block to the GitHub Actions workflow and grants job-specific permissions for pushing Docker images.

  • Introduces a root-level permissions block with contents: read
  • Defines job-level permissions for push_docker_images (adds packages: write)
Comments suppressed due to low confidence (1)

.github/workflows/build_and_test_main_merge.yml:146

  • [nitpick] The job-level contents: read permission is redundant because it’s already granted by the workflow’s default permissions. You can remove this line to avoid duplication.
      contents: read

@javuto javuto merged commit f36b552 into main May 28, 2025
53 checks passed
@javuto javuto deleted the alert-autofix-19 branch May 28, 2025 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cicd CICD related issues github actions Pull requests that update GitHub Actions code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant