keepassxreboot / keepassxc-browser

KeePassXC Browser Extension
GNU General Public License v3.0
1.76k stars 187 forks source link

Safari support #294

Open luzik opened 6 years ago

luzik commented 6 years ago

Please consider providing support for Safari web browser.

droidmonkey commented 6 years ago

Not until Safari supports the Web Extensions API. Please see https://stackoverflow.com/questions/47435082/will-safari-ever-support-webextensions-api

varjolintu commented 4 years ago

Let's reopen this as Apple just announced that they will support the WebExtension API with the upcoming Safari release. It's unclear if it's only available for the next OS version or for all.

varjolintu commented 4 years ago

https://hacks.mozilla.org/2020/06/welcoming-safari-to-the-webextensions-community/ - According to this, Mojave, Catalina and Big Sur are the supported macOS versions.

varjolintu commented 4 years ago

Plus it's confirmed that Native Messaging will be supported: https://developer.apple.com/documentation/safariservices/safari_web_extensions/messaging_between_the_app_and_javascript_in_a_safari_web_extension

varjolintu commented 4 years ago

...but I haven't been able to test it yet because it needs a beta version of Big Sur and XCode both.

vyashole commented 4 years ago

@varjolintu Both Xcode 12 and Safari 14 are now available on macOS Catalina.

xcrun safari-web-extension-converter keepassxc-browser converted the extension into an xcode project with the following warning:

Warning: The following keys in your manifest.json are not supported by your current version of Safari. If these are critical to your extension, you should review your code to see if you need to make changes to support Safari:
    css
    browser_action
    all_frames
    options_ui
    applications
    contextMenus
    storage
    scripts
    commands
    notifications
    webRequest
    default_locale
    tabs
    webNavigation
    nativeMessaging
    clipboardWrite
    version
    version_name
    name
    web_accessible_resources
    activeTab
    run_at
    webRequestBlocking
    js
    matches
    manifest_version
    icons
    description

I can see that some of these might be a problem for normal functioning. Hope you can at least get simple auto fill to work though. All the best.

varjolintu commented 4 years ago

@vyashole I haven't tried it out yet, but seems strange if nativeMessaging gives a warning because it should be supported.

vyashole commented 4 years ago

@varjolintu the warning says it is not supported by the current version of safari i have. Maybe I'm missing something here.

Native messaging is supported according to https://developer.apple.com/documentation/safariservices/safari_web_extensions/messaging_between_the_app_and_javascript_in_a_safari_web_extension

Anyway it is past midnight where I live. I'll go sleep now. Will check it out tomorrow.

cschlosser commented 4 years ago
App Name: KeePassXC-Browser
App Bundle Identifier: com.yourCompany.KeePassXC-Browser
Language: Swift
Is this correct? [yes]: 
Warning: The following keys in your manifest.json are not supported by your current version of Safari. If these are critical to your extension, you should review your code to see if you need to make changes to support Safari:
    notifications
    webRequestBlocking
    applications

That's what it's outputting for me with Safari (Version 14.0 (15610.1.28.1.9, 15610)) with Xcode Version 12.0 beta 2 (12A6163b) on 10.15.5.

varjolintu commented 4 years ago
Screenshot 2020-09-21 at 23 10 12 Screenshot 2020-09-21 at 23 17 54

Lets see how this goes. (Haven't tried the custom browser option yet as Safari is not supported in the current KeePassXC release).

EDIT: I need to inspect the sample code later to see if there's any changes needed for KeePassXC or the proxy: https://developer.apple.com/documentation/safariservices/safari_web_extensions/messaging_a_web_extension_s_native_app

vyashole commented 4 years ago

See: https://developer.apple.com/documentation/safariservices/safari_web_extensions/messaging_between_the_app_and_javascript_in_a_safari_web_extension

Safari ignores the application.id parameter and only sends the message to the containing macOS app’s native app extension.

This means the safari extension will have to be bundled with either KeePassXC or a standalone proxy.

varjolintu commented 4 years ago

See: https://developer.apple.com/documentation/safariservices/safari_web_extensions/messaging_between_the_app_and_javascript_in_a_safari_web_extension

Safari ignores the application.id parameter and only sends the message to the containing macOS app’s native app extension.

This means the safari extension will have to be bundled with either KeePassXC or a standalone proxy.

True. A proxy would be the correct place for it, and I'm gonna do the implementation soon.

vyashole commented 4 years ago

Hi @varjolintu Have you found time to work on this yet? I'm not asking for an ETA, but just letting you know that I am very interested in this feature, and while I can't be very useful in actual coding, I'll be glad to help out by testing, sharing logs, etc. Let me know in case any help is required.

varjolintu commented 4 years ago

@vyashole I have problems compiling the code (event the example one, Native Messaging Demo Extension). Even when I already have latest Catalina, XCode 12 and Safari 14, the code gives me Cannot find SFExtensionMessageKey in scope error and I have no idea how to solve it.

EDIT: If I create a new project it works, so gotta look this some more. EDIT 2: Succeeded finally building it. EDIT 3: I can already send messages to the extension, but sending from extension to application doesn't work yet.

varjolintu commented 4 years ago

I've been looking at the possible implementation and it seems the best solution for this is to wrap an own application for macOS that contains the extension + the Safari code. In this way we can provide a new Safari Web Extension version for each release. Otherwise we'd need to release a new KeePassXC version for macOS for each extension update, and that is not gonna work.

droidmonkey commented 4 years ago

They always gotta be special....

varjolintu commented 4 years ago

They always gotta be special....

Indeed. I almost thought this thing would be easy to do. Basically we have to write an own "proxy" application that works only with Safari.

rennefJ commented 4 years ago

Basically we have to write an own "proxy" application that works only with Safari.

I am not a developer, but I have reseached this topic a little bit. How I understand it, the extension needs to be distributed as an app. But the app does not necessarily need to contain any functionality. It can be more ore less an empty shell that just contains the extension. But it could also be in included in the main Keepassxx App. Of course if you want to be able to release the extension separately I would also go for the empty shell.

rennefJ commented 4 years ago

I found a guy who has created a Safari extension that just adds a reload button. He has written about it, maybe that is helpful. https://hypercritical.co/safari-reload-button/

droidmonkey commented 4 years ago

@rennefJ this is a native messaging problem, not an extension problem. We can deploy an extension without blinking, the problem is the proxy application that supports the native messaging back to KeePassXC seems to have to be deployed WITH the extension. No other browser requires that.

varjolintu commented 4 years ago

Luckily the XCode project loads the extension source files as references so there's no need to copy files around.

OsapBender commented 4 years ago

hey guys. can I hope to have support keepassxc in safari soon? (at least in big sur)

varjolintu commented 4 years ago

@OsapBender Cannot promise anything yet. I have some troubles sending messages from extension to the application. And I haven't had time to do or test it any further.

joconcepts commented 3 years ago

Safari support would be really nice! It will maybe make me move to safari from chrome on macos.

Smurk commented 3 years ago

Looking forward for the Safari support as well!

joconcepts commented 3 years ago

Any news on this topic?

varjolintu commented 3 years ago

@joconcepts Not yet. But we haven't forgotten this one.

joconcepts commented 3 years ago

well I need to ask again: any news regarding this integration? :)

varjolintu commented 3 years ago

@joconcepts No. We are waiting for feedback from Apple for a certain issue.

ngdio commented 3 years ago

Actually, it might be a better idea to implement the macOS Autofill function instead in KeePassXC, which was introduced with Big Sur. Strongbox has implemented this already and it works rather well in Safari even without a browser extension, and possibly even in other applications (haven't tested that).

varjolintu commented 3 years ago

@ngdio That's one possibility, yes. Gotta inspect how it works. The difficulty here is that KeePassXC is not a XCode project. We always have to combine C++ with Objective-C code and that's not a perfect way to do things, and it's a bit slower.

gagarine commented 3 years ago

Another way would be to create a Swift Xcode project that expose the KeePassXC password to macOS Autofill function.

1oo7 commented 3 years ago

@ngdio That's one possibility, yes. Gotta inspect how it works. The difficulty here is that KeePassXC is not a XCode project. We always have to combine C++ with Objective-C code and that's not a perfect way to do things, and it's a bit slower.

...and you were unable to simply make an Obj.C++ project in Xcode?

varjolintu commented 3 years ago

@1oo7 Sadly, it's not that simple.

elrazez commented 3 years ago

hello, been reading this interesting topic and wondering, has there been any luck or progress yet? will we have the extension for safari soon? if not, how long you think it will take? approximately. really appericiate your work. this is my 5yo dream!

wkoncki commented 3 years ago

Actually, it might be a better idea to implement the macOS Autofill function instead in KeePassXC, which was introduced with Big Sur.

I would actually advise again this. Autofill extensions have this rather weird workflow on macOS where you first have to select it from dropdown, then select your password, and then you get info from Safari asking you to save it in its own keychain. It's awkward, and generally inferior to how KeePassXC extension works in Firefox. There is a reason other password managers are not embracing it as well.

janprzy commented 3 years ago

I cannot confirm this. I use Strongbox, which has implemented the Autofill API, and it works pretty similar to the iCloud Keychain. The login credentials are suggested immediately and there are no extra steps involved. I only have to manually select Strongbox if the correct credentials are not offered in the dropdown.

Bildschirmfoto 2021-04-24 um 11 32 49
varjolintu commented 3 years ago

hello, been reading this interesting topic and wondering, has there been any luck or progress yet? will we have the extension for safari soon? if not, how long you think it will take? approximately. really appericiate your work. this is my 5yo dream!

Sorry for not bringing any news to this feature sooner. I've been quite busy. Anyway, I had constant problems of debugging the messages sent from the browser extension, and after changing many emails with Apple's support they weren't able to provide any help. What this means for developers is that there's no way to debug any messages sent from Native Messaging API to the Swift side of the code. They suggested that macOS Console application could show the messages as a workaround, well it didn't.

So, because there's no way to actually debug the application side code there's only two choices left: try to continue the implementation blind without any debugging (which takes even more time because I'm not a Swift expert), or we'll make a switch to the Autofill API. The latter needs to be investigated if it's possible to implement in directly to the KeePassXC application which is not a XCode project.

sirpiotrek commented 3 years ago

Any news on this issue?

varjolintu commented 3 years ago

@sirpiotrek I'll update any news to this thread.

joconcepts commented 3 years ago

Any news?

SommerEngineering commented 3 years ago

Thanks @varjolintu for not giving up and continuing to try to implement our favorite plugin for Safari. Thanks for the time you invest ❤️ 👍

varjolintu commented 3 years ago

@joconcepts There hasn't been any progress lately. I'm tempted to try the new AutoFill API but currently I'm unable to update to Big Sur, which is the requirement.

Minims commented 3 years ago

@varjolintu Too old Mac ? if yes have a look at this : https://www.youtube.com/watch?v=znlhI6f7x1Q , it might solve your issue in most of the case.

varjolintu commented 3 years ago

@varjolintu Too old Mac ? if yes have a look at this : https://www.youtube.com/watch?v=znlhI6f7x1Q , it might solve your issue in most of the case.

Not too old, but for multiple reasons I cannot upgrade yet. I can't take any risks with incompatibilities with certain applications and plugins at this point. I'm going to upgrade it eventually. Propably within a month if lucky.

Tobisaninfo commented 3 years ago

Maybe this plugin is a kind of inspiration for handling the safari difficulties. I use this for some months with safari, but I would like to come back to KeePassXC when a safari integration exists

https://github.com/keeweb/keeweb-connect

Immanion commented 3 years ago

Hiya,

Just thought I’d post here to say that about a week ago, 1password removed some functionality from the iOS app around shared sheets; with that and their roadmap to force vaults onto their servers (which I only just learned about), removal of a standalone licence, and force to a paid subscription, you might be seeing an increase in interest as people like me are looking for viable alternatives to 1password. A safari extension is going to be pretty essential to a lot of us looking to switch!

Cheers!

grovolis commented 3 years ago

I think switching to the autofill API (like Strongbox) is the only viable solution.I wasn't even aware Apple had exposed such functionality up until recently, it works really well in 99% of cases.

svoboda77 commented 2 years ago

There is an easy workaround for Safari. Install "userscripts" extension (https://github.com/quoid/userscripts), use this script to inject URL to the tab title:

document.title = document.title+' - '+document.location;

This enables autotype hotkey funcionality.

mietzen commented 2 years ago

Hey, is some actively looking into this? @varjolintu did you get a chance to upgrade to Big Sur?