-
-
Notifications
You must be signed in to change notification settings - Fork 1
chore: enforce semantic pr #13
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
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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 |
|---|---|---|
| @@ -1,7 +1,6 @@ | ||
| ## Description | ||
|
|
||
|
|
||
| Add description here | ||
|
|
||
| ## Screenshots/Images | ||
|
|
||
| Add images here | ||
|
|
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,31 @@ | ||
| name: Semantic PR | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [main] | ||
|
|
||
| permissions: | ||
| pull-requests: read | ||
|
|
||
| jobs: | ||
| semantic-pr: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: amannn/action-semantic-pull-request@v5 | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| with: | ||
| types: | | ||
| feat | ||
| fix | ||
| chore | ||
| docs | ||
| test | ||
| refactor | ||
| ci | ||
| perf | ||
| requireScope: false | ||
| subjectPattern: ^[a-z].+$ | ||
| subjectPatternError: | | ||
| The subject "{subject}" found in the pull request title "{title}" | ||
| must start with a lowercase letter. | ||
Oops, something went wrong.
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.
🧩 Analysis chain
🏁 Script executed:
Repository: smnatale/coderabbit.nvim
Length of output: 291
🏁 Script executed:
Repository: smnatale/coderabbit.nvim
Length of output: 1568
🏁 Script executed:
#!/bin/bash cat -n .github/workflows/semantic-pr.ymlRepository: smnatale/coderabbit.nvim
Length of output: 981
🌐 Web query:
GitHub Actions security best practices mutable action tags pull_request_target💡 Result:
GitHub Actions security best practices for mutable action tags and pull_request_target focus on preventing supply chain attacks and remote code execution (RCE). Key practices: 1. Pin actions to full-length commit SHAs for immutability: Avoid tags like
@v1or branches like@main, as they are mutable and can be hijacked. Use specific SHAs, e.g., uses: tj-actions/changed-files@abcdef1. This is the only way to ensure immutability. 2. For pull_request_target: Use only when necessary (e.g., labeling PRs needing write access). Never checkout untrusted PR code with actions/checkout using ref: ${{ github.event.pull_request.head.sha }}. This grants RCE with access to secrets and GITHUB_TOKEN (read/write by default). Instead, use pull_request for builds/tests (limited permissions), then workflow_run for privileged follow-ups after approval. 3. Additional mitigations: - Set explicit permissions: {contents: read} or job-level restrictions; default to read-only. - Avoid saving caches or artifacts in pull_request_target to prevent poisoning. - Require manual approval (e.g., 'safe to test' label) or restrict to same-repo PRs: if: github.event.pull_request.head.repo.full_name == github.repository. - Use verified creators from Marketplace; review/fork third-party actions. - Enable GitHub features: Dependabot for updates, CodeQL for scanning workflows, action allowlists. Recent changes (effective Dec 2025): pull_request_target always uses default branch for workflow source/ref, aligning with security model. Examples: Safe pull_request_target (labeling): on: pull_request_target permissions: pull-requests: write steps: - uses: actions/labeler@v4 # No checkout of PR head Unsafe (avoid): on: pull_request_target steps: - checkout: ref: ${{ github.event.pull_request.head.sha }} - run: npm install # Executes untrusted code with secretsCitations:
Pin the third-party action to an immutable commit SHA.
This workflow uses
pull_request_target(line 4), a privileged event that executes with access to secrets and tokens. The action reference on line 14 uses the mutable semantic version tag@v5, which could be compromised if the upstream maintainer's account is hijacked or a tag is force-pushed. Pin the action to a specific commit SHA for immutability and supply-chain security.Suggested change
To find the commit SHA for v5, run:
curl -s https://api.github.com/repos/amannn/action-semantic-pull-request/git/ref/tags/v5 | jq '.object.sha'🤖 Prompt for AI Agents