The filesystem glob pattern wildcards *
, ?
, and [...]
match file path literals and leading dots by default, which unintentionally exposes sub folder content of allowed paths.
Example: The fs
scope $HOME/*.key
would also allow $HOME/.ssh/secret.key
to be read even though it is in a sub directory of $HOME
and is inside a hidden folder.
Scopes without the wildcards are not affected. As **
allows for sub directories the behavior there is also as expected.
The issue has been patched in the latest release and was backported into the currently supported 1.x branches.
No workaround is known at the time of publication.
The original report contained information that the dialog.open
component automatically allows one sub directory to be read, regardless of the recursive
option.
Imagine a file system looking like
o ../
o documents/
- file.txt
- deeper/
o deep_file.txt
Reproduction steps:
The recursive flag is used in https://github.com/tauri-apps/tauri/blob/cd8c074ae6592303d3f6844a4fb6d262eae913b2/core/tauri/src/scope/fs.rs#L154 to scope the filesystem access to either files in the folder or to also include sub directories.
The original issue was replicated and further investigated.
The root cause was triaged to the glob
crate facilitating defaults, which allow the *
and [...]
to also match path literals.
MatchOptions {
case_sensitive: true,
require_literal_separator: false,
require_literal_leading_dot: false
}
This implicated that not only the dialog.open
component was affected but rather all fs
scopes containing the *
or [...]
glob.
During this investigation it became obvious that the current glob matches would also match hidden folder (e.g: .ssh
) content by default, without explicitly allowing hidden folders to be matched. This is not commonly expected behavior in comparison to for example bash
.
The new default Match options are:
MatchOptions {
case_sensitive: true,
require_literal_separator: true,
require_literal_leading_dot: true
}
Another note security relevant for developers building applications interacting with case sensitive filesystems is, that the
case_sensitive
option only affects ASCII file paths and is not valid in Unicode based paths. This is considered a known risk until theglob
crate supports non-ASCII file paths for this type of case sensitive matching.
If you have any questions or comments about this advisory:
Open an issue in tauri Email us at security@tauri.app
{ "nvd_published_at": "2022-12-23T14:15:00Z", "github_reviewed_at": "2022-12-22T20:03:43Z", "severity": "MODERATE", "github_reviewed": true, "cwe_ids": [ "CWE-22" ] }