Add explicit permissions to GitHub workflows to follow principle of least privilege#799
Draft
Add explicit permissions to GitHub workflows to follow principle of least privilege#799
Conversation
… of least privilege Co-authored-by: elopezanaya <981914+elopezanaya@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix missing permissions in GitHub workflows
Add explicit permissions to GitHub workflows to follow principle of least privilege
Oct 21, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
Code scanning identified 8 security alerts where GitHub workflow files lacked explicit permissions. Without explicit permissions, workflows inherit repository or organization defaults, which may be overly permissive and violate the principle of least privilege.
The affected workflows were:
chat-widget-release-manual.yml(alerts Bump cross-fetch from 3.1.4 to 3.1.5 in /chat-widget #19, Modified the version for chat components #12)chat-components-pr.yml(alert telemetry issue fixes #18)chat-components-release.yml(alerts Fixed LiveChatWidget import since its not default exported and Security link at the bottom #17, Bump node-fetch from 2.6.1 to 2.6.7 in /chat-widget #8)chat-components-release-manual.yml(alerts Unable to initialize the chat widget #16, Update component version to unblock VRT tests #7)sync-issue-to-ado-work-item.yml(alert Add Code reviewers team #13)Solution
Added explicit permissions blocks to all affected workflows, granting only the minimum permissions required for each workflow to function:
Release Workflows
For
chat-widget-release-manual.yml,chat-components-release.yml, andchat-components-release-manual.yml:PR Workflow
For
chat-components-pr.yml:Issue Sync Workflow
For
sync-issue-to-ado-work-item.yml:Security Benefits
✅ Principle of Least Privilege: Each workflow now has only the minimum permissions needed to perform its tasks
✅ Read-only by default: Repository contents are read-only; write access is only granted to artifacts
✅ Explicit and auditable: Permissions are clearly documented in each workflow file
✅ Consistent: Aligns with existing workflows that already follow this pattern (e.g.,
chat-widget-pr.yml,chat-widget-release.yml)Functionality Preserved
This change addresses all 8 code scanning alerts while maintaining full functionality of the existing CI/CD pipelines.
Original prompt
Fixes #798
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.