Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate Android SafetyNet support #585

Merged
merged 2 commits into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -860,6 +860,14 @@ parameters:
count: 4
path: src/symfony/src/DependencyInjection/Configuration.php

-
message: """
#^Call to deprecated method addAndroidSafetynetConfig\\(\\) of class Webauthn\\\\Bundle\\\\DependencyInjection\\\\Configuration\\:
since 4\\.9\\.0 and will be removed in 5\\.0\\.0\\. Android SafetyNet is now deprecated\\.$#
"""
count: 1
path: src/symfony/src/DependencyInjection/Configuration.php

-
message: "#^Call to an undefined method Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeParentInterface\\:\\:scalarNode\\(\\)\\.$#"
count: 1
Expand Down Expand Up @@ -1030,6 +1038,14 @@ parameters:
count: 1
path: src/symfony/src/DependencyInjection/Factory/Security/WebauthnFactory.php

-
message: """
#^Call to deprecated method loadAndroidSafetyNet\\(\\) of class Webauthn\\\\Bundle\\\\DependencyInjection\\\\WebauthnExtension\\:
since 4\\.9\\.0 and will be removed in 5\\.0\\.0\\. Android SafetyNet is now deprecated\\.$#
"""
count: 1
path: src/symfony/src/DependencyInjection/WebauthnExtension.php

-
message: "#^Cannot access offset 'failure_handler' on mixed\\.$#"
count: 4
Expand Down Expand Up @@ -1241,6 +1257,14 @@ parameters:
count: 1
path: src/symfony/src/Repository/PublicKeyCredentialSourceRepository.php

-
message: """
#^Fetching class constant class of deprecated class Webauthn\\\\AttestationStatement\\\\AndroidSafetyNetAttestationStatementSupport\\:
since 4\\.9\\.0 and will be removed in 5\\.0\\.0\\. Android SafetyNet is now deprecated\\.$#
"""
count: 1
path: src/symfony/src/Resources/config/android_safetynet.php

-
message: """
#^Fetching class constant class of deprecated class Webauthn\\\\PublicKeyCredentialLoader\\:
Expand Down Expand Up @@ -1768,6 +1792,14 @@ parameters:
count: 1
path: src/symfony/src/Service/PublicKeyCredentialRequestOptionsFactory.php

-
message: """
#^Instantiation of deprecated class Webauthn\\\\Bundle\\\\DependencyInjection\\\\Compiler\\\\EnforcedSafetyNetApiKeyVerificationCompilerPass\\:
since 4\\.9\\.0 and will be removed in 5\\.0\\.0\\. Android SafetyNet is now deprecated\\.$#
"""
count: 1
path: src/symfony/src/WebauthnBundle.php

-
message: "#^Method Webauthn\\\\Bundle\\\\WebauthnBundle\\:\\:getContainerExtension\\(\\) never returns null so it can be removed from the return type\\.$#"
count: 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
use Symfony\Component\DependencyInjection\Reference;
use Webauthn\AttestationStatement\AndroidSafetyNetAttestationStatementSupport;

/**
* @deprecated since 4.9.0 and will be removed in 5.0.0. Android SafetyNet is now deprecated.
*/
final class EnforcedSafetyNetApiKeyVerificationCompilerPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container): void
Expand Down
4 changes: 4 additions & 0 deletions src/symfony/src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -456,10 +456,14 @@ private function addMetadataConfig(ArrayNodeDefinition $rootNode): void
->end();
}

/**
* @deprecated since 4.9.0 and will be removed in 5.0.0. Android SafetyNet is now deprecated.
*/
private function addAndroidSafetynetConfig(ArrayNodeDefinition $rootNode): void
{
$rootNode->children()
->arrayNode('android_safetynet')
->setDeprecated('web-auth/webauthn-symfony-bundle', '4.9.0', 'Android SafetyNet is now deprecated.')
->addDefaultsIfNotSet()
->info('Additional configuration options for the Android SafetyNet attestation.')
->children()
Expand Down
1 change: 1 addition & 0 deletions src/symfony/src/DependencyInjection/WebauthnExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ private function loadRequestControllersSupport(ContainerBuilder $container, arra
}

/**
* @deprecated since 4.9.0 and will be removed in 5.0.0. Android SafetyNet is now deprecated.
* @param mixed[] $config
*/
private function loadAndroidSafetyNet(ContainerBuilder $container, FileLoader $loader, array $config): void
Expand Down
6 changes: 6 additions & 0 deletions src/symfony/src/Resources/config/android_safetynet.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use function Symfony\Component\DependencyInjection\Loader\Configurator\param;
use function Symfony\Component\DependencyInjection\Loader\Configurator\service;

//TODO >=5.0.0: Remove this file
return static function (ContainerConfigurator $container): void {
$container = $container->services()
->defaults()
Expand All @@ -19,6 +20,11 @@
if (class_exists(JWKFactory::class) && class_exists(RS256::class)) {
$container
->set(AndroidSafetyNetAttestationStatementSupport::class)
->deprecate(
'web-auth/webauthn-symfony-bundle',
'4.9.0',
'The "%service_id%" service is deprecated and will be removed in version 5.0.0. Android SafetyNet is now deprecated.'
)
->args([service(ClockInterface::class)->nullOnInvalid()])
->call('setMaxAge', [param('webauthn.android_safetynet.max_age')])
->call('setLeeway', [param('webauthn.android_safetynet.leeway')]);
Expand Down
1 change: 0 additions & 1 deletion src/webauthn/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
"symfony/property-info": "As of 4.5.x, the symfony/serializer component will become mandatory for converting objects such as the Metadata Statement",
"phpdocumentor/reflection-docblock": "As of 4.5.x, the phpdocumentor/reflection-docblock component will become mandatory for converting objects such as the Metadata Statement",
"psr/log-implementation": "Recommended to receive logs from the library",
"web-token/jwt-library": "Mandatory for the AndroidSafetyNet Attestation Statement support",
"symfony/event-dispatcher": "Recommended to use dispatched events"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
use function is_string;
use const JSON_THROW_ON_ERROR;

/**
* @deprecated since 4.9.0 and will be removed in 5.0.0. Android SafetyNet is now deprecated.
*/
final class AndroidSafetyNetAttestationStatementSupport implements AttestationStatementSupport, CanDispatchEvents
{
private ?string $apiKey = null;
Expand Down