-
Notifications
You must be signed in to change notification settings - Fork 116
chore: add stale PR cleanup workflow via centralized pr-manager #525
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
Open
Manask322
wants to merge
5
commits into
master
Choose a base branch
from
chore/add-pr-manager-workflow
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
f4a2f66
chore: add stale PR cleanup workflow via centralized pr-manager
Manask322 cd25d28
chore: add stale PR cleanup workflow via centralized pr-manager
Manask322 1bf793a
chore: add stale PR cleanup workflow via centralized pr-manager
Manask322 5f3738e
chore: fix stale PR manager workflow — correct cron, @master, secrets…
Manask322 750d9c2
chore: fix stale PR manager workflow — correct cron, @master, secrets…
Manask322 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| # PR Manager — stale PR cleanup via centralized reusable workflow in razorpay/actions. | ||
| # See: https://github.com/razorpay/actions/blob/master/.github/workflows/pr-manager.yaml | ||
| name: PR Manager | ||
|
|
||
| on: | ||
| schedule: | ||
| - cron: '30 20 * * *' # 2:00 AM IST (8:30 PM UTC) | ||
| workflow_dispatch: {} | ||
|
|
||
| jobs: | ||
| stale: | ||
| uses: razorpay/actions/.github/workflows/pr-manager.yaml@master | ||
| secrets: inherit | ||
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.
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.
Semgrep identified an issue in your code:
Workflow passes all repository secrets to external reusable workflow, violating least privilege and exposing all credentials if the reusable workflow is compromised.
More details about this
This workflow passes all repository secrets to the reusable workflow at
razorpay/actions/.github/workflows/pr-manager.yaml@masterusingsecrets: inherit.Here's how an attacker could exploit this:
Compromise or take over the reusable workflow: An attacker gains control of the
pr-manager.yamlworkflow in therazorpay/actionsrepository (e.g., by compromising the maintainer's credentials or finding a vulnerability in that repo).Extract all secrets: The compromised workflow now has access to every secret in your repository via the
inheritdirective—potentially including database credentials, API keys, deployment tokens, and authentication tokens.Exfiltrate credentials: The attacker's malicious code in the reusable workflow logs these secrets to build output, sends them to an attacker-controlled server, or commits them to a public repository.
Use secrets for lateral attacks: With credentials like
DEPLOY_TOKENorDATABASE_PASSWORD, the attacker can access your production systems, databases, or downstream services.Even if the workflow maintainers are trustworthy today, the principle of least privilege means the PR manager workflow should only receive the specific secrets it actually needs (likely none, or just a specific GitHub token), not your entire vault of credentials.
To resolve this comment:
✨ Commit fix suggestion
View step-by-step instructions
secrets: inheritwith an explicitsecrets:map under thestalejob.GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}.secrets: { GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} }or the multiline equivalent:secrets:GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}💬 Ignore this finding
Leave a nosemgrep comment directly above or at the end of line 13 like so
// nosemgrep: yaml.github-actions.security.secrets-inherit.secrets-inheritTake care to validate that this is not a true positive finding before ignoring it.
Learn more about ignoring code, files and folders here.
You can view more details about this finding in the Semgrep AppSec Platform.