File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -2980,6 +2980,19 @@ pub fn read_dir<P: AsRef<Path>>(path: P) -> io::Result<ReadDir> {
29802980///
29812981/// [changes]: io#platform-specific-behavior
29822982///
2983+ /// # Symlinks
2984+ /// On UNIX systems, it is impossible to manipulate the permission bits of a symlink itself[^1].
2985+ /// Because of this, on those systems, this function will update the permission bits
2986+ /// of the file pointed to by the symlink.
2987+ ///
2988+ /// Note that this behavior can lead to privalage escalation vulnerabilites,
2989+ /// where the ability to write a symlink in one directory allows you to
2990+ /// cause the permissions of another directory to be modified.
2991+ ///
2992+ /// For this reason, using this function with symlinks should be avoided.
2993+ /// When possible, permissions should be set at creation time instead.
2994+ ///
2995+ /// [^1]: even if it were possible, the permissions on a symlink are ignored.
29832996/// # Errors
29842997///
29852998/// This function will return an error in the following situations, but is not
You can’t perform that action at this time.
0 commit comments