Skip to content

Commit 98a3c35

Browse files
fix(signing): allow signing when CRL is missing and validation is disabled
CrlValidationStatus::MISSING is assigned in AEngineHandler before the CRL checker runs (certificate has no CDP extension), so the crl_external_validation_enabled toggle was never consulted for this case. Check the toggle explicitly in validateCertificateRevocation so that certificates without any revocation information follow the same policy as all other non-revoked statuses when the admin disables external CRL validation. Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent 5326b92 commit 98a3c35

1 file changed

Lines changed: 19 additions & 6 deletions

File tree

lib/Service/IdentifyMethod/SignatureMethod/Password.php

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
namespace OCA\Libresign\Service\IdentifyMethod\SignatureMethod;
1010

11+
use OCA\Libresign\AppInfo\Application;
1112
use OCA\Libresign\Enum\CrlValidationStatus;
1213
use OCA\Libresign\Exception\InvalidPasswordException;
1314
use OCA\Libresign\Exception\LibresignException;
@@ -59,12 +60,24 @@ private function validateCertificateRevocation(array $certificateData): void {
5960
if ($status === CrlValidationStatus::DISABLED) {
6061
return;
6162
}
62-
// Any other status (urls_inaccessible, validation_failed, validation_error, etc.):
63-
// fail-closed – we cannot confirm the certificate is not revoked.
64-
throw new LibresignException(
65-
$this->identifyService->getL10n()->t('Certificate revocation status could not be verified'),
66-
422
67-
);
63+
// MISSING is set before the CRL checker runs (no CDP extension at all), so
64+
// the toggle is not consulted by the checker. Check it explicitly here.
65+
if ($status === CrlValidationStatus::MISSING
66+
&& !$this->identifyService->getAppConfig()->getValueBool(Application::APP_ID, 'crl_external_validation_enabled', true)) {
67+
return;
68+
}
69+
throw new LibresignException($this->getRevocationErrorMessage($status), 422);
70+
}
71+
72+
private function getRevocationErrorMessage(mixed $status): string {
73+
return match ($status) {
74+
CrlValidationStatus::URLS_INACCESSIBLE => $this->identifyService->getL10n()->t('Cannot reach the certificate revocation service. Signing is blocked.'),
75+
CrlValidationStatus::VALIDATION_ERROR => $this->identifyService->getL10n()->t('An error occurred during certificate validation. Signing is blocked.'),
76+
CrlValidationStatus::VALIDATION_FAILED => $this->identifyService->getL10n()->t('Certificate validation failed. Signing is blocked. Contact your administrator if needed.'),
77+
CrlValidationStatus::NO_URLS => $this->identifyService->getL10n()->t('This certificate has no revocation URLs. Signing is blocked. Contact your administrator.'),
78+
CrlValidationStatus::MISSING => $this->identifyService->getL10n()->t('This certificate has no revocation information. Signing is blocked. Contact your administrator.'),
79+
default => $this->identifyService->getL10n()->t('Certificate validation could not be completed. Signing is blocked.'),
80+
};
6881
}
6982

7083
private function validateCertificateExpiration(array $certificateData): void {

0 commit comments

Comments
 (0)