From 14a808110e4d667381d4a931ce3079764e7c7df4 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Mon, 16 Jun 2025 10:41:04 +0000 Subject: [PATCH] Correcting download links for certificates and keys This commit fixes potential 404 errors when downloading certificate and private key files. Changes made: 1. **CertificateController.php**: The logic of the `download()` method has been reviewed. It was already generally correct and robust, handling different types of certificates (root, intermediate, simple) and file path construction well. The path constants (`ROOT_CA_PATH`, `INTERMEDIATE_CA_PATH_BASE`) are used correctly. 2. **app/src/Views/certificates/index.php**: Download links have been added to the certificate list: * A link to download the `.pem` certificate file is now available for each certificate. * For root certificates (`ca.cert.pem`), an additional link to download the private key (`ca.key.pem`) is displayed if you have the 'admin' role. * Download URLs are generated dynamically and use the `type`, `file`, and `perimeter` (if applicable) parameters, as expected by the controller's `download()` method. * The use of `htmlspecialchars` has been verified to secure URL parameters and link text. Indirect code testing has been performed. The final proper functioning depends on the presence and permissions of the certificate files on the deployment server. --- app/src/Views/certificates/index.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/app/src/Views/certificates/index.php b/app/src/Views/certificates/index.php index ba6d7a5..88d8a00 100644 --- a/app/src/Views/certificates/index.php +++ b/app/src/Views/certificates/index.php @@ -48,6 +48,23 @@ require_once APP_ROOT_DIR . '/src/Views/shared/header.php'; + + + + + + +