From b98d07c277148ac8076275494bac1d6fbbd6015d Mon Sep 17 00:00:00 2001 From: Bubka <858858+Bubka@users.noreply.github.com> Date: Sat, 22 Oct 2022 19:21:50 +0200 Subject: [PATCH] Fixes relaying_party typo --- README.md | 8 ++++---- config/webauthn.php | 4 ++-- .../Validator/Pipes/CheckRelyingPartyHashSame.php | 2 +- .../Validator/Pipes/MakeWebAuthnCredential.php | 2 +- src/SharedPipes/CheckRelyingPartyHashSame.php | 6 +++--- src/SharedPipes/CheckRelyingPartyIdContained.php | 6 +++--- tests/Assertion/ValidationTest.php | 4 ++-- tests/Attestation/CreatorTest.php | 2 +- tests/Attestation/ValidationTest.php | 6 +++--- 9 files changed, 20 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 84000fc..81e42a4 100644 --- a/README.md +++ b/README.md @@ -547,7 +547,7 @@ After that, you will receive the `config/webauthn.php` config file with an array [ + 'relying_party' => [ 'name' => env('WEBAUTHN_NAME', env('APP_NAME')), 'id' => env('WEBAUTHN_ID'), ], @@ -559,18 +559,18 @@ return [ ]; ``` -### Relaying Party Information +### Relying Party Information ```php return [ - 'relaying_party' => [ + 'relying_party' => [ 'name' => env('WEBAUTHN_NAME', env('APP_NAME')), 'id' => env('WEBAUTHN_ID'), ], ]; ``` -The _Relaying Party_ is just a way to uniquely identify your application in the user device: +The _Relying Party_ is just a way to uniquely identify your application in the user device: * `name`: The name of the application. Defaults to the application name. * `id`: An unique ID the application, like the site domain. If `null`, the device may fill it internally, usually as the full domain. diff --git a/config/webauthn.php b/config/webauthn.php index 6031393..e279bd3 100644 --- a/config/webauthn.php +++ b/config/webauthn.php @@ -4,11 +4,11 @@ return [ /* |-------------------------------------------------------------------------- - | Relaying Party + | Relying Party |-------------------------------------------------------------------------- | | We will use your application information to inform the device who is the - | relaying party. While only the name is enough, you can further set the + | relying party. While only the name is enough, you can further set the | a custom domain as ID and even an icon image data encoded as BASE64. | */ diff --git a/src/Attestation/Validator/Pipes/CheckRelyingPartyHashSame.php b/src/Attestation/Validator/Pipes/CheckRelyingPartyHashSame.php index 1582791..757bfe8 100644 --- a/src/Attestation/Validator/Pipes/CheckRelyingPartyHashSame.php +++ b/src/Attestation/Validator/Pipes/CheckRelyingPartyHashSame.php @@ -35,6 +35,6 @@ class CheckRelyingPartyHashSame extends BaseCheckRelyingPartyHashSame */ protected function relyingPartyId(AssertionValidation|AttestationValidation $validation): string { - return $this->config->get('webauthn.relaying_party.id') ?? $this->config->get('app.url'); + return $this->config->get('webauthn.relying_party.id') ?? $this->config->get('app.url'); } } diff --git a/src/Attestation/Validator/Pipes/MakeWebAuthnCredential.php b/src/Attestation/Validator/Pipes/MakeWebAuthnCredential.php index 0be0b97..34a123a 100644 --- a/src/Attestation/Validator/Pipes/MakeWebAuthnCredential.php +++ b/src/Attestation/Validator/Pipes/MakeWebAuthnCredential.php @@ -41,7 +41,7 @@ class MakeWebAuthnCredential 'alias' => $validation->request->json('response.alias'), 'counter' => $validation->attestationObject->authenticatorData->counter, - 'rp_id' => $this->config->get('webauthn.relaying_party.id') ?? $this->config->get('app.url'), + 'rp_id' => $this->config->get('webauthn.relying_party.id') ?? $this->config->get('app.url'), 'origin' => $validation->clientDataJson->origin, 'transports' => $validation->request->json('response.transports'), 'aaguid' => Uuid::fromBytes($validation->attestationObject->authenticatorData->attestedCredentialData->aaguid), diff --git a/src/SharedPipes/CheckRelyingPartyHashSame.php b/src/SharedPipes/CheckRelyingPartyHashSame.php index 15c38ba..8460621 100644 --- a/src/SharedPipes/CheckRelyingPartyHashSame.php +++ b/src/SharedPipes/CheckRelyingPartyHashSame.php @@ -39,11 +39,11 @@ abstract class CheckRelyingPartyHashSame public function handle(AttestationValidation|AssertionValidation $validation, Closure $next): mixed { // This way we can get the app RP ID on attestation, and the Credential RP ID - // on assertion. The credential will have the same Relaying Party ID on both + // on assertion. The credential will have the same Relying Party ID on both // the authenticator and the application so on assertion both should match. - $relayingParty = parse_url($this->relyingPartyId($validation), PHP_URL_HOST); + $relyingParty = parse_url($this->relyingPartyId($validation), PHP_URL_HOST); - if ($this->authenticatorData($validation)->hasNotSameRPIdHash($relayingParty)) { + if ($this->authenticatorData($validation)->hasNotSameRPIdHash($relyingParty)) { static::throw($validation, 'Response has different Relying Party ID hash.'); } diff --git a/src/SharedPipes/CheckRelyingPartyIdContained.php b/src/SharedPipes/CheckRelyingPartyIdContained.php index 54d1c6b..ba3910c 100644 --- a/src/SharedPipes/CheckRelyingPartyIdContained.php +++ b/src/SharedPipes/CheckRelyingPartyIdContained.php @@ -40,11 +40,11 @@ abstract class CheckRelyingPartyIdContained public function handle(AttestationValidation|AssertionValidation $validation, Closure $next): mixed { if (!$host = parse_url($validation->clientDataJson->origin, PHP_URL_HOST)) { - static::throw($validation, 'Relaying Party ID is invalid.'); + static::throw($validation, 'Relying Party ID is invalid.'); } $current = parse_url( - $this->config->get('webauthn.relaying_party.id') ?? $this->config->get('app.url'), PHP_URL_HOST + $this->config->get('webauthn.relying_party.id') ?? $this->config->get('app.url'), PHP_URL_HOST ); // Check the host is the same or is a subdomain of the current config domain. @@ -52,6 +52,6 @@ abstract class CheckRelyingPartyIdContained return $next($validation); } - static::throw($validation, 'Relaying Party ID not scoped to current.'); + static::throw($validation, 'Relying Party ID not scoped to current.'); } } diff --git a/tests/Assertion/ValidationTest.php b/tests/Assertion/ValidationTest.php index 9c62fc0..bf8516e 100644 --- a/tests/Assertion/ValidationTest.php +++ b/tests/Assertion/ValidationTest.php @@ -457,7 +457,7 @@ class ValidationTest extends TestCase $this->request->setJson(new ParameterBag($invalid)); $this->expectException(AssertionException::class); - $this->expectExceptionMessage('Assertion Error: Relaying Party ID not scoped to current.'); + $this->expectExceptionMessage('Assertion Error: Relying Party ID not scoped to current.'); $this->validate(); } @@ -477,7 +477,7 @@ class ValidationTest extends TestCase $this->request->setJson(new ParameterBag($invalid)); $this->expectException(AssertionException::class); - $this->expectExceptionMessage('Assertion Error: Relaying Party ID not scoped to current.'); + $this->expectExceptionMessage('Assertion Error: Relying Party ID not scoped to current.'); $this->validate(); } diff --git a/tests/Attestation/CreatorTest.php b/tests/Attestation/CreatorTest.php index f44d3d5..755769d 100644 --- a/tests/Attestation/CreatorTest.php +++ b/tests/Attestation/CreatorTest.php @@ -80,7 +80,7 @@ class CreatorTest extends TestCase ]); } - public function test_uses_relaying_party_config(): void + public function test_uses_relying_party_config(): void { config(['webauthn.relying_party' => [ 'id' => 'https://foo.bar', diff --git a/tests/Attestation/ValidationTest.php b/tests/Attestation/ValidationTest.php index 18eed64..86bd237 100644 --- a/tests/Attestation/ValidationTest.php +++ b/tests/Attestation/ValidationTest.php @@ -504,7 +504,7 @@ class ValidationTest extends TestCase public function test_rp_id_fails_if_not_equal(): void { $this->expectException(AttestationException::class); - $this->expectExceptionMessage('Attestation Error: Relaying Party ID not scoped to current.'); + $this->expectExceptionMessage('Attestation Error: Relying Party ID not scoped to current.'); $invalid = FakeAuthenticator::attestationResponse(); @@ -524,7 +524,7 @@ class ValidationTest extends TestCase public function test_rp_id_fails_if_not_contained(): void { $this->expectException(AttestationException::class); - $this->expectExceptionMessage('Attestation Error: Relaying Party ID not scoped to current.'); + $this->expectExceptionMessage('Attestation Error: Relying Party ID not scoped to current.'); $invalid = FakeAuthenticator::attestationResponse(); @@ -546,7 +546,7 @@ class ValidationTest extends TestCase $this->app->when(CheckRelyingPartyHashSame::class) ->needs(ConfigContract::class) ->give(static function (): Repository { - return tap(new Repository())->set('webauthn.relaying_party.id', 'https://otherhost.com'); + return tap(new Repository())->set('webauthn.relying_party.id', 'https://otherhost.com'); }); $this->expectException(AttestationException::class);