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

[PM-2560] Fix Firefox default passkeys handling #5690

Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion apps/browser/src/platform/browser/browser-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,21 @@ export class BrowserApi {
name: string,
callback: (message: any, sender: chrome.runtime.MessageSender, response: any) => unknown
) {
chrome.runtime.onMessage.addListener(callback);
chrome.runtime.onMessage.addListener(
(msg: any, sender: chrome.runtime.MessageSender, sendResponse: any) => {
if (
msg.command === "fido2RegisterCredentialRequest" ||
msg.command === "fido2GetCredentialRequest"
) {
// The callback needs to return a truthy value here for fido2 requests so that we can return a response
// using sendResponse. This can sometimes return non-boolean values which are considered truthy,
// so we need to explicitly check for true
return callback(msg, sender, sendResponse) === true;
} else {
callback(msg, sender, sendResponse);
}
}
);
differsthecat marked this conversation as resolved.
Show resolved Hide resolved

// Keep track of all the events registered in a Safari popup so we can remove
// them when the popup gets unloaded, otherwise we cause a memory leak
Expand Down