fix: ci release error - #15
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe release workflow now grants repository content write access, uses ChangesRelease workflow
Estimated code review effort: 2 (Simple) | ~10 minutes ✨ 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 |
| - name: Create GitHub Release | ||
| uses: actions/create-release@latest | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.PROJECT_RELEASE_TOKEN }} | ||
| with: | ||
| tag_name: v${{steps.version.outputs.value}} | ||
| release_name: v${{steps.version.outputs.value}} | ||
| body: ${{steps.description.outputs.content}} | ||
| draft: false | ||
| prerelease: false | ||
| GH_TOKEN: ${{ github.token }} | ||
| run: | | ||
| gh release create "v${{ steps.version.outputs.value }}" \ | ||
| --title "v${{ steps.version.outputs.value }}" \ | ||
| --notes-file release/description.md |
There was a problem hiding this comment.
Version output enables shell injection
When a commit on master or main supplies shell syntax in release/package.json, GitHub expands the unvalidated version directly into this script before parsing, allowing arbitrary commands to run with the contents: write token and modify repository content. Pass the output through an environment variable so the shell treats it as data. How this was verified: The workflow copies the unvalidated JSON value into a step output and expands it directly into a command executed with GH_TOKEN and contents: write.
| - name: Create GitHub Release | |
| uses: actions/create-release@latest | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.PROJECT_RELEASE_TOKEN }} | |
| with: | |
| tag_name: v${{steps.version.outputs.value}} | |
| release_name: v${{steps.version.outputs.value}} | |
| body: ${{steps.description.outputs.content}} | |
| draft: false | |
| prerelease: false | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| gh release create "v${{ steps.version.outputs.value }}" \ | |
| --title "v${{ steps.version.outputs.value }}" \ | |
| --notes-file release/description.md | |
| - name: Create GitHub Release | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| VERSION: ${{ steps.version.outputs.value }} | |
| run: | | |
| gh release create "v${VERSION}" \ | |
| --title "v${VERSION}" \ | |
| --notes-file release/description.md |
Prompt To Fix With AI
This is a comment left during a code review.
Path: .github/workflows/release.yaml
Line: 34-40
Comment:
**Version output enables shell injection**
When a commit on `master` or `main` supplies shell syntax in `release/package.json`, GitHub expands the unvalidated version directly into this script before parsing, allowing arbitrary commands to run with the `contents: write` token and modify repository content. Pass the output through an environment variable so the shell treats it as data. **How this was verified:** The workflow copies the unvalidated JSON value into a step output and expands it directly into a command executed with `GH_TOKEN` and `contents: write`.
```suggestion
- name: Create GitHub Release
env:
GH_TOKEN: ${{ github.token }}
VERSION: ${{ steps.version.outputs.value }}
run: |
gh release create "v${VERSION}" \
--title "v${VERSION}" \
--notes-file release/description.md
```
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
Summary by CodeRabbit
Greptile Summary
The PR modernizes the release workflow and replaces third-party release helpers with inline Python and the GitHub CLI.
Confidence Score: 3/5
This PR should not merge until the version is passed to the shell through a safe data boundary or strictly validated before release creation.
The changed workflow expands unvalidated repository metadata into shell source while exposing a contents:write token, making shell command execution reachable from a malicious version value.
Files Needing Attention: .github/workflows/release.yaml
Security Review
The version read from repository metadata is directly expanded into shell source in a write-capable job, allowing shell syntax in that value to execute with repository credentials. How this was verified: The push-triggered workflow copies the unvalidated JSON value into a step output and expands it directly on the gh command line while GH_TOKEN has contents:write.
Important Files Changed
Prompt To Fix All With AI
Reviews (1): Last reviewed commit: "fix: ci release error" | Re-trigger Greptile