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

TypeError: 'toJSON' called on an object that does not implement interface PublicKeyCredential. #2298

Open
piyushgarg opened this issue Aug 2, 2024 · 7 comments
Labels

Comments

@piyushgarg
Copy link

Background: The current version 1911 is working fine with passkey on chrome browsers but not on Firefox based browsers.

Expected Behavior

1911 version should work with passkey on Firefox browsers also.
Found that version 1903 version working fine with Firefox. Found that code has been refactored to Prototype based. Well not sure if it could cause an issue. Downloaded the old version https://addons.mozilla.org/firefox/downloads/file/4257616/keepassxc_browser-1.9.0.3.xpi

working object 1903

image

non-working object 1911

image

Current Behavior

Somewhere after 1903 version code has been refactored to Prototype based approach than the earlier approach. After the publickeycredential object is sent back to the client code, it tries to convert it into its JSON.stringify() which works on 1903 but not on 1911 and hence the error (in subject)

Possible Solution

I possibly assume the problem is somewhere in the object type.

Steps to Reproduce (for bugs)

  1. Unfortunately as the server meant for emp, it wont work for outside.
  2. I will try to help to get it fixed.

Debug info

KeePassXC - {2.7.9}
KeePassXC-Browser - {1911}
Operating system: Linux
Browser: Firefox/Librewolf

@varjolintu
Copy link
Member

According to these sites the whole .toJSON() is still a bit experimental, and a proper support for Chrome is arriving with version 129. Is it possible that the site itself is doing something strange?

https://developer.mozilla.org/en-US/docs/Web/API/PublicKeyCredential/toJSON
https://chromestatus.com/feature/5141695044255744?context=myfeatures

@mcimadamore
Copy link

I have exactly this same problem (unfortunately also on an internal link that I cannot share here). Downgrading keepassxc-browser plugin to 1.9.0.3 does the trick - but it would be handy if this was fixed in the upstream version.

@mcimadamore
Copy link

This seems similar:
#2323
But I've tried the patch locally, and doesn't seem to solve this issue.

@varjolintu
Copy link
Member

Instead of internal links, I'd need a site where I can reproduce this.

@mcimadamore
Copy link

mcimadamore commented Sep 2, 2024

Made some progress, and was able to find a workaround. On Firefox, go to about:config, and set security.webauthn.enable_json_serialization_methods to false. This solves the issue, which seems to point at either some issue in how FF does this, or in how the website itself fails to take into account this new protocol which, as noted in the discussion above, is relatively new, and only currently implemented in FF (19+). (although, I cannot explain why downgrading the browser plugin to 1903 makes this problem disappear)

@varjolintu
Copy link
Member

Downgrading probably helps because in that old extension version a normal Object was handled instead of the actual object prototype.

@oneacl
Copy link

oneacl commented Oct 19, 2024

this error shows up on oracle cloud. if you have an account with them you can reproduce it.
I tried disabling security.webauthn.enable_json_serialization_methods and downgrading to 1903 but neither worked to register a passkey.

@varjolintu varjolintu removed the bug label Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants