From 0d1d574ccf437d2ea95f1635c6b87f60776c1f3d Mon Sep 17 00:00:00 2001 From: Florent Morselli Date: Tue, 16 Apr 2024 16:41:34 +0200 Subject: [PATCH 1/3] Add new fields to PublicKeyCredentialSource mapping (#592) Three new fields have been added to the PublicKeyCredentialSource mapping defined in XML. These boolean fields include "backupEligible", "backupStatus", and "uvInitialized". Each can be nullable, allowing for more flexible data management. --- .../config/doctrine-mapping/PublicKeyCredentialSource.orm.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/symfony/src/Resources/config/doctrine-mapping/PublicKeyCredentialSource.orm.xml b/src/symfony/src/Resources/config/doctrine-mapping/PublicKeyCredentialSource.orm.xml index 154fd6fd..316b8533 100644 --- a/src/symfony/src/Resources/config/doctrine-mapping/PublicKeyCredentialSource.orm.xml +++ b/src/symfony/src/Resources/config/doctrine-mapping/PublicKeyCredentialSource.orm.xml @@ -15,5 +15,8 @@ + + + From e22324e557e996f0f2cdad847d3647d98b1a2ba2 Mon Sep 17 00:00:00 2001 From: Florent Morselli Date: Sat, 15 Jun 2024 09:18:26 +0200 Subject: [PATCH 2/3] Update return type in getAlternativeDescriptions method The method getAlternativeDescriptions in MetadataStatement.php has been updated to allow it to return null. This change provides more flexibility when no alternative descriptions are available for any given metadata statement. --- src/metadata-service/src/Statement/MetadataStatement.php | 2 +- tests/symfony/config/config.yml | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/metadata-service/src/Statement/MetadataStatement.php b/src/metadata-service/src/Statement/MetadataStatement.php index 69685bc6..d14f1e41 100644 --- a/src/metadata-service/src/Statement/MetadataStatement.php +++ b/src/metadata-service/src/Statement/MetadataStatement.php @@ -361,7 +361,7 @@ public function getDescription(): string * @deprecated since 4.7.0. Please use the property directly. * @infection-ignore-all */ - public function getAlternativeDescriptions(): AlternativeDescriptions + public function getAlternativeDescriptions(): null|AlternativeDescriptions { return $this->alternativeDescriptions; } diff --git a/tests/symfony/config/config.yml b/tests/symfony/config/config.yml index ed901873..e473f7d2 100644 --- a/tests/symfony/config/config.yml +++ b/tests/symfony/config/config.yml @@ -111,6 +111,8 @@ doctrine: auto_generate_proxy_classes: true naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware auto_mapping: true + controller_resolver: + auto_mapping: false mappings: App: is_bundle: false From d440667a0044abe55527502f95c1c40ae445a4cc Mon Sep 17 00:00:00 2001 From: Florent Morselli Date: Sat, 15 Jun 2024 09:30:00 +0200 Subject: [PATCH 3/3] Refactor request methods in test files The commit updates the request methods in the 'NonSecuredAreaTest.php' and 'SecuredAreaTest.php' test files. Specifically, hardcoded 'GET' and 'POST' strings have been replaced with their equivalents from the Request class for better consistency and potential type safety. --- .../functional/Firewall/NonSecuredAreaTest.php | 3 ++- tests/symfony/functional/Firewall/SecuredAreaTest.php | 11 ++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/tests/symfony/functional/Firewall/NonSecuredAreaTest.php b/tests/symfony/functional/Firewall/NonSecuredAreaTest.php index 5821c330..70e477b2 100644 --- a/tests/symfony/functional/Firewall/NonSecuredAreaTest.php +++ b/tests/symfony/functional/Firewall/NonSecuredAreaTest.php @@ -6,6 +6,7 @@ use PHPUnit\Framework\Attributes\Test; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; +use Symfony\Component\HttpFoundation\Request; /** * @internal @@ -16,7 +17,7 @@ final class NonSecuredAreaTest extends WebTestCase public function aClientWantsToAccessOnNonSecuredResource(): void { $client = static::createClient(); - $client->request('GET', '/', [], [], [ + $client->request(Request::METHOD_GET, '/', [], [], [ 'HTTPS' => 'on', ]); diff --git a/tests/symfony/functional/Firewall/SecuredAreaTest.php b/tests/symfony/functional/Firewall/SecuredAreaTest.php index a610edf3..d166714d 100644 --- a/tests/symfony/functional/Firewall/SecuredAreaTest.php +++ b/tests/symfony/functional/Firewall/SecuredAreaTest.php @@ -7,6 +7,7 @@ use ParagonIE\ConstantTime\Base64UrlSafe; use PHPUnit\Framework\Attributes\Test; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; +use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Webauthn\Bundle\Security\Storage\Item; use Webauthn\PublicKeyCredentialDescriptor; @@ -26,7 +27,7 @@ public function aClientCannotAccessToTheResourceIfUserIsNotAuthenticated(): void $client = static::createClient([], [ 'HTTPS' => 'on', ]); - $client->request('GET', '/admin', [], [], [ + $client->request(Request::METHOD_GET, '/admin', [], [], [ 'HTTPS' => 'on', ]); @@ -42,7 +43,7 @@ public function aClientCanSubmitUsernameToGetWebauthnOptions(): void $client = static::createClient([], [ 'HTTPS' => 'on', ]); - $client->request('POST', '/api/login/options', [], [], [ + $client->request(Request::METHOD_POST, '/api/login/options', [], [], [ 'CONTENT_TYPE' => 'application/json', 'HTTP_HOST' => 'test.com', 'HTTPS' => 'on', @@ -65,7 +66,7 @@ public function aUserCannotBeBeAuthenticatedInAbsenceOfOptions(): void $client = static::createClient([], [ 'HTTPS' => 'on', ]); - $client->request('POST', '/api/login', [], [], [ + $client->request(Request::METHOD_POST, '/api/login', [], [], [ 'CONTENT_TYPE' => 'application/json', 'HTTP_HOST' => 'test.com', ], $assertion); @@ -107,7 +108,7 @@ public function aUserCanBeAuthenticatedAndAccessToTheProtectedResource(): void $assertion = '{"id":"eHouz_Zi7-BmByHjJ_tx9h4a1WZsK4IzUmgGjkhyOodPGAyUqUp_B9yUkflXY3yHWsNtsrgCXQ3HjAIFUeZB-w","type":"public-key","rawId":"eHouz/Zi7+BmByHjJ/tx9h4a1WZsK4IzUmgGjkhyOodPGAyUqUp/B9yUkflXY3yHWsNtsrgCXQ3HjAIFUeZB+w==","response":{"authenticatorData":"SZYN5YgOjGh0NBcPZHZgW4_krrmihjLHmVzzuoMdl2MBAAAAew","clientDataJSON":"eyJjaGFsbGVuZ2UiOiJHMEpiTExuZGVmM2EwSXkzUzJzU1FBOHVPNFNPX3plNkZaTUF1UEk2LXhJIiwiY2xpZW50RXh0ZW5zaW9ucyI6e30sImhhc2hBbGdvcml0aG0iOiJTSEEtMjU2Iiwib3JpZ2luIjoiaHR0cHM6Ly9sb2NhbGhvc3Q6ODQ0MyIsInR5cGUiOiJ3ZWJhdXRobi5nZXQifQ","signature":"MEUCIEY/vcNkbo/LdMTfLa24ZYLlMMVMRd8zXguHBvqud9AJAiEAwCwpZpvcMaqCrwv85w/8RGiZzE+gOM61ffxmgEDeyhM=","userHandle":null}}'; - $client->request('POST', '/api/login', [], [], [ + $client->request(Request::METHOD_POST, '/api/login', [], [], [ 'CONTENT_TYPE' => 'application/json', 'HTTP_HOST' => 'localhost', ], $assertion); @@ -120,7 +121,7 @@ public function aUserCanBeAuthenticatedAndAccessToTheProtectedResource(): void ); static::assertTrue($client->getRequest()->getSession()->has('_security_main')); - $client->request('GET', '/admin'); + $client->request(Request::METHOD_GET, '/admin'); static::assertSame('["Hello admin"]', $client->getResponse()->getContent()); static::assertResponseIsSuccessful();