-
Notifications
You must be signed in to change notification settings - Fork 55
Add use-pr-linker workflow to auto-link PRs to issues #279
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
base: develop-java21
Are you sure you want to change the base?
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,21 @@ | ||||||||||||||
| name: Auto link PR to Issues | ||||||||||||||
|
|
||||||||||||||
| on: | ||||||||||||||
| pull_request_target: | ||||||||||||||
| types: | ||||||||||||||
| - opened | ||||||||||||||
| - edited | ||||||||||||||
| - synchronize | ||||||||||||||
| - reopened | ||||||||||||||
| - closed | ||||||||||||||
|
|
||||||||||||||
| permissions: | ||||||||||||||
| contents: read | ||||||||||||||
| issues: write | ||||||||||||||
| pull-requests: read | ||||||||||||||
|
|
||||||||||||||
| jobs: | ||||||||||||||
| call-linker: | ||||||||||||||
| uses: mosip/kattu/.github/workflows/link-pr-to-issue.yml@develop | ||||||||||||||
| secrets: | ||||||||||||||
| ACTION_PAT: ${{ secrets.ACTION_PAT }} | ||||||||||||||
|
Comment on lines
+19
to
+21
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Fetch the latest commit SHA for the develop branch of mosip/kattu
curl -s https://api.github.com/repos/mosip/kattu/commits/develop | jq -r '.sha'Repository: mosip/audit-manager Length of output: 104 Critical: Pin reusable workflow to an immutable commit SHA instead of This workflow runs on 🔒 Proposed fix jobs:
call-linker:
- uses: mosip/kattu/.github/workflows/link-pr-to-issue.yml@develop
+ uses: mosip/kattu/.github/workflows/link-pr-to-issue.yml@6bb3c38b8f5643b906a0d7f4baaede996766b71e
secrets:
ACTION_PAT: ${{ secrets.ACTION_PAT }}📝 Committable suggestion
Suggested change
🧰 Tools🪛 zizmor (1.25.2)[error] 19-19: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) 🤖 Prompt for AI Agents |
||||||||||||||
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.
🧩 Analysis chain
🏁 Script executed:
Repository: mosip/audit-manager
Length of output: 1283
🏁 Script executed:
Repository: mosip/audit-manager
Length of output: 173
🏁 Script executed:
Repository: mosip/audit-manager
Length of output: 7471
🏁 Script executed:
Repository: mosip/audit-manager
Length of output: 1124
🏁 Script executed:
Repository: mosip/audit-manager
Length of output: 36974
🏁 Script executed:
Repository: mosip/audit-manager
Length of output: 394
🏁 Script executed:
Repository: mosip/audit-manager
Length of output: 4638
🏁 Script executed:
Repository: mosip/audit-manager
Length of output: 19811
Major security risk:
pull_request_targetpassingACTION_PATto mutable external workflow enables fork-driven issue/comment writes..github/workflows/use-pr-linker.ymlruns onpull_request_targetand passessecrets.ACTION_PATintomosip/kattu/.github/workflows/link-pr-to-issue.yml@develop(mutable ref), withissues: writepermissions.secrets.ACTION_PATand uses it asGH_TOKENto search, delete, PATCH, and POST issue comments via the GitHub API.REPO/NUMBERfrom PR title/body: it acceptsowner/repo#number(or defaults to the base repo) and then useshttps://api.github.com/repos/$REPO/issues/$NUMBER/comments...—there’s no fork/untrusted-source gating shown before using the PAT.Verify whether
pull_request_targetis necessary for fork PRs; if not, switch topull_request. If it must remain, gate secret usage to same-repo PRs only, pin the external workflow to a commit SHA (or vendor it), and restrict comment targets to the base repo.🧰 Tools
🪛 zizmor (1.25.2)
[error] 3-10: use of fundamentally insecure workflow trigger (dangerous-triggers): pull_request_target is almost always used insecurely
(dangerous-triggers)
🤖 Prompt for AI Agents