Skip to content

Bug Report: Duplicate Primary Key Exception in Webauthn4J Authentication #16620

Closed
@Borghii

Description

@Borghii
Contributor

Describe the Bug

When attempting to authenticate using the following method:

public PublicKeyCredentialUserEntity authenticate(RelyingPartyAuthenticationRequest request)

from Webauthn4JRelyingPartyOperations the process follows these steps:

  1. Retrieve an existing credential record:

CredentialRecord existingCredential = this.userCredentials.findByCredentialId(credentialId);

  1. Save the credential record:

this.userCredentials.save(userCredential);

Image

However, the save method attempts to execute the following SQL insert:

Image

// @formatter:off
private static final String SAVE_CREDENTIAL_RECORD_SQL = "INSERT INTO " + TABLE_NAME
		+ " (" + COLUMN_NAMES + ") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";

This results in a duplicate primary key exception, as the credential record already exists in the database.

I don't know if I'm missing something.

Activity

Borghii

Borghii commented on Feb 19, 2025

@Borghii
ContributorAuthor

@franticticktick can you revise it?

added a commit that references this issue on Feb 19, 2025
2f41603
franticticktick

franticticktick commented on Feb 19, 2025

@franticticktick
Contributor

Hi @Borghii , thanks for this catch :) it will be fixed via #16621

jzheaux

jzheaux commented on Feb 24, 2025

@jzheaux
Contributor

Thanks for reporting this, @Borghii. I'll close this in favor of @franticticktick's PR.

added
in: webAn issue in web modules (web, webmvc)
and removed on Feb 24, 2025
added a commit that references this issue on Feb 25, 2025
af56c22
added 2 commits that reference this issue on Mar 4, 2025
293883e
e28b9bd
added a commit that references this issue on Mar 7, 2025
47630ca

5 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Bug Report: Duplicate Primary Key Exception in Webauthn4J Authentication · Issue #16620 · spring-projects/spring-security