From f71a97a8f39f19aa38e24efbcb2dd61e1750c5fc Mon Sep 17 00:00:00 2001 From: Sebastiaan Stok Date: Fri, 22 Dec 2023 20:28:52 +0100 Subject: [PATCH] Fix wrong spelling in className While considered a BC break this class should not be catch-ed directly --- Resources/translations/validators+intl-icu.en.xliff | 5 +++++ src/CAResolverImpl.php | 4 ++-- .../{ToManyCAsProvided.php => TooManyCAsProvided.php} | 6 +++--- tests/CAResolverImplTest.php | 4 ++-- 4 files changed, 12 insertions(+), 7 deletions(-) rename src/Violation/{ToManyCAsProvided.php => TooManyCAsProvided.php} (69%) diff --git a/Resources/translations/validators+intl-icu.en.xliff b/Resources/translations/validators+intl-icu.en.xliff index ef8b4d5..33ce259 100644 --- a/Resources/translations/validators+intl-icu.en.xliff +++ b/Resources/translations/validators+intl-icu.en.xliff @@ -88,6 +88,11 @@ it is known or suspected that aspects of the AA validated in the attribute certificate have been compromised. it is known or suspected that aspects of the AA validated in the attribute certificate have been compromised. + + + Too many CAs were provided. A maximum of 4 is accepted. + Too many CAs were provided. A maximum of 4 is accepted. + diff --git a/src/CAResolverImpl.php b/src/CAResolverImpl.php index 4e36bae..e654f1c 100644 --- a/src/CAResolverImpl.php +++ b/src/CAResolverImpl.php @@ -14,7 +14,7 @@ namespace Rollerworks\Component\X509Validator; use Rollerworks\Component\X509Validator\Violation\MissingCAExtension; -use Rollerworks\Component\X509Validator\Violation\ToManyCAsProvided; +use Rollerworks\Component\X509Validator\Violation\TooManyCAsProvided; use Rollerworks\Component\X509Validator\Violation\UnableToResolveParent; class CAResolverImpl implements CAResolver @@ -36,7 +36,7 @@ public function resolve(string $certificate, array $caList): ?CA // Safety check to prevent DoS attacks // Normally only two parents are used, more than three is exceptional if (\count($caList) > 4) { - throw new ToManyCAsProvided(); + throw new TooManyCAsProvided(); } $certData = $this->extractor->extractRawData($certificate, '', true); diff --git a/src/Violation/ToManyCAsProvided.php b/src/Violation/TooManyCAsProvided.php similarity index 69% rename from src/Violation/ToManyCAsProvided.php rename to src/Violation/TooManyCAsProvided.php index b3f4eb9..facf366 100644 --- a/src/Violation/ToManyCAsProvided.php +++ b/src/Violation/TooManyCAsProvided.php @@ -15,15 +15,15 @@ use Rollerworks\Component\X509Validator\Violation; -final class ToManyCAsProvided extends Violation +final class TooManyCAsProvided extends Violation { public function __construct() { - parent::__construct('To many CAs were provided. A maximum of 3 is accepted.'); + parent::__construct('Too many CAs were provided. A maximum of 4 is accepted.'); } public function getTranslatorMsg(): string { - return 'tls.violation.to_many_ca_provided'; + return 'Too many CAs were provided. A maximum of 4 is accepted.'; } } diff --git a/tests/CAResolverImplTest.php b/tests/CAResolverImplTest.php index fc126ea..269004a 100644 --- a/tests/CAResolverImplTest.php +++ b/tests/CAResolverImplTest.php @@ -19,7 +19,7 @@ use Rollerworks\Component\X509Validator\CA; use Rollerworks\Component\X509Validator\CAResolverImpl as CAResolver; use Rollerworks\Component\X509Validator\Violation\MissingCAExtension; -use Rollerworks\Component\X509Validator\Violation\ToManyCAsProvided; +use Rollerworks\Component\X509Validator\Violation\TooManyCAsProvided; use Rollerworks\Component\X509Validator\Violation\UnableToResolveParent; use Rollerworks\Component\X509Validator\Violation\UnprocessablePEM; @@ -98,7 +98,7 @@ public function it_fails_with_to_many_cas_provided(): void { $resolver = new CAResolver(); - $this->expectException(ToManyCAsProvided::class); + $this->expectException(TooManyCAsProvided::class); $resolver->resolve( <<<'CERT'