Skip to content

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

Merged
Lawrence Lucas Large (LukeLarge) merged 1 commit into
mainfrom
alert-autofix-2
Dec 10, 2025
Merged

Potential fix for code scanning alert no. 1: Workflow does not contain permissions#7
Lawrence Lucas Large (LukeLarge) merged 1 commit into
mainfrom
alert-autofix-2

Conversation

@LukeLarge
Copy link
Copy Markdown
Collaborator

Potential fix for https://github.com/LukeLarge/tonapi-go/security/code-scanning/1

To fix the problem, you should add a permissions: block that explicitly sets the GitHub Actions job's permissions to the minimum required. For this workflow, which only checks out, builds, and tests code (no publishing or API interactions), contents: read is sufficient. You can add the block either globally at the workflow root, or inside the job (or both, but root is best for single-job workflows).
Best fix: Add the following under the name: Go line (before on:) in .github/workflows/go.yml:

permissions:
  contents: read

No new methods, imports, or further definitions are needed; this is a straightforward YAML edit.


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>
Copilot AI review requested due to automatic review settings December 10, 2025 01:27
Copy link
Copy Markdown

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 addresses a GitHub code scanning security alert by adding explicit permissions to the Go workflow file, following the principle of least privilege for GitHub Actions.

  • Adds permissions: contents: read to the workflow configuration
  • Restricts the workflow to only read access, which is sufficient for checkout, build, and test operations

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@LukeLarge Lawrence Lucas Large (LukeLarge) marked this pull request as ready for review December 10, 2025 01:30
@LukeLarge Lawrence Lucas Large (LukeLarge) merged commit 75e5586 into main Dec 10, 2025
9 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.

2 participants