fix(security): Add integrity verification before chmod +x in btrace-perfetto skill#5297
fix(security): Add integrity verification before chmod +x in btrace-perfetto skill#5297fix-it-felix-sentry[bot] wants to merge 1 commit intomainfrom
Conversation
…erfetto skill Add validation to verify downloaded trace_processor file is a valid executable before making it executable. This prevents potential execution of malicious or corrupted downloads. Changes: - Verify file exists and has non-zero size - Check file type to confirm it's an executable - Remove file and exit with error if validation fails - Only chmod +x after successful verification Fixes: https://linear.app/getsentry/issue/EME-1060 Parent ticket: https://linear.app/getsentry/issue/VULN-1513 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. Bug Fixes 🐛
🤖 This preview updates automatically when you update the PR. |
Instructions and example for changelogPlease add an entry to Example: ## Unreleased
### Fixes
- Add integrity verification before chmod +x in btrace-perfetto skill ([#5297](https://github.com/getsentry/sentry-java/pull/5297))If none of the above apply, you can opt out of this check by adding |
📲 Install BuildsAndroid
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit c7b4981. Configure here.
| curl -sL "https://get.perfetto.dev/trace_processor" -o /tmp/trace_processor | ||
|
|
||
| # Verify the file is a valid executable (check file type and size) | ||
| if [[ ! -s /tmp/trace_processor ]] || ! file /tmp/trace_processor | grep -q "executable"; then |
There was a problem hiding this comment.
Fragile file check may reject valid executables
Medium Severity
The file ... | grep -q "executable" check is unreliable because get.perfetto.dev/trace_processor serves a Python wrapper script, not a native binary. The file command's inclusion of "executable" in its output for scripts depends on the system's file version and magic database — some implementations report shebanged scripts as "Python script, ASCII text" without the word "executable". Additionally, if Perfetto ever changes to serving native PIE ELF binaries, older Linux file versions (< 5.36) report them as "shared object" without "executable". In either case, the validation incorrectly deletes the valid download and exits with an error, breaking the entire workflow.
Reviewed by Cursor Bugbot for commit c7b4981. Configure here.


Summary
This PR addresses a security finding where a file is downloaded and immediately made executable without verification.
Changes
trace_processorfile is a valid executable before making it executable[[ -s ]]filecommandchmod +xafter successful verificationSecurity Context
The original code pattern (
curl ... && chmod +x) was flagged as a security risk because it could potentially execute malicious or corrupted downloads. While the download is from a trusted HTTPS source (get.perfetto.dev), adding integrity verification is a security best practice that aligns with OWASP guidelines for Software and Data Integrity.References
Testing
This change affects documentation in a Claude Code skill file. The validation logic follows standard bash practices and will properly verify downloaded executables before making them executable.
🤖 Generated with Claude Code by fix-it-felix-sentry[bot]