Skip to content

Potential fix for code scanning alert no. 1: Workflow does not contain permissions#46

Merged
fadhilyori merged 1 commit intomainfrom
alert-autofix-1
Dec 29, 2025
Merged

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

Conversation

@fadhilyori
Copy link
Owner

Potential fix for https://github.com/fadhilyori/subping/security/code-scanning/1

In general, the fix is to explicitly define a least-privilege permissions: block for the workflow or for the specific job. Since this workflow only checks out code and runs Go build/tests, it only requires read access to the repository contents. We can safely set contents: read and rely on the default none for all other scopes.

The best fix with minimal functional change is to add a job-level permissions: block under the build job, right alongside runs-on. This keeps the permissions scoping explicit for this job without affecting other workflows. Concretely, in .github/workflows/go.yml, under build: and before or after runs-on: ubuntu-latest, insert:

permissions:
  contents: read

No additional imports or methods are needed; this is purely a YAML configuration change inside the existing workflow.

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>
@fadhilyori fadhilyori marked this pull request as ready for review December 29, 2025 11:40
@fadhilyori fadhilyori merged commit b6e01e4 into main Dec 29, 2025
4 checks passed
@fadhilyori fadhilyori deleted the alert-autofix-1 branch December 29, 2025 11:40
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