aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorFerdinand Thiessen <opensource@fthiessen.de>2024-08-14 18:07:51 +0200
committerFerdinand Thiessen <opensource@fthiessen.de>2024-08-14 22:12:54 +0200
commitb582630715a0a671f35f507b3cd36569c3b504b6 (patch)
tree2a71785095630078d24cc46b435cccdb3d08a3e3 /core
parentfb90e7e2cff2c0f98989ac9dd6b236e42d334c41 (diff)
downloadnextcloud-server-b582630715a0a671f35f507b3cd36569c3b504b6.tar.gz
nextcloud-server-b582630715a0a671f35f507b3cd36569c3b504b6.zip
fix(webauthn): Increase database column for public key id
* Resolves https://github.com/nextcloud/server/issues/34476 There is no maximum length defined in the standard, most common the length is between 128 and 200 characters, but as we store it not in plain data but base64 encoded the length can grow about 1/3. We had a regression with 'Nitrokey 3' which created IDs with 196 byte length -> 262 bytes encoded base64. So to be save we increase the size to 512 bytes. Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'core')
-rw-r--r--core/Migrations/Version19000Date20200211083441.php2
-rw-r--r--core/Migrations/Version30000Date20240814180800.php37
2 files changed, 38 insertions, 1 deletions
diff --git a/core/Migrations/Version19000Date20200211083441.php b/core/Migrations/Version19000Date20200211083441.php
index 4b361149b30..2f8b46ad772 100644
--- a/core/Migrations/Version19000Date20200211083441.php
+++ b/core/Migrations/Version19000Date20200211083441.php
@@ -35,7 +35,7 @@ class Version19000Date20200211083441 extends SimpleMigrationStep {
]);
$table->addColumn('public_key_credential_id', 'string', [
'notnull' => true,
- 'length' => 255
+ 'length' => 512
]);
$table->addColumn('data', 'text', [
'notnull' => true,
diff --git a/core/Migrations/Version30000Date20240814180800.php b/core/Migrations/Version30000Date20240814180800.php
new file mode 100644
index 00000000000..199af8cc0aa
--- /dev/null
+++ b/core/Migrations/Version30000Date20240814180800.php
@@ -0,0 +1,37 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OC\Core\Migrations;
+
+use Closure;
+use OCP\DB\ISchemaWrapper;
+use OCP\Migration\IOutput;
+use OCP\Migration\SimpleMigrationStep;
+
+class Version30000Date20240814180800 extends SimpleMigrationStep {
+ public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
+ /** @var ISchemaWrapper $schema */
+ $schema = $schemaClosure();
+
+ $table = $schema->getTable('webauthn');
+ $column = $table->getColumn('public_key_credential_id');
+
+ /**
+ * There is no maximum length defined in the standard,
+ * most common the length is between 128 and 200 characters,
+ * but as we store it not in plain data but base64 encoded the length can grow about 1/3.
+ * We had a regression with 'Nitrokey 3' which created IDs with 196 byte length -> 262 bytes encoded base64.
+ * So to be save we increase the size to 512 bytes.
+ */
+ if ($column->getLength() < 512) {
+ $column->setLength(512);
+ }
+
+ return $schema;
+ }
+}