Merge pull request #211 from copenhagentruckwash/fix-vulnerability-in-wash-certificate-pdf-handling

Restore deletion of local wash certificate PDFs after upload
This commit is contained in:
Jeppe B
2026-06-01 23:02:12 +02:00
committed by GitHub
@@ -104,7 +104,7 @@ if ($wash_certificate_store->washCertificateExists($_GET['bookingId'])) {
$success = $wash_certificate_store->uploadFile("wash_certificate_" . $_GET['bookingId'] . ".pdf", dirname(__FILE__) . "/output/certificates/wash_certificate_" . $_GET['bookingId'] . ".pdf");
// If the certificate was uploaded successfully, delete the local copy
if ($success) {
//unlink(dirname(__FILE__) . "/output/certificates/wash_certificate_" . $_GET['bookingId'] . ".pdf");
unlink(dirname(__FILE__) . "/output/certificates/wash_certificate_" . $_GET['bookingId'] . ".pdf");
// Return the certificate url
echo $wash_certificate_store->getWashCertificateDownload($_GET['bookingId']);
exit;
@@ -131,7 +131,7 @@ $generatedCertificatePath = "output/certificates/wash_certificate_" . $_GET['boo
$wash_certificate_store->uploadFile($generatedCertificateName, dirname(__FILE__) . '/' . $generatedCertificatePath);
// Delete the local copy of the certificate
//unlink(dirname(__FILE__) . '/' . $generatedCertificatePath);
unlink(dirname(__FILE__) . '/' . $generatedCertificatePath);
// Set the status of the booking to completed
$booking = new bookings_o();