Skip to content
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

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

Closed
Borghii opened this issue Feb 19, 2025 · 3 comments · May be fixed by #16621
Closed

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

Borghii opened this issue Feb 19, 2025 · 3 comments · May be fixed by #16621
Labels
in: web An issue in web modules (web, webmvc) status: duplicate A duplicate of another issue type: bug A general bug

Comments

@Borghii
Copy link

Borghii commented Feb 19, 2025

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.

@Borghii Borghii added status: waiting-for-triage An issue we've not yet triaged type: bug A general bug labels Feb 19, 2025
@Borghii
Copy link
Author

Borghii commented Feb 19, 2025

@franticticktick can you revise it?

franticticktick added a commit to franticticktick/spring-security that referenced this issue Feb 19, 2025
@franticticktick
Copy link
Contributor

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

@jzheaux
Copy link
Contributor

jzheaux commented Feb 24, 2025

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

@jzheaux jzheaux closed this as completed Feb 24, 2025
@jzheaux jzheaux added status: duplicate A duplicate of another issue in: web An issue in web modules (web, webmvc) and removed status: waiting-for-triage An issue we've not yet triaged labels Feb 24, 2025
franticticktick added a commit to franticticktick/spring-security that referenced this issue Feb 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web An issue in web modules (web, webmvc) status: duplicate A duplicate of another issue type: bug A general bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants