fix(security): restrict temp file permissions in send_matrix_email (#3239)

Set umask 077 before mktemp so the temp .ts file is created with 0600
permissions, preventing other users on shared systems from reading it.
Umask is restored immediately after file creation.

Agent: code-health

Co-authored-by: B <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
A 2026-04-08 01:33:34 -07:00 committed by GitHub
parent 7e44923fb9
commit 1745b78689
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -576,8 +576,11 @@ send_matrix_email() {
done
done
local ts_file
local ts_file old_umask
old_umask=$(umask)
umask 077
ts_file=$(mktemp /tmp/e2e-email-XXXXXX.ts)
umask "${old_umask}"
cat > "${ts_file}" << 'TS_EOF'
const results = (process.env._E2E_RESULTS ?? "").split(",").filter(Boolean);