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 }}
This repository was archived by the owner on Jan 2, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Jan 2, 2023. It is now read-only.
The same origin policy allows local files to be read by default #4536
Hmm, does that work with --disable-local-file-access? I think the opposite is the default for backward compatibility reasons, but not sure if it should be made the default now.
Great.-n --disable-local-file-access effectively prevents local file reading.
That is to say, the local file read will succeed only if this option is not used(default).
I understand it.You have the final say~
I'm thinking that it's better to switch the default, as you weren't aware of it and you were reporting what you thought was a vulnerability! Discoverability seems to be low, and if it breaks for someone they can easily fix it. I'd appreciate a PR changing the default 👍
wkhtmltopdf is practical and used widely.
I found that someone had built a web service, and called wkhtmltopdf on the back end without considering security. As a result, it is not difficult for hackers to get information of the server remotely. so I reported the risk of this default configuration.
As you said, the PR will make it better~
A release candidate for the 0.12.6 release is now available for download, which should contain changes which possibly address this issue.
Would appreciate downloading the package and reporting back if any issues are encountered during testing. Assuming all goes well, I plan to release 0.12.6 on the 2-year anniversary of the previous release i.e. June 11, 2020.
@iturbe: Looks like you're using imgkit ... please create a ticket there to document this, but you probably need to add { 'enable-local-file-access': None } as the last parameter.
That depends on whether you use a wrapper for wkhtmltopdf or use the program without one. In my case, I am using laravel snappy, I can include the option like that: $snappy->setOption('enable-local-file-access', true);
Should you use it directly you just append the option to the command like that I guess: wkhtmltopdf --enable-local-file-access https://github.com/wkhtmltopdf/wkhtmltopdf/issues/4536 example.pdf
Activity
ashkulz commentedon Nov 21, 2019
Hmm, does that work with
--disable-local-file-access? I think the opposite is the default for backward compatibility reasons, but not sure if it should be made the default now.[-]the same-origin policy vulnerability[/-][+]The same origin policy allows local files to be read by default[/+]1135 commentedon Nov 21, 2019
Great.
-n --disable-local-file-accesseffectively prevents local file reading.That is to say, the local file read will succeed only if this option is not used(default).
I understand it.You have the final say~
ashkulz commentedon Nov 21, 2019
I'm thinking that it's better to switch the default, as you weren't aware of it and you were reporting what you thought was a vulnerability! Discoverability seems to be low, and if it breaks for someone they can easily fix it. I'd appreciate a PR changing the default 👍
1135 commentedon Nov 22, 2019
wkhtmltopdfis practical and used widely.I found that someone had built a web service, and called
wkhtmltopdfon the back end without considering security. As a result, it is not difficult for hackers to get information of the server remotely. so I reported the risk of this default configuration.As you said, the PR will make it better~
ashkulz commentedon Nov 22, 2019
Great, will wait for one from you then!
ashkulz commentedon Jun 6, 2020
A release candidate for the 0.12.6 release is now available for download, which should contain changes which possibly address this issue.
Would appreciate downloading the package and reporting back if any issues are encountered during testing. Assuming all goes well, I plan to release 0.12.6 on the 2-year anniversary of the previous release i.e. June 11, 2020.
pedrofurtado commentedon Jun 11, 2020
How to revert, using 0.12.6, to previous behavior? Is there some flag?
ashkulz commentedon Jun 12, 2020
You can always use
--enable-local-file-access.iturbe commentedon Jun 15, 2020
The latest update broke my program in which i'm using the following line within a python file:
imgkit.from_file('output/htmls/' + str(idx) + '.html', jpeg_output_path + str(number) + '_out.jpg')How/where should i add in the
--enable-local-file-accessfor it to work again?Thanks in advance!
ashkulz commentedon Jun 15, 2020
@iturbe: Looks like you're using imgkit ... please create a ticket there to document this, but you probably need to add
{ 'enable-local-file-access': None }as the last parameter.iturbe commentedon Jun 15, 2020
@ashkulz Thank you!
jsmpereira commentedon Sep 17, 2020
Another option is to use
--allow <path>to specify the folder(s) from which local files are allowed to be loaded.javier-finance commentedon Oct 15, 2020
where to put "--enable-local-file-access" ??
der-Lehmann commentedon Oct 20, 2020
That depends on whether you use a wrapper for wkhtmltopdf or use the program without one. In my case, I am using laravel snappy, I can include the option like that:
$snappy->setOption('enable-local-file-access', true);Should you use it directly you just append the option to the command like that I guess:
wkhtmltopdf --enable-local-file-access https://github.com/wkhtmltopdf/wkhtmltopdf/issues/4536 example.pdfBREAKING CHANGE: block local filesystem access by default