Skip to content

Commit 70e3917

Browse files
committed
add more disclaimers in TinyFD usage
1 parent 4c4c052 commit 70e3917

File tree

1 file changed

+18
-0
lines changed
  • modules/ui/src/main/java/org/polyfrost/oneconfig/api/ui/v1/api

1 file changed

+18
-0
lines changed

modules/ui/src/main/java/org/polyfrost/oneconfig/api/ui/v1/api/TinyFdApi.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,17 @@ public interface TinyFdApi {
5353
/**
5454
* Open a save file selection prompt.
5555
* Same as {@link #openFileSelector(String, String, String[], String)} but says save instead of open.
56+
* <p>
57+
* On Linux, TinyFD "allows shell metacharacters in titles, messages, and other input data," meaning that it is vulnerable to command injection.
58+
* **Treat all user input as untrusted and sanitize it before passing it to TinyFD.**
5659
*/
5760
Path openSaveSelector(@Nullable String title, @Nullable String defaultFilePath, String[] filterPatterns, @Nullable String filterDescription);
5861

5962
/**
6063
* Open a file selection prompt.
64+
* <p>
65+
* On Linux, TinyFD "allows shell metacharacters in titles, messages, and other input data," meaning that it is vulnerable to command injection.
66+
* **Treat all user input as untrusted and sanitize it before passing it to TinyFD.**
6167
*
6268
* @param title the title of the prompt
6369
* @param defaultFilePath the path to the default file to select
@@ -71,17 +77,26 @@ public interface TinyFdApi {
7177
/**
7278
* Open a multi file selection prompt.
7379
* Same as {@link #openFileSelector(String, String, String[], String)} but allows the user to select multiple files.
80+
* <p>
81+
* On Linux, TinyFD "allows shell metacharacters in titles, messages, and other input data," meaning that it is vulnerable to command injection.
82+
* **Treat all user input as untrusted and sanitize it before passing it to TinyFD.**
7483
*/
7584
Path[] openMultiFileSelector(@Nullable String title, @Nullable String defaultFilePath, String[] filterPatterns, @Nullable String filterDescription);
7685

7786
/**
7887
* Open a folder selection prompt.
7988
* Same as {@link #openFileSelector(String, String, String[], String)} but allows the user to select a folder.
89+
* <p>
90+
* On Linux, TinyFD "allows shell metacharacters in titles, messages, and other input data," meaning that it is vulnerable to command injection.
91+
* **Treat all user input as untrusted and sanitize it before passing it to TinyFD.**
8092
*/
8193
Path openFolderSelector(@Nullable String title, @Nullable String defaultFolderPath);
8294

8395
/**
8496
* Shows a message box.
97+
* <p>
98+
* On Linux, TinyFD "allows shell metacharacters in titles, messages, and other input data," meaning that it is vulnerable to command injection.
99+
* **Treat all user input as untrusted and sanitize it before passing it to TinyFD.**
85100
*
86101
* @param message the message. may contain \n and \t
87102
* @param dialog the type of message box to show. <br>One of: {@link #OK_DIALOG}, {@link #OK_CANCEL_DIALOG}, {@link #YES_NO_DIALOG}, {@link #YES_NO_CANCEL_DIALOG}
@@ -93,6 +108,9 @@ public interface TinyFdApi {
93108

94109
/**
95110
* Shows a notification.
111+
* <p>
112+
* On Linux, TinyFD "allows shell metacharacters in titles, messages, and other input data," meaning that it is vulnerable to command injection.
113+
* **Treat all user input as untrusted and sanitize it before passing it to TinyFD.**
96114
*
97115
* @param icon the icon to use. One of: {@link #QUESTION_ICON}, {@link #ERROR_ICON}, {@link #WARNING_ICON}, {@link #INFO_ICON}
98116
* @return 0 if the user clicked the "ok" button, 1 for "cancel"

0 commit comments

Comments
 (0)