Skip to content

Commit 3c575f5

Browse files
chore(logging): log CRL status when signing is blocked
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent 11a8615 commit 3c575f5

1 file changed

Lines changed: 15 additions & 6 deletions

File tree

lib/Service/IdentifyMethod/SignatureMethod/Password.php

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,26 @@ private function validateCertificateRevocation(array $certificateData): void {
5959
if ($status === CrlValidationStatus::DISABLED) {
6060
return;
6161
}
62+
$this->logRevocationBlockedSigning($status);
6263
throw new LibresignException($this->getRevocationErrorMessage($status), 422);
6364
}
6465

66+
private function logRevocationBlockedSigning(mixed $status): void {
67+
$statusValue = $status instanceof CrlValidationStatus ? $status->value : (is_scalar($status) ? (string)$status : get_debug_type($status));
68+
$this->identifyService->getLogger()->warning('Signing blocked due to CRL validation status', [
69+
'status' => $statusValue,
70+
'signer_uid' => $this->userSession->getUser()?->getUID(),
71+
]);
72+
}
73+
6574
private function getRevocationErrorMessage(mixed $status): string {
6675
return match ($status) {
67-
CrlValidationStatus::URLS_INACCESSIBLE => $this->identifyService->getL10n()->t('Cannot reach the certificate revocation service. Signing is blocked.'),
68-
CrlValidationStatus::VALIDATION_ERROR => $this->identifyService->getL10n()->t('An error occurred during certificate validation. Signing is blocked.'),
69-
CrlValidationStatus::VALIDATION_FAILED => $this->identifyService->getL10n()->t('Certificate validation failed. Signing is blocked. Contact your administrator if needed.'),
70-
CrlValidationStatus::NO_URLS => $this->identifyService->getL10n()->t('This certificate has no revocation URLs. Signing is blocked. Contact your administrator.'),
71-
CrlValidationStatus::MISSING => $this->identifyService->getL10n()->t('This certificate has no revocation information. Signing is blocked. Contact your administrator.'),
72-
default => $this->identifyService->getL10n()->t('Certificate validation could not be completed. Signing is blocked.'),
76+
CrlValidationStatus::URLS_INACCESSIBLE => $this->identifyService->getL10n()->t('Cannot reach the certificate revocation service. Signing is not allowed.'),
77+
CrlValidationStatus::VALIDATION_ERROR => $this->identifyService->getL10n()->t('An error occurred during certificate validation. Signing is not allowed.'),
78+
CrlValidationStatus::VALIDATION_FAILED => $this->identifyService->getL10n()->t('Certificate validation failed. Signing is not allowed. Contact your administrator.'),
79+
CrlValidationStatus::NO_URLS => $this->identifyService->getL10n()->t('This certificate has no revocation URLs. Signing is not allowed. Contact your administrator.'),
80+
CrlValidationStatus::MISSING => $this->identifyService->getL10n()->t('This certificate has no revocation information. Signing is not allowed. Contact your administrator.'),
81+
default => $this->identifyService->getL10n()->t('Certificate validation could not be completed. Signing is not allowed.'),
7382
};
7483
}
7584

0 commit comments

Comments
 (0)