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
cap-tempfile: Don't create anonymous files with 0o666 (#403)
* cap-tempfile: Don't create anonymous files with 0o666
When creating anonymous temporary files, use mode 0o000 instead of 0o666
to further discourage anything else from opening them.
This fixes a bug pointed out in #390.
* Fix anonymous files on Windows.
* Fix umask tests on non-Linux Unix platforms.
* Fix tempfile path.
* Fix compilation on MSRV.
* Fix compilation on Darwin.
// We default to 0o666, same as main rust when creating new files; this will be
72
-
// modified by umask: <https://github.com/rust-lang/rust/blob/44628f7273052d0bb8e8218518dacab210e1fe0d/library/std/src/sys/unix/fs.rs#L762>
73
-
let mode = Mode::from_raw_mode(0o666);
71
+
// For anonymous files, open with no permissions to discourage other
72
+
// processes from opening them.
73
+
//
74
+
// For named files, default to 0o666, same as main rust when creating new
0 commit comments