File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -493,6 +493,21 @@ pub fn temp_dir() -> PathBuf {
493493/// that can fail for a good number of reasons. Some errors can include, but not
494494/// be limited to, filesystem operations failing or general syscall failures.
495495///
496+ /// # Security
497+ ///
498+ /// This function should be used with care, as its incorrect usage can cause
499+ /// security problems. Specifically, as with many operations invovling files and
500+ /// paths, you can introduce a race condition. It goes like this:
501+ ///
502+ /// 1. You get the path to the current executable using `current_exe()`, and
503+ /// store it in a variable binding.
504+ /// 2. Time passes. A malicious actor removes the current executable, and
505+ /// replaces it with a malicious one.
506+ /// 3. You then use the binding to try to open that file.
507+ ///
508+ /// You expected to be opening the current executable, but you're now opening
509+ /// something completely different.
510+ ///
496511/// # Examples
497512///
498513/// ```
You can’t perform that action at this time.
0 commit comments