Version30000Date20240814180800.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OC\Core\Migrations;
  8. use Closure;
  9. use OCP\DB\ISchemaWrapper;
  10. use OCP\Migration\IOutput;
  11. use OCP\Migration\SimpleMigrationStep;
  12. class Version30000Date20240814180800 extends SimpleMigrationStep {
  13. public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
  14. /** @var ISchemaWrapper $schema */
  15. $schema = $schemaClosure();
  16. $table = $schema->getTable('webauthn');
  17. $column = $table->getColumn('public_key_credential_id');
  18. /**
  19. * There is no maximum length defined in the standard,
  20. * most common the length is between 128 and 200 characters,
  21. * but as we store it not in plain data but base64 encoded the length can grow about 1/3.
  22. * We had a regression with 'Nitrokey 3' which created IDs with 196 byte length -> 262 bytes encoded base64.
  23. * So to be save we increase the size to 512 bytes.
  24. */
  25. if ($column->getLength() < 512) {
  26. $column->setLength(512);
  27. }
  28. return $schema;
  29. }
  30. }