Skip to content

Comments

Potential fix for code scanning alert no. 35: Workflow does not contain permissions#20

Merged
surajsbharadwaj merged 1 commit intomainfrom
alert-autofix-35
Jan 19, 2026
Merged

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

Conversation

@surajsbharadwaj
Copy link
Collaborator

Potential fix for https://github.com/IBM-Cloud/ibm-sap-hana-backint-cos/security/code-scanning/35

In general, the fix is to explicitly declare minimal GITHUB_TOKEN permissions for this workflow, instead of relying on repository defaults. Since these jobs only need to read the repository content (for checkout and running tools), contents: read is sufficient. We can set this at the workflow root so it applies to both jobs; neither job appears to require any write permission or other scopes (issues, pull-requests, etc.), and we are not changing any steps or functionality.

Concretely, in .github/workflows/go.yml, add a top-level permissions: block between the name: Go line and the on: block. This will set default permissions for all jobs in this workflow, including pre-commit (where CodeQL reported the issue) and build. The block should look like:

permissions:
  contents: read

No additional imports or methods are needed, since this is pure workflow configuration.

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>
@surajsbharadwaj surajsbharadwaj marked this pull request as ready for review January 19, 2026 12:15
@surajsbharadwaj surajsbharadwaj merged commit 90c0109 into main Jan 19, 2026
6 checks passed
@surajsbharadwaj surajsbharadwaj deleted the alert-autofix-35 branch January 19, 2026 12:50
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.

2 participants