summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFerdinand Thiessen <opensource@fthiessen.de>2024-08-14 18:07:51 +0200
committerFerdinand Thiessen <opensource@fthiessen.de>2024-08-27 23:19:25 +0200
commitd13c4957760b54a3547965259c9c3298af220f66 (patch)
tree94f6e82ed01d0f79eafa6739f2680c898da9aa75
parentffdb8ec1117bfb5432992efa7805763ede2a0471 (diff)
downloadnextcloud-server-d13c4957760b54a3547965259c9c3298af220f66.tar.gz
nextcloud-server-d13c4957760b54a3547965259c9c3298af220f66.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>
-rw-r--r--core/Migrations/Version19000Date20200211083441.php2
-rw-r--r--core/Migrations/Version30000Date20240814180800.php37
-rw-r--r--lib/composer/composer/autoload_classmap.php1
-rw-r--r--lib/composer/composer/autoload_static.php1
4 files changed, 40 insertions, 1 deletions
diff --git a/core/Migrations/Version19000Date20200211083441.php b/core/Migrations/Version19000Date20200211083441.php
index 4e5c48a3b88..c1cfca2c1b7 100644
--- a/core/Migrations/Version19000Date20200211083441.php
+++ b/core/Migrations/Version19000Date20200211083441.php
@@ -53,7 +53,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;
+ }
+}
diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php
index e9fe618f8b6..855994de474 100644
--- a/lib/composer/composer/autoload_classmap.php
+++ b/lib/composer/composer/autoload_classmap.php
@@ -1232,6 +1232,7 @@ return array(
'OC\\Core\\Migrations\\Version28000Date20231004103301' => $baseDir . '/core/Migrations/Version28000Date20231004103301.php',
'OC\\Core\\Migrations\\Version28000Date20231103104802' => $baseDir . '/core/Migrations/Version28000Date20231103104802.php',
'OC\\Core\\Migrations\\Version28000Date20231126110901' => $baseDir . '/core/Migrations/Version28000Date20231126110901.php',
+ 'OC\\Core\\Migrations\\Version30000Date20240814180800' => $baseDir . '/core/Migrations/Version30000Date20240814180800.php',
'OC\\Core\\Notification\\CoreNotifier' => $baseDir . '/core/Notification/CoreNotifier.php',
'OC\\Core\\Service\\LoginFlowV2Service' => $baseDir . '/core/Service/LoginFlowV2Service.php',
'OC\\DB\\Adapter' => $baseDir . '/lib/private/DB/Adapter.php',
diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php
index 5f8ea5000ff..22294859422 100644
--- a/lib/composer/composer/autoload_static.php
+++ b/lib/composer/composer/autoload_static.php
@@ -1265,6 +1265,7 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
'OC\\Core\\Migrations\\Version28000Date20231004103301' => __DIR__ . '/../../..' . '/core/Migrations/Version28000Date20231004103301.php',
'OC\\Core\\Migrations\\Version28000Date20231103104802' => __DIR__ . '/../../..' . '/core/Migrations/Version28000Date20231103104802.php',
'OC\\Core\\Migrations\\Version28000Date20231126110901' => __DIR__ . '/../../..' . '/core/Migrations/Version28000Date20231126110901.php',
+ 'OC\\Core\\Migrations\\Version30000Date20240814180800' => __DIR__ . '/../../..' . '/core/Migrations/Version30000Date20240814180800.php',
'OC\\Core\\Notification\\CoreNotifier' => __DIR__ . '/../../..' . '/core/Notification/CoreNotifier.php',
'OC\\Core\\Service\\LoginFlowV2Service' => __DIR__ . '/../../..' . '/core/Service/LoginFlowV2Service.php',
'OC\\DB\\Adapter' => __DIR__ . '/../../..' . '/lib/private/DB/Adapter.php',