26
26
//! In the presence of pathological temporary file cleaner, relying on file paths is unsafe because
27
27
//! a temporary file cleaner could delete the temporary file which an attacker could then replace.
28
28
//!
29
- //! `tempfile` doesn't rely on file paths so this isn't an issue. However, `NamedTempFile` does
30
- //! rely on file paths for _some_ operations. See the security documentation on
31
- //! the `NamedTempFile` type for more information.
29
+ //! `tempfile` doesn't rely on file paths, so this should not be an issue. However,
30
+ //! `NamedTempFile` does rely on file paths for _some_ operations. On Unix-like
31
+ //! operating systems and depending on your use case, it may be possible to
32
+ //! mitigate this issue by overriding the crate's default options. For more information,
33
+ //! consult the Security documentation of the [`NamedTempFile`] type,
34
+ //! [`Builder::permissions`] and [`env::override_temp_dir`].
32
35
//!
33
36
//! The OWASP Foundation provides a resource on vulnerabilities concerning insecure
34
37
//! temporary files: https://owasp.org/www-community/vulnerabilities/Insecure_Temporary_File
@@ -172,7 +175,7 @@ pub use crate::file::{
172
175
} ;
173
176
pub use crate :: spooled:: { spooled_tempfile, SpooledData , SpooledTempFile } ;
174
177
175
- /// Create a new temporary file or directory with custom parameters.
178
+ /// Create a new temporary file or directory with custom parameters and permissions .
176
179
#[ derive( Debug , Clone , Eq , PartialEq ) ]
177
180
pub struct Builder < ' a , ' b > {
178
181
random_len : usize ,
@@ -349,7 +352,7 @@ impl<'a, 'b> Builder<'a, 'b> {
349
352
///
350
353
/// # Security
351
354
///
352
- /// By default, the permissions of tempfiles on unix are set for it to be
355
+ /// By default, the permissions of tempfiles on Unix are set for it to be
353
356
/// readable and writable by the owner only, yielding the greatest amount
354
357
/// of security.
355
358
/// As this method allows to widen the permissions, security would be
@@ -369,7 +372,7 @@ impl<'a, 'b> Builder<'a, 'b> {
369
372
/// ## Windows and others
370
373
///
371
374
/// This setting is unsupported and trying to set a file or directory read-only
372
- /// will cause an error to be returned. .
375
+ /// will return an error.
373
376
///
374
377
/// # Examples
375
378
///
0 commit comments