Commit 94447ba
fix(security): Verify magic bytes instead of file(1) for trace_processor
The previous check ran `file /tmp/trace_processor | grep -q executable` after
downloading the Perfetto trace_processor wrapper. That is unreliable in both
directions:
- get.perfetto.dev currently serves a Python wrapper script (#!/usr/bin/env
python3). Depending on the file(1) version and magic database, shebang
scripts may be reported as "Python script, ASCII text" without the word
"executable", failing the check.
- If Perfetto ever switches to native PIE ELF binaries, older file(1) versions
(< 5.36) report them as "shared object" without "executable", also failing.
In both cases the valid download was deleted and the workflow aborted.
Check magic bytes directly instead — shebang (#!), ELF, or Mach-O — which is
stable across platforms and file(1) versions. Also add `curl --fail` so HTTP
errors do not leave a partial/HTML response on disk that would then be
validated.
Refs LINEAR-EME-1060
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent c7b4981 commit 94447ba
1 file changed
Lines changed: 17 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
34 | 42 | | |
35 | 43 | | |
36 | 44 | | |
| |||
0 commit comments