Potential fix for code scanning alert no. 1: Workflow does not contain permissions #47
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Potential fix for https://github.com/lefty01/ESP32_TTGO_FTMS/security/code-scanning/1
In general, to fix this issue you should add an explicit
permissionsblock either at the workflow root (applies to all jobs) or inside the specific job that uses theGITHUB_TOKEN. This block should grant only the minimal scopes needed for the workflow to function.For this workflow, the job needs to: (1) read repository contents (for
actions/checkoutandgit ls-files), and (2) write comments to pull requests viamarocchino/sticky-pull-request-comment. It doesn’t need to push commits, manage issues, or modify other resources. The best minimal permissions set is therefore:contents: readandpull-requests: write. To implement this without changing functionality, add apermissionsmapping under theformatting-checkjob (same indentation level asruns-on,strategy, andsteps). No additional imports or external methods are needed because this is a YAML configuration change only. The rest of the workflow remains unchanged.Concretely, in
.github/workflows/clang-format-check.yml, insert:between
runs-on: ubuntu-latestandstrategy:for theformatting-checkjob.Suggested fixes powered by Copilot Autofix. Review carefully before merging.