Skip to content

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

Merged
mpatfield merged 1 commit into
latestfrom
alert-autofix-1
Aug 12, 2025
Merged

Potential fix for code scanning alert no. 1: Workflow does not contain permissions#24
mpatfield merged 1 commit into
latestfrom
alert-autofix-1

Conversation

@mpatfield

Copy link
Copy Markdown
Owner

Potential fix for https://github.com/mpatfield/homebridge-easy-mqtt/security/code-scanning/1

To fix the problem, add a permissions block to the workflow to explicitly set the minimal required permissions for the GITHUB_TOKEN. Since the workflow only checks out code, installs dependencies, lints, builds, and audits dependencies (all read-only operations), the minimal permission required is contents: read. This can be set at the workflow level (applies to all jobs) or at the job level (applies only to the specific job). The best practice is to set it at the workflow level unless a job requires different permissions. The change should be made by inserting the following block after the name: line and before the on: line in .github/workflows/build.yml:

permissions:
  contents: read

No additional methods, imports, or definitions are needed.


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>
@mpatfield
mpatfield marked this pull request as ready for review August 12, 2025 18:02
@mpatfield
mpatfield merged commit 5068828 into latest Aug 12, 2025
8 checks passed
@mpatfield
mpatfield deleted the alert-autofix-1 branch August 12, 2025 18:03
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