Skip to content

Potential fix for code scanning alert no. 11: Workflow does not contain permissions#131

Open
robertIsaac wants to merge 1 commit intomainfrom
alert-autofix-11
Open

Potential fix for code scanning alert no. 11: Workflow does not contain permissions#131
robertIsaac wants to merge 1 commit intomainfrom
alert-autofix-11

Conversation

@robertIsaac
Copy link
Copy Markdown
Collaborator

Potential fix for https://github.com/openmfp/typescript-configs/security/code-scanning/11

To fix the problem, explicitly add a permissions block, either at the workflow root (above or below the on: key) or at the job level (inside the pipe: job definition). Since this workflow simply delegates to a shared workflow via uses:, and most workflows only require read-only access to contents, the safest default is contents: read. If the included workflow requires greater permissions (for example, write access to issues or pull-requests), those can be added as needed, but starting with read-only is the recommended base.

The single best fix: Add a root-level (global) permissions block with minimal required permissions (e.g., contents: read), just above the jobs: definition, unless you know you need more (from the included workflow logic). This ensures that all jobs, including those delegated with uses:, run with limited permissions.

Edit the file .github/workflows/config-prettier.yaml by inserting the following block after the workflow on: section (likely after line 16, before jobs:):

permissions:
  contents: read

No new imports or complex changes are required; just a simple YAML insertion.


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>
@robertIsaac robertIsaac marked this pull request as ready for review November 23, 2025 11:13
@robertIsaac robertIsaac requested a review from a team as a code owner November 23, 2025 11:13
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