fix: [FL-29536] add explicit permissions to jira-sync workflow#99
Conversation
Resolves CodeQL alert #4 (CWE-275) by restricting the GITHUB_TOKEN to read-only access. The reusable workflow only reads PR event data and calls the JIRA API via secrets — no repo write access is needed. Jira ticket: FL-29536 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
There was a problem hiding this comment.
Pull request overview
Adds an explicit permissions block to the jira-sync.yml GitHub Actions workflow to restrict the default GITHUB_TOKEN scope, addressing the linked CodeQL alert about missing workflow permissions.
Changes:
- Add top-level
permissions:configuration. - Restrict
GITHUB_TOKENpermissions tocontents: readfor the JIRA sync workflow.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
josue
left a comment
There was a problem hiding this comment.
Adversarial Review — PR #99: Add explicit workflow permissions
Reviewer: Claude Opus (Gemini 2.5 Pro unavailable — 429 rate limit)
Primary fix is correct. The permissions: contents: read block is the minimal required scope — the reusable workflow only reads PR event payload data via context.payload (no GitHub API calls) and makes external JIRA REST calls using repository secrets. No injection risks found.
New Findings: 2 (pre-existing, in diff context)
| Severity | Finding | File |
|---|---|---|
| MEDIUM | Mutable @main ref for reusable workflow — supply chain risk |
jira-sync.yml:17 |
| LOW | secrets: inherit passes all repo secrets, not just the 2 needed |
jira-sync.yml:18 |
Note: Both findings are pre-existing (not introduced by this PR) but are visible in the diff context and worth addressing in a follow-up for SOC 2 / HITRUST supply chain integrity.
Source: Claude Opus adversarial review
Description
Adds an explicit
permissionsblock to thejira-sync.ymlworkflow, restricting theGITHUB_TOKENtocontents: read. This resolves CodeQL alert #4 (CWE-275: missing workflow permissions).Motivation and Context
Without explicit permissions, the workflow inherits repository/org defaults which may be broader than necessary. The reusable workflow only reads PR event payload data and makes JIRA API calls using repository secrets — it needs no write access to the repo.
Jira ticket: FL-29536
How Has This Been Tested?
flume/github-actions/.github/workflows/jira-sync.yml— it only readscontext.payload.pull_request(from the event, not the API) and makes external JIRA REST calls using secretsGITHUB_TOKENTypes of changes
Checklist:
🤖 Generated with Claude Code