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
{{ message }}
Repository navigation
Commit fd29861
Browse filesBrowse the repository at this point in the historyBrowse files
fix: prevent launcher option and shell injection (#124)
Opening an attacker-controlled dash-leading path could be interpreted as
launcher options. On Windows, cmd /c start also parsed embedded quotes and
metacharacters as command language, while the legacy gnome-open fallback
could load a module even after a double-dash separator.
Add command-construction regressions for malicious option-shaped paths and
Windows shell metacharacters. Use supported separators on macOS and KDE, and
rewrite dash-leading relative paths for launchers without separator support.
Keep Windows values out of shell syntax by passing the default target through
the environment and invoking custom applications directly, with explorer.exe
as a PowerShell-free fallback.
Exclude cmd-based opening by default, while providing an
explicit insecure Cargo feature for users who need compatibility it
and accept their unsafe handling of untrusted input.
Validated with default and all-feature cargo tests, clippy, and cross-target
cargo check --tests for aarch64 Linux and Windows.
Co-authored-by: Sebastian Thiel <sebastian.thiel@icloud.com>
Copy file name to clipboardExpand all lines: src/lib.rs
+11Lines changed: 11 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -85,6 +85,17 @@
85
85
//!
86
86
//! It cannot be overemphasized how fragile this all is in UNIX environments. It is common for the various MIME tables to incorrectly specify the application "owning" a given filetype.
87
87
//! It is common for openers to behave strangely. Use with caution, as this crate merely inherits a particular platforms shortcomings.
88
+
//!
89
+
//! ## Security boundaries
90
+
//!
91
+
//! Paths passed to system launchers are separated from launcher options where the
92
+
//! launcher supports it. Applications selected through [`with()`] have arbitrary
93
+
//! command-line grammars, however, so the crate cannot guarantee that every custom
94
+
//! application treats a dash-leading path as data. Launching a document or custom
95
+
//! URL scheme also trusts the configured local handler and the launched content.
96
+
//! The `insecure` Cargo feature restores the legacy `cmd /c start` launcher on
97
+
//! Windows for compatibility, but must not be enabled when paths or URLs may be
0 commit comments