-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Unable to re-register a security key (webauthn_credential_pkey constraint) #19012
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
Comments
Could you please specify the Gitea version from which you upgraded? Was it 1.15.11? |
@zeripath does this ring a bell? |
I mentioned it in the redmine issue but not here :-/ The current version is 1.15.11 indeed 👍 |
I'm not sure but it looks like your postgres primary key sequence is out of date. I guess this is related to the damned migration. IIRC running |
@zeripath note that only Gitea 1.15.11 was connected to this postgres database. In order to test the migration from 1.15.11 to 1.16.2 then from 1.15.11 to 1.16.3, a copy of the database was used. |
That doesn't matter. Have you run the requested command or use the doctor dbconsistency fixing command? We'll need to fix v210 again to forcibly update the sequence counter for everyone but the suggested command should do that for you. |
There is (yet) another problem with v210 in that Postgres will silently allow preset ID insertions ... but it will not update the sequence value. This PR simply adds a little step to the end of the v210 migration to update the sequence number. Users who have already migrated who find that they cannot insert new webauthn_credentials into the DB can either run: ```bash gitea doctor recreate-table webauthn_credential ``` or ```bash ./gitea doctor --run=check-db-consistency --fix ``` which will fix the bad sequence. Fix go-gitea#19012 Signed-off-by: Andrew Thornton <art27@cantab.net>
Following migration to 1.16 could you please run: gitea doctor recreate-table webauthn_credential or in postgres: SELECT setval('webauthn_credential_id_seq', COALESCE((SELECT MAX(id)+1 FROM `webauthn_credential`), 1), false) |
* Update the webauthn_credential_id_sequence in Postgres There is (yet) another problem with v210 in that Postgres will silently allow preset ID insertions ... but it will not update the sequence value. This PR simply adds a little step to the end of the v210 migration to update the sequence number. Users who have already migrated who find that they cannot insert new webauthn_credentials into the DB can either run: ```bash gitea doctor recreate-table webauthn_credential ``` or ```bash ./gitea doctor --run=check-db-consistency --fix ``` which will fix the bad sequence. Fix #19012 Signed-off-by: Andrew Thornton <art27@cantab.net>
Backport go-gitea#19048 There is (yet) another problem with v210 in that Postgres will silently allow preset ID insertions ... but it will not update the sequence value. This PR simply adds a little step to the end of the v210 migration to update the sequence number. Users who have already migrated who find that they cannot insert new webauthn_credentials into the DB can either run: ```bash gitea doctor recreate-table webauthn_credential ``` or ```bash SELECT setval('webauthn_credential_id_seq', COALESCE((SELECT MAX(id)+1 FROM `webauthn_credential`), 1), false) ``` which will fix the bad sequence. Fix go-gitea#19012 Signed-off-by: Andrew Thornton <art27@cantab.net>
Backport #19048 There is (yet) another problem with v210 in that Postgres will silently allow preset ID insertions ... but it will not update the sequence value. This PR simply adds a little step to the end of the v210 migration to update the sequence number. Users who have already migrated who find that they cannot insert new webauthn_credentials into the DB can either run: ```bash gitea doctor recreate-table webauthn_credential ``` or ```bash SELECT setval('webauthn_credential_id_seq', COALESCE((SELECT MAX(id)+1 FROM `webauthn_credential`), 1), false) ``` which will fix the bad sequence. Fix #19012 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de>
Thanks! |
* Update the webauthn_credential_id_sequence in Postgres There is (yet) another problem with v210 in that Postgres will silently allow preset ID insertions ... but it will not update the sequence value. This PR simply adds a little step to the end of the v210 migration to update the sequence number. Users who have already migrated who find that they cannot insert new webauthn_credentials into the DB can either run: ```bash gitea doctor recreate-table webauthn_credential ``` or ```bash ./gitea doctor --run=check-db-consistency --fix ``` which will fix the bad sequence. Fix go-gitea#19012 Signed-off-by: Andrew Thornton <art27@cantab.net>
Gitea Version
1.16.3
Git Version
2.30.2
Operating System
Debian GNU/Linux
How are you running Gitea?
I am using the upstream binary from GitHub on amd64.
Database
PostgreSQL
Can you reproduce the bug on the Gitea demo site?
No
Log Gist
No response
Description
I just upgraded to 1.16.3:
/srv/gitea/bin/gitea-1.16.3-linux-amd64 --config /etc/gitea/gitea.ini migrate # the migration is successful GITEA_WORK_DIR=/srv/gitea /srv/gitea/bin/gitea-1.16.3-linux-amd64 --config /etc/gitea/gitea.ini web
When I authenticated using my security key, this message appeared:
then I removed my security key from my gitea account and I tried to re-register it. I was unable to re-register it:
The gitea log contains:
Once the following SQL commands has been executed, I was able to re-register my security key:
This issue seems related to #18881.
Screenshots
No response
The text was updated successfully, but these errors were encountered: