mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-07-31 15:24:31 +03:00
Added untrusted server fetching control
WKHTMLtoPDF provides limited control for external fetching so that will now be disabled by default unless ALLOW_UNTRUSTED_SERVER_FETCHING=true is specifically set. This new option will also control DOMPDF fetching.
This commit is contained in:
@ -366,4 +366,20 @@ class ExportTest extends TestCase
|
||||
$this->assertPermissionError($resp);
|
||||
}
|
||||
}
|
||||
|
||||
public function test_wkhtmltopdf_only_used_when_allow_untrusted_is_true()
|
||||
{
|
||||
/** @var Page $page */
|
||||
$page = Page::query()->first();
|
||||
|
||||
config()->set('snappy.pdf.binary', '/abc123');
|
||||
config()->set('app.allow_untrusted_server_fetching', false);
|
||||
|
||||
$resp = $this->asEditor()->get($page->getUrl('/export/pdf'));
|
||||
$resp->assertStatus(200); // Sucessful response with invalid snappy binary indicates dompdf usage.
|
||||
|
||||
config()->set('app.allow_untrusted_server_fetching', true);
|
||||
$resp = $this->get($page->getUrl('/export/pdf'));
|
||||
$resp->assertStatus(500); // Bad response indicates wkhtml usage
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user