Fixed issue that U2F keys did not work.

The DB length for this field was too short, so the key handles were cut off and devices were not recognized.
This commit is contained in:
Jan Böhmer 2020-04-09 15:17:46 +02:00
parent dae29cadd0
commit e8f83f188a
2 changed files with 38 additions and 3 deletions

View file

@ -59,15 +59,15 @@ class U2FKey implements TwoFactorKeyInterface
use TimestampTrait;
/**
* @ORM\Column(type="string", length=64)
*
* We have to restrict the length here, as InnoDB only supports key index with max. 767 Bytes.
* Max length of keyhandles should be 128. (According to U2F_MAX_KH_SIZE in FIDO example C code).
* @ORM\Column(type="string", length=128)
* @var string
**/
public $keyHandle;
/**
* @ORM\Column(type="string")
*
* @var string
**/
public $publicKey;

View file

@ -0,0 +1,35 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20200409130946 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE u2f_keys CHANGE key_handle key_handle VARCHAR(128) NOT NULL');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE u2f_keys CHANGE key_handle key_handle VARCHAR(64) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`');
}
}