RESOLVED FIXED 202034
Sanitize suggested filenames used for saving PDFs
https://bugs.webkit.org/show_bug.cgi?id=202034
Summary Sanitize suggested filenames used for saving PDFs
Tim Horton
Reported 2019-09-19 23:12:23 PDT
Percent-encode suggested filenames used for saving PDFs
Attachments
Patch (8.47 KB, patch)
2019-09-19 23:13 PDT, Tim Horton
no flags
Patch (8.54 KB, patch)
2019-09-20 12:02 PDT, Tim Horton
no flags
Patch (8.54 KB, patch)
2019-09-20 12:09 PDT, Tim Horton
no flags
Patch (8.58 KB, patch)
2019-09-20 12:15 PDT, Tim Horton
commit-queue: commit-queue-
Tim Horton
Comment 1 2019-09-19 23:13:11 PDT
Tim Horton
Comment 2 2019-09-19 23:13:13 PDT
Alex Christensen
Comment 3 2019-09-20 01:10:42 PDT
Comment on attachment 379212 [details] Patch No unit test?
Tim Horton
Comment 4 2019-09-20 12:02:43 PDT
Chris Dumez
Comment 5 2019-09-20 12:03:56 PDT
Comment on attachment 379254 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=379254&action=review > Source/WebKit/ChangeLog:3 > + Percent-encode suggested filenames used for saving PDFs Title is not accurate anymore. Maybe simply Sanitize instead of Percent-encode? > Source/WebKit/ChangeLog:19 > + Percent-encode suggested filenames to ensure that they comprise only one path component ditto.
Tim Horton
Comment 6 2019-09-20 12:08:23 PDT
(In reply to Alex Christensen from comment #3) > Comment on attachment 379212 [details] > Patch > > No unit test? No, it's not possible to get in this situation normally (since the filename comes *from* an already-encoded source). Only in the case of a compromised web content process. One could imagine adding a path to allow arbitrary text there for testing, but the added complexity seems not worth it (and possibly problematic).
Tim Horton
Comment 7 2019-09-20 12:08:32 PDT
Good point about the title
Tim Horton
Comment 8 2019-09-20 12:09:18 PDT
Chris Dumez
Comment 9 2019-09-20 12:12:34 PDT
Comment on attachment 379255 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=379255&action=review r=me with nits. > Source/WebKit/ChangeLog:19 > + Percent-encode suggested filenames to ensure that they comprise only one path component You failed to fix this one. > Source/WebKit/UIProcess/WebPageProxy.cpp:7830 > + String encodedFilename = ResourceResponseBase::sanitizeSuggestedFilename(suggestedFilename); s/encodedFilename/sanitizedFilename > Source/WebKit/UIProcess/mac/WebPageProxyMac.mm:501 > + auto encodedFileName = ResourceResponseBase::sanitizeSuggestedFilename(suggestedFilename); s/encodedFilename/sanitizedFilename Seems like this could be after the data.isEmpty() check. > Source/WebKit/UIProcess/mac/WebPageProxyMac.mm:513 > + if (!data.size()) { data.isEmpty()
Tim Horton
Comment 10 2019-09-20 12:13:40 PDT
Comment on attachment 379255 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=379255&action=review >> Source/WebKit/ChangeLog:19 >> + Percent-encode suggested filenames to ensure that they comprise only one path component > > You failed to fix this one. :| >> Source/WebKit/UIProcess/WebPageProxy.cpp:7830 >> + String encodedFilename = ResourceResponseBase::sanitizeSuggestedFilename(suggestedFilename); > > s/encodedFilename/sanitizedFilename That's fair >> Source/WebKit/UIProcess/mac/WebPageProxyMac.mm:513 >> + if (!data.size()) { > > data.isEmpty() What no I think we just delete this one.
Tim Horton
Comment 11 2019-09-20 12:15:45 PDT
Chris Dumez
Comment 12 2019-09-20 12:15:56 PDT
Comment on attachment 379255 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=379255&action=review >>> Source/WebKit/UIProcess/mac/WebPageProxyMac.mm:513 >>> + if (!data.size()) { >> >> data.isEmpty() > > What no I think we just delete this one. ahah lol, indeed.
WebKit Commit Bot
Comment 13 2019-09-20 14:40:42 PDT
Comment on attachment 379256 [details] Patch Rejecting attachment 379256 [details] from commit-queue. Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', '--status-host=webkit-queues.webkit.org', '--bot-id=webkit-cq-01', 'land-attachment', '--force-clean', '--non-interactive', '--parent-command=commit-queue', 379256, '--port=mac']" exit_code: 2 cwd: /Volumes/Data/EWS/WebKit Logging in as commit-queue@webkit.org... Fetching: https://bugs.webkit.org/attachment.cgi?id=379256&action=edit Fetching: https://bugs.webkit.org/show_bug.cgi?id=202034&ctype=xml&excludefield=attachmentdata Processing 1 patch from 1 bug. Updating working directory Processing patch 379256 from bug 202034. Fetching: https://bugs.webkit.org/attachment.cgi?id=379256 Failed to run "['git', 'svn', 'dcommit', '--rmdir']" exit_code: 1 cwd: /Volumes/Data/EWS/WebKit Committing to http://svn.webkit.org/repository/webkit/trunk ... M Source/WebKit/ChangeLog ERROR from SVN: Item is out of date: File '/trunk/Source/WebKit/ChangeLog' is out of date W: 78ed1d0eefeeb178590e2b514f7a9dd117935b7a and refs/remotes/origin/master differ, using rebase: :040000 040000 2c2c2cbcff4e8c8680f7a340f845ff88910e520f c981944f73a779f13da2347399f3e6ff5843f5b3 M Source Current branch master is up to date. ERROR: Not all changes have been committed into SVN, however the committed ones (if any) seem to be successfully integrated into the working tree. Please see the above messages for details. Failed to run "['git', 'svn', 'dcommit', '--rmdir']" exit_code: 1 cwd: /Volumes/Data/EWS/WebKit Committing to http://svn.webkit.org/repository/webkit/trunk ... M Source/WebKit/ChangeLog ERROR from SVN: Item is out of date: File '/trunk/Source/WebKit/ChangeLog' is out of date W: 78ed1d0eefeeb178590e2b514f7a9dd117935b7a and refs/remotes/origin/master differ, using rebase: :040000 040000 2c2c2cbcff4e8c8680f7a340f845ff88910e520f c981944f73a779f13da2347399f3e6ff5843f5b3 M Source Current branch master is up to date. ERROR: Not all changes have been committed into SVN, however the committed ones (if any) seem to be successfully integrated into the working tree. Please see the above messages for details. Failed to run "['git', 'svn', 'dcommit', '--rmdir']" exit_code: 1 cwd: /Volumes/Data/EWS/WebKit Updating OpenSource From https://git.webkit.org/git/WebKit c4dbc56aa50..0f4343f851f master -> origin/master Partial-rebuilding .git/svn/refs/remotes/origin/master/.rev_map.268f45cc-cd09-0410-ab3c-d52691b4dbfc ... Currently at 250152 = c4dbc56aa502491b5b16d392212ab51999377119 r250153 = 7ca844508b2445d6e534cc031b3a6aa2a460766c r250154 = 0f4343f851fe27cbdd5a7afafe9a0cfe935fadb3 Done rebuilding .git/svn/refs/remotes/origin/master/.rev_map.268f45cc-cd09-0410-ab3c-d52691b4dbfc First, rewinding head to replay your work on top of it... Fast-forwarded master to refs/remotes/origin/master. Full output: https://webkit-queues.webkit.org/results/13054668
Tim Horton
Comment 14 2019-09-20 14:45:08 PDT
What
Chris Dumez
Comment 15 2019-09-20 14:45:49 PDT
(In reply to Tim Horton from comment #14) > What Try again :)
Tim Horton
Comment 16 2019-09-20 14:48:54 PDT
Just gonna commit it manually
Tim Horton
Comment 17 2019-09-20 14:49:47 PDT
Note You need to log in before you can comment on or make changes to this bug.