keepassxc-browser icon indicating copy to clipboard operation
keepassxc-browser copied to clipboard

Safari support

Open luzik opened this issue 7 years ago • 105 comments
trafficstars

Please consider providing support for Safari web browser.

luzik avatar Sep 07 '18 18:09 luzik

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

droidmonkey avatar Sep 07 '18 20:09 droidmonkey

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 avatar Jun 22 '20 18:06 varjolintu

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 avatar Jun 23 '20 19:06 varjolintu

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 avatar Jun 23 '20 19:06 varjolintu

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

varjolintu avatar Aug 20 '20 15:08 varjolintu

@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.

vyashole avatar Sep 21 '20 18:09 vyashole

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

varjolintu avatar Sep 21 '20 19:09 varjolintu

@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.

vyashole avatar Sep 21 '20 19:09 vyashole

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.

cschlosser avatar Sep 21 '20 19:09 cschlosser

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

varjolintu avatar Sep 21 '20 20:09 varjolintu

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.

vyashole avatar Sep 23 '20 04:09 vyashole

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.

varjolintu avatar Sep 23 '20 04:09 varjolintu

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.

vyashole avatar Oct 04 '20 07:10 vyashole

@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 avatar Oct 04 '20 07:10 varjolintu

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.

varjolintu avatar Oct 04 '20 08:10 varjolintu

They always gotta be special....

droidmonkey avatar Oct 04 '20 11:10 droidmonkey

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.

varjolintu avatar Oct 04 '20 11:10 varjolintu

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 avatar Oct 04 '20 11:10 rennefJ

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/

rennefJ avatar Oct 04 '20 11:10 rennefJ

@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.

droidmonkey avatar Oct 04 '20 13:10 droidmonkey

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

varjolintu avatar Oct 04 '20 14:10 varjolintu

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

OsapBender avatar Nov 01 '20 10:11 OsapBender

@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.

varjolintu avatar Nov 01 '20 11:11 varjolintu

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

joconcepts avatar Nov 24 '20 21:11 joconcepts

Looking forward for the Safari support as well!

Smurk avatar Nov 29 '20 13:11 Smurk

Any news on this topic?

joconcepts avatar Dec 19 '20 15:12 joconcepts

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

varjolintu avatar Dec 19 '20 15:12 varjolintu

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

joconcepts avatar Jan 25 '21 12:01 joconcepts

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

varjolintu avatar Jan 25 '21 13:01 varjolintu

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).

ngdio avatar Jan 25 '21 15:01 ngdio