[ci] Added automated backport workflow#247
Conversation
📝 WalkthroughWalkthroughA new GitHub Actions workflow is introduced at Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 1 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/backport.yml:
- Line 21: Replace the mutable refs to the external reusable workflow in the
uses fields (the occurrences of
"openwisp/openwisp-utils/.github/workflows/reusable-backport.yml@master") with
an immutable commit SHA or an immutable release tag before forwarding bot
secrets; update both occurrences (the one at the top and the second occurrence
referenced in the comment) so the workflow uses a full commit SHA (or pinned
release) instead of `@master`.
ℹ️ Review info
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/backport.yml
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Build and Upload Packages
| jobs: | ||
| backport-on-push: | ||
| if: github.event_name == 'push' | ||
| uses: openwisp/openwisp-utils/.github/workflows/reusable-backport.yml@master |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# Check if the backport.yml file exists and examine the relevant lines
if [ -f ".github/workflows/backport.yml" ]; then
echo "=== File found. Displaying full content ==="
cat -n ".github/workflows/backport.yml"
else
echo "File .github/workflows/backport.yml not found"
fiRepository: openwisp/openwisp-config
Length of output: 1680
🏁 Script executed:
# Also verify the specific pattern using rg
echo "=== Checking for mutable refs (`@master/`@main/@develop/@HEAD) ==="
rg -nP --type=yaml '^\s*uses:\s*[^#\n]+@(?:master|main|develop|HEAD)\b' .github/workflows || echo "No matches found"Repository: openwisp/openwisp-config
Length of output: 362
Pin external reusable workflow refs to immutable SHAs before passing bot secrets.
Lines 21 and 36 reference @master, which is mutable. Because this workflow forwards bot credentials (OPENWISP_BOT_APP_ID and OPENWISP_BOT_PRIVATE_KEY), branch drift or upstream compromise can change executed logic without a PR in this repo. Pin to a full commit SHA (or an immutable release ref).
🔒 Proposed fix
- uses: openwisp/openwisp-utils/.github/workflows/reusable-backport.yml@master
+ uses: openwisp/openwisp-utils/.github/workflows/reusable-backport.yml@<FULL_COMMIT_SHA>Apply the same change to line 36.
References:
- https://docs.github.com/en/actions/using-workflows/reusing-workflows
- https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.github/workflows/backport.yml at line 21, Replace the mutable refs to the
external reusable workflow in the uses fields (the occurrences of
"openwisp/openwisp-utils/.github/workflows/reusable-backport.yml@master") with
an immutable commit SHA or an immutable release tag before forwarding bot
secrets; update both occurrences (the one at the top and the second occurrence
referenced in the comment) so the workflow uses a full commit SHA (or pinned
release) instead of `@master`.
Checklist
Reference to Existing Issue
openwisp/openwisp-utils#501