feat: auto-rebase all open PRs onto master#268
Conversation
Agent-Logs-Url: https://github.com/profullstack/sh1pt/sessions/d2e101e7-892a-4da6-b310-bbf135322962 Co-authored-by: ralyodio <27381+ralyodio@users.noreply.github.com>
Agent-Logs-Url: https://github.com/profullstack/sh1pt/sessions/d2e101e7-892a-4da6-b310-bbf135322962 Co-authored-by: ralyodio <27381+ralyodio@users.noreply.github.com>
vu1nz Security Review1 finding(s) in PR #268 MEDIUM: 1 Findings
Full AI AnalysisAfter carefully reviewing this GitHub Actions workflow and shell script for auto-rebasing PRs, I found one security issue:
Analysis DetailsThe security issue occurs because the workflow constructs a git push URL using the git push "https://github.com/${FORK_REPO}.git" "HEAD:refs/heads/$HEAD_BRANCH" --force-with-leaseWhile GitHub's API should return properly formatted repository names, an attacker could potentially manipulate this if they control the fork repository name or if there's an API response injection. The risk is somewhat mitigated because:
However, it's still a best practice to validate external data before using it in shell commands. Other Security Considerations (Not Vulnerabilities)The workflow follows several good security practices:
The overall design is reasonably secure for its intended purpose. |
Summary
Adds automated rebase infrastructure so every open PR is kept up-to-date with
masterwithout manual intervention.What's added
.github/workflows/auto-rebase.yml— GitHub Actions workflow that:master(rebases all open PRs)workflow_dispatch(optionally targeting a single PR number)git rebase -X theirs master— resolves all conflicts automatically by preferring the PR's own changespnpm-lock.yaml,package-lock.json,yarn.lock,bun.lockb) when the merge strategy can't auto-resolve thempnpm-lock.yaml(viapnpm install --no-frozen-lockfile) whenpackage.jsonchangedgh auth setup-git(token never embedded in URLs)scripts/rebase-prs.sh— Companion shell script for local/manual use with the same logic. Accepts optional PR numbers as arguments; defaults to all open PRs.Security considerations
pr_number) is passed via environment variable, not interpolated directly into shell code (prevents injection)gh auth setup-gitrather than embedded in git remote URLsforce-with-leaseis used instead of--forceto guard against overwriting concurrent pushesImportant note for fork PRs
Because all 29 outstanding PRs are from external forks, the push step requires each PR author to have enabled "Allow edits from maintainers" in their PR settings. PRs where this is disabled will be skipped with an explanatory comment. Once this workflow is merged to
master, trigger it manually (Actions → Auto Rebase PRs → Run workflow) to immediately rebase all eligible PRs.Checklist
test.yml)