You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Windows crashtracking path wrote a DLL to a predictable %TEMP% path derived from the process SID, closed the writer handle, and registered that path with WER, creating a DLL planting/TOCTOU risk.
Description
Generate crashtracking trampoline filenames with an added random suffix instead of using the SID-only deterministic name to make on-disk paths unpredictable.
Reopen the trampoline with FILE_FLAG_DELETE_ON_CLOSE so the helper DLL is removed when the owning handle is dropped instead of leaving a persistent target.
Retain the crashtracking trampoline File handle in the sidecar process for the process lifetime via a static LazyLock<Mutex<Option<File>>> to preserve delete-on-close semantics while WER may load the module.
Changes made in spawn_worker/src/win32.rs and datadog-sidecar/src/windows.rs to implement the above.
Testing
Ran cargo check -p spawn_worker -p datadog-sidecar which completed successfully.
Ran cargo fmt --all which completed successfully (rustfmt emitted warnings about some nightly options from repository config but formatting run succeeded).
This 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.
✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.62%. Comparing base (91fd13c) to head (3e5a5d0). ⚠️ Report is 1 commits behind head on main.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
%TEMP%path derived from the process SID, closed the writer handle, and registered that path with WER, creating a DLL planting/TOCTOU risk.Description
FILE_FLAG_DELETE_ON_CLOSEso the helper DLL is removed when the owning handle is dropped instead of leaving a persistent target.Filehandle in the sidecar process for the process lifetime via a staticLazyLock<Mutex<Option<File>>>to preserve delete-on-close semantics while WER may load the module.spawn_worker/src/win32.rsanddatadog-sidecar/src/windows.rsto implement the above.Testing
cargo check -p spawn_worker -p datadog-sidecarwhich completed successfully.cargo fmt --allwhich completed successfully (rustfmt emitted warnings about some nightly options from repository config but formatting run succeeded).Codex Task