crashtracker: verify unix socket peer uid before parsing reports#1968
crashtracker: verify unix socket peer uid before parsing reports#1968paullegranddc wants to merge 1 commit into
Conversation
📚 Documentation Check Results📦
|
Clippy Allow Annotation ReportComparing clippy allow annotations between branches:
Summary by Rule
Annotation Counts by File
Annotation Stats by Crate
About This ReportThis report tracks Clippy allow annotations for specific rules, showing how they've changed in this PR. Decreasing the number of these annotations generally improves code quality. |
🔒 Cargo Deny Results📦
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1968 +/- ##
==========================================
- Coverage 72.63% 72.60% -0.03%
==========================================
Files 448 448
Lines 73582 73598 +16
==========================================
- Hits 53444 53437 -7
- Misses 20138 20161 +23
🚀 New features to boost your workflow:
|
🎉 All green!❄️ No new flaky tests detected 🎯 Code Coverage (details) 🔗 Commit SHA: 00737fa | Docs | Datadog PR Page | Give us feedback! |
Artifact Size Benchmark Reportaarch64-alpine-linux-musl
aarch64-unknown-linux-gnu
libdatadog-x64-windows
libdatadog-x86-windows
x86_64-alpine-linux-musl
x86_64-unknown-linux-gnu
|
| ) -> anyhow::Result<()> { | ||
| let (unix_stream, _) = listener.accept().await?; | ||
| #[cfg(target_os = "linux")] | ||
| ensure_same_user(&unix_stream)?; |
There was a problem hiding this comment.
It would be good to add tests verifying the new enforcement
|
This assumes that the scripts themselves don't execute set(e)uid() as part of their normal execution. (e.g. with the sidecar, the sidecar spawns at startup, but crashtracker gets its dedicated socket, which would now fail to access.) |
Then maybe instead of checking uid, it could be interesting to check that the connecting process either is the parent process, or has the same parent process as the crashtracker |
Motivation
Description
ensure_same_userthat usesgetsockopt(..., SO_PEERCRED, ...)to obtain the peerucredand compares the peer UID to the receiver effective UID vialibc::geteuid().async_receiver_entry_point_unix_listenerbefore any parsing of the incoming crashreport stream.AsRawFdfor access to the accepted socket file descriptor and kept the change confined tolibdd-crashtracker/src/receiver/entry_points.rsto minimize surface area.Testing
cargo fmt --alland formatting completed successfully.cargo test -p libdd-crashtracker --no-runwhich compiled the crate tests successfully (tests were prepared but not executed) and completed without build errors.Codex Task