-
Notifications
You must be signed in to change notification settings - Fork 11
chore: Add JIRA sync workflow #89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,15 @@ | ||||||||||||||||||||||||||||||||||||||||
| name: JIRA Sync | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||||||||||||||||
| pull_request: | ||||||||||||||||||||||||||||||||||||||||
| types: | ||||||||||||||||||||||||||||||||||||||||
| - opened | ||||||||||||||||||||||||||||||||||||||||
| - edited | ||||||||||||||||||||||||||||||||||||||||
| - ready_for_review | ||||||||||||||||||||||||||||||||||||||||
| - converted_to_draft | ||||||||||||||||||||||||||||||||||||||||
| - closed | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||||||||||||
| jira-sync: | ||||||||||||||||||||||||||||||||||||||||
| uses: flume/github-actions/.github/workflows/jira-sync.yml@main | ||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
| uses: flume/github-actions/.github/workflows/jira-sync.yml@main | |
| uses: flume/github-actions/.github/workflows/jira-sync.yml@v1 |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI about 2 months ago
To fix the problem, explicitly declare permissions for the workflow or for the jira-sync job so that the GITHUB_TOKEN is restricted to the minimal necessary access. Since this workflow solely delegates to a reusable workflow and we do not see it performing any direct repository operations itself, a safe default is to set contents: read at the top level. This documents that the workflow only needs read access to repository contents (and lets the called reusable workflow further refine permissions if needed).
The best minimal change without altering existing functionality is to add a root-level permissions block between the on: block and the jobs: block. For example, in .github/workflows/jira-sync.yml, after line 10 or 11, add:
permissions:
contents: readThis will apply to all jobs (here, just jira-sync) which do not have their own permissions block, and will satisfy the CodeQL rule while following the principle of least privilege. No imports or additional methods are needed since this is a YAML configuration change only.
-
Copy modified lines R12-R14
| @@ -9,6 +9,9 @@ | ||
| - converted_to_draft | ||
| - closed | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| jira-sync: | ||
| uses: flume/github-actions/.github/workflows/jira-sync.yml@main |
Copilot
AI
Mar 11, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
secrets: inherit forwards all repository/environment secrets to the called workflow. That increases blast radius if the reusable workflow is modified or if it doesn't strictly limit what it logs/exports. Prefer explicitly passing only the required secrets, or ensure the reusable workflow is in the same repo and pinned to an immutable ref.
| secrets: inherit | |
| secrets: | |
| JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This workflow doesn't set explicit
permissions. By default theGITHUB_TOKENpermissions can be broader than necessary depending on org/repo settings, and those permissions may carry into the called reusable workflow. Define minimal required permissions (e.g.,contents: readplus only what JIRA sync needs such aspull-requests: read/write) at the workflow or job level.