Skip to content

Commit c7b4981

Browse files
fix(security): Add integrity verification before chmod +x in btrace-perfetto 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>
1 parent 6cf6485 commit c7b4981

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

.claude/skills/btrace-perfetto/SKILL.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,18 @@ Before starting, verify:
2222
```
2323
3. **Perfetto trace_processor**: Check if `/tmp/trace_processor` exists. If not, download it:
2424
```bash
25-
curl -sL "https://get.perfetto.dev/trace_processor" -o /tmp/trace_processor && chmod +x /tmp/trace_processor
25+
# Download trace_processor
26+
curl -sL "https://get.perfetto.dev/trace_processor" -o /tmp/trace_processor
27+
28+
# Verify the file is a valid executable (check file type and size)
29+
if [[ ! -s /tmp/trace_processor ]] || ! file /tmp/trace_processor | grep -q "executable"; then
30+
echo "Error: Downloaded file is not a valid executable"
31+
rm -f /tmp/trace_processor
32+
exit 1
33+
fi
34+
35+
# Make executable only after verification
36+
chmod +x /tmp/trace_processor
2637
```
2738
4. **Device ABI**: Run `adb shell getprop ro.product.cpu.abi` — btrace only supports arm64-v8a and armeabi-v7a (no x86/x86_64)
2839

0 commit comments

Comments
 (0)