Emit workflow-level permissions from frontmatter instead of always using empty block#14461
Closed
Emit workflow-level permissions from frontmatter instead of always using empty block#14461
Conversation
- Modified compiler to render permissions at workflow level instead of always using empty permissions
- All 14 affected workflows now have explicit permissions following principle of least privilege
- Permissions are parsed from frontmatter and rendered as workflow-level permissions in compiled .lock.yml files
- Maintains backward compatibility: workflows without permissions get empty permissions block ({})
- All tests passing, code formatted and linted
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
- Updated TestGenerateYAMLRefactored to expect actual permissions instead of empty permissions block - Test now correctly expects "permissions:" and "contents: read" when permissions are defined - All unit tests passing Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
…ing empty block Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add explicit permissions blocks to workflows with risky triggers
Emit workflow-level permissions from frontmatter instead of always using empty block
Feb 8, 2026
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.
14 workflows with risky trigger events (issues, issue_comment, pull_request_target) had
permissions: {}at workflow level, which defaults to write permissions. Poutine scanner flagged this asdefault_permissions_on_risky_events.Changes
pkg/workflow/compiler_yaml.goto parse frontmatter permissions and render them at workflow level instead of hardcodedpermissions: {}TestGenerateYAMLRefactoredto expect actual permissions instead of empty blockBefore/After
Before:
After:
All workflows now follow principle of least privilege with explicit read-only scopes.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.