WICG / file-system-access

Expose the file system on the user’s device, so Web apps can interoperate with the user’s native applications.
https://wicg.github.io/file-system-access/
Other
670 stars 66 forks source link

Limit what code points are allowed in suffixes. #252

Closed mkruisselbrink closed 4 years ago

mkruisselbrink commented 4 years ago

There are a number of issues with what we allow in extensions that a website can provide when showing a file picker. Since the file picker (on most platforms) appends these extensions to the filename the user enters, this can result in filenames with characters we don’t want to allow/that are otherwise problematic. In particular we don't want to allow control characters or whitespace in suffixes, or filenames that end in a '.'. As such this PR adds restrictions on what characters are allowed in accepts file extensions/suffixes, as well as limiting their length to 16.

Limiting extensions to only contain alphanumeric characters, + or . still allows all extensions in the shared-mime-info database as well as nearly all extensions in Wikipedia's List of filename extensions.

On Windows file suffixes such as .lnk and .local are also particularly dangerous to be written to. We opted not to reject these when specified as "accepted" file types in showSaveFilePicker though, instead leaving it up to the user agent to ignore these file suffixes, and/or block writing to these file types completely.

Considered alternatives


Preview | Diff