fix(ci): scope per-job permissions in marketplace-governance example#2173
Merged
imran-siddique merged 1 commit intoMay 12, 2026
Conversation
`examples/marketplace-governance/.github/workflows/plugin-governance.yml`
is a downstream-facing example workflow — consumers copy it into their
own repos as a starting point — so its permission hygiene shapes the
default behavior in many production CI pipelines.
The original file granted workflow-level `pull-requests: write` and no
per-job `permissions:` blocks, which means:
- Every job inherits the workflow-level grants.
- The PR-write grant is over-broad: none of the three jobs actually
comments on or modifies a PR. They run policy validation, evaluate
plugins, upload an artifact, and write to GITHUB_STEP_SUMMARY (which
needs no extra scope).
Apply principle of least privilege:
- Drop workflow-level `pull-requests: write` (unused by any job).
- Keep workflow-level `contents: read`.
- Add explicit `permissions: { contents: read }` per job so copy-paste
consumers see the pattern and can't accidentally widen the scope by
appending one write-scoped job to the file.
Add a comment block at the top explaining the rationale for downstream
readers — the whole point of an example workflow is to be learned from.
🤖 AI Agent: security-scanner — View detailsNo security issues found. |
🤖 AI Agent: test-generator — View detailsTest coverage looks good. No gaps identified. |
🤖 AI Agent: breaking-change-detector — API CompatibilityAPI Compatibility
|
🤖 AI Agent: code-reviewer — View detailsTL;DR: 0 blockers, 0 warnings. No issues found. Clean change. |
🤖 AI Agent: docs-sync-checker — Docs SyncDocs Sync
|
|
🟡 Contributor Check: MEDIUM
Automated check by AGT Contributor Check. |
PR Review Summary
Verdict: ✅ Ready for human review |
MohammadHaroonAbuomar
pushed a commit
to MohammadHaroonAbuomar/agt-acs
that referenced
this pull request
Jun 1, 2026
…icrosoft#2173) `examples/marketplace-governance/.github/workflows/plugin-governance.yml` is a downstream-facing example workflow — consumers copy it into their own repos as a starting point — so its permission hygiene shapes the default behavior in many production CI pipelines. The original file granted workflow-level `pull-requests: write` and no per-job `permissions:` blocks, which means: - Every job inherits the workflow-level grants. - The PR-write grant is over-broad: none of the three jobs actually comments on or modifies a PR. They run policy validation, evaluate plugins, upload an artifact, and write to GITHUB_STEP_SUMMARY (which needs no extra scope). Apply principle of least privilege: - Drop workflow-level `pull-requests: write` (unused by any job). - Keep workflow-level `contents: read`. - Add explicit `permissions: { contents: read }` per job so copy-paste consumers see the pattern and can't accidentally widen the scope by appending one write-scoped job to the file. Add a comment block at the top explaining the rationale for downstream readers — the whole point of an example workflow is to be learned from.
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.
Summary
examples/marketplace-governance/.github/workflows/plugin-governance.ymlis a downstream-facing example — consumers copy it into their own repos as a starting point — so its permission hygiene shapes the default behavior in many production CI pipelines that adopt the toolkit.Two issues:
pull-requests: writeis unused. None of the three jobs (validate-manifest,evaluate-policy,governance-verify) comments on or modifies a PR. They run policy validation, evaluate plugins, upload an artifact, and write toGITHUB_STEP_SUMMARY(which needs no extra scope).permissions:blocks. Every job inherits the workflow-level grants, which means a future copy-paste consumer that adds a write-scoped job inherits the over-broad grant by default.Both apply to lines 33, 65, and 108 (the three job headers).
This is in the same spirit as #2138 (workflow shell-injection hardening) and #2141 (Gitleaks fork-PR skip) — example workflows are templates as much as they are code.
Change
pull-requests: write(no job uses it).contents: read.permissions: { contents: read }to each of the three jobs.Verification
actionlintparses cleanly (the workflow does not actually run on this repo's CI, since it triggers onplugins/**which doesn't exist here).Surfaced during independent audit conducted by @finnoybu (Ken Tannenbaum, AEGIS Initiative); [LOW, Infrastructure/CI].