Merge pull request #219 from copenhagentruckwash/propose-fix-for-unauthenticated-pdf-access

Fix unauthenticated PDF disclosure in file_server fallback
This commit is contained in:
Jeppe B
2026-06-01 23:12:00 +02:00
committed by GitHub
-14
View File
@@ -55,20 +55,6 @@ if ($isPDF && $isPDFStore) {
// Check if the certificate exists
if (!$wash_certificate_store->isFileInStore($file)) {
// Try the PDF store
$pdf_store = new \classes\pdf_store();
if ($pdf_store->isFileInStore(str_replace('/files/', '', $file))) {
// Download the certificate from the PDF store to /tmp
$certificate_path = $pdf_store->download(str_replace('/files/', '', $file));
// Send the certificate to the client
header('Content-Type: application/pdf');
header('Content-Disposition: inline; filename="' . str_replace('/files/', '', $file) . '"');
header('Content-Length: ' . filesize($certificate_path));
readfile($certificate_path);
// Delete the certificate from /tmp after sending it
unlink($certificate_path);
exit;
}
echo 'Certificate not found in store' . $file;
//header('HTTP/1.1 404 Not Found');
exit;