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
* use ctor to cache starting executable
* clean up symlink checking logic
* changefile
* use wrapper for the static, put it in tauri_utils
* cargo +nightly fmt
* add license header to `StartingBinary`
* fix clippy warning
* fix: test
* simplify macOS dangerous flag detection
* update restart test to allow expected failure on macOS
* finish documentation
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
/// [See the patch that enabled this]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=800179c9b8a1e796e441674776d11cd4c05d61d7
Copy file name to clipboardExpand all lines: core/tauri/src/api/process.rs
+21-58Lines changed: 21 additions & 58 deletions
Original file line number
Diff line number
Diff line change
@@ -17,83 +17,46 @@ pub use command::*;
17
17
18
18
/// Finds the current running binary's path.
19
19
///
20
-
/// # Platform-specific behavior
21
-
///
22
-
/// On the `Linux` platform, this function will also **attempt** to detect if
23
-
/// it's currently running from a valid [AppImage] and use that path instead.
24
-
///
25
-
/// # Security
26
-
///
27
-
/// If the above Platform-specific behavior does not take place, this function
28
-
/// uses [`std::env::current_exe`]. Notably, it also has a security section
29
-
/// that goes over a theoretical attack using hard links. Let's cover some
30
-
/// specific topics that relate to different ways an attacker might try to
31
-
/// trick this function into returning the wrong binary path.
32
-
///
33
-
/// ## Symlinks ("Soft Links")
34
-
///
35
-
/// [`std::path::Path::canonicalize`] is used to resolve symbolic links to the
36
-
/// original path, including nested symbolic links (`link2 -> link1 -> bin`).
20
+
/// With exception to any following platform-specific behavior, the path is cached as soon as
21
+
/// possible, and then used repeatedly instead of querying for a new path every time this function
22
+
/// is called.
37
23
///
38
-
/// ## Hard Links
39
-
///
40
-
/// A [Hard Link] is a named entry that points to a file in the file system.
41
-
/// On most systems, this is what you would think of as a "file". The term is
42
-
/// used on filesystems that allow multiple entries to point to the same file.
43
-
/// The linked [Hard Link] Wikipedia page provides a decent overview.
44
-
///
45
-
/// In short, unless the attacker was able to create the link with elevated
46
-
/// permissions, it should generally not be possible for them to hard link
47
-
/// to a file they do not have permissions to - with exception to possible
48
-
/// operating system exploits.
49
-
///
50
-
/// There are also some platform-specific information about this below.
51
-
///
52
-
/// ### Windows
24
+
/// # Platform-specific behavior
53
25
///
54
-
/// Windows requires a permission to be set for the user to create a symlink
55
-
/// or a hard link, regardless of ownership status of the target. Elevated
56
-
/// permissions users have the ability to create them.
26
+
/// ## Linux
57
27
///
58
-
/// ### macOS
28
+
/// On Linux, this function will **attempt** to detect if it's currently running from a
29
+
/// valid [AppImage] and use that path instead.
59
30
///
60
-
/// macOS allows for the creation of symlinks and hard links to any file.
61
-
/// Accessing through those links will fail if the user who owns the links
62
-
/// does not have the proper permissions on the original file.
31
+
/// ## macOS
63
32
///
64
-
/// ### Linux
33
+
/// On `macOS`, this function will return an error if the original path contained any symlinks
34
+
/// due to less protection on macOS regarding symlinks. This behavior can be disabled by setting the
35
+
/// `process-relaunch-dangerous-allow-symlink-macos` feature, although it is *highly discouraged*.
65
36
///
66
-
/// Linux allows for the creation of symlinks to any file. Accessing the
67
-
/// symlink will fail if the user who owns the symlink does not have the
68
-
/// proper permissions on the original file.
37
+
/// # Security
69
38
///
70
-
/// Linux additionally provides a kernel hardening feature since version
71
-
/// 3.6 (30 September 2012). Most distributions since then have enabled
72
-
/// the protection (setting `fs.protected_hardlinks = 1`) by default, which
73
-
/// means that a vast majority of desktop Linux users should have it enabled.
74
-
/// **The feature prevents the creation of hardlinks that the user does not own
75
-
/// or have read/write access to.** [See the patch that enabled this.](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=800179c9b8a1e796e441674776d11cd4c05d61d7)
39
+
/// See [`tauri_utils::platform::current_exe`] for possible security implications.
0 commit comments