-
Notifications
You must be signed in to change notification settings - Fork 1
chore: add stale PR cleanup workflow via centralized pr-manager #310
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
4
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
4 commits
Select commit
Hold shift + click to select a range
a13c3c5
chore: add stale PR cleanup workflow via centralized pr-manager
Manask322 6733e64
chore: add stale PR cleanup workflow via centralized pr-manager
Manask322 398a25c
chore: fix stale PR manager workflow — correct cron, @master, secrets…
Manask322 19f5fe0
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:
The workflow passes all secrets to an external reusable workflow using
secrets: inherit, giving the external workflow access to every repository secret. If the external workflow is compromised, an attacker gains access to all your secrets.More details about this
This workflow passes all secrets to the reusable workflow
razorpay/actions/.github/workflows/pr-manager.yaml@masterusingsecrets: inherit.Here's how this creates a security risk:
Attacker compromises the external workflow: An attacker with access to the
razorpay/actionsrepository could modify the reusable workflow to exfiltrate secrets (e.g., by adding a step that logs${{ secrets.GITHUB_TOKEN }}or other secrets to workflow logs).All repository secrets become accessible: Because you're using
secrets: inherit, every secret stored in your repository settings (API keys, deployment tokens, authentication credentials, etc.) gets passed into that external workflow's execution context.Attacker uses stolen secrets: The compromised workflow could grab those secrets and send them to an attacker-controlled server, giving them access to your infrastructure, databases, or third-party services.
Even if the
razorpay/actionsworkflow isn't malicious today, it could be compromised in the future, or a maintainer could go rogue. You're giving away the keys to your entire secret vault based on trust in an external party.The issue here is that the
stalejob doesn't need every secret—it probably only needs specific ones (if any) to complete its PR cleanup task. By usingsecrets: inherit, you're violating the principle of least privilege.To resolve this comment:
✨ Commit fix suggestion
View step-by-step instructions
secrets: inheritwith an explicitsecrets:mapping under thestalejob.GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}.secrets: { GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} }or the YAML 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.