First shot at an macOS AutoFill integration#13051
First shot at an macOS AutoFill integration#13051fberlakovich wants to merge 4 commits intokeepassxreboot:developfrom
Conversation
Implement a native macOS Credential Provider extension that allows Safari and other apps to pull credentials from unlocked KeePassXC databases via the system AutoFill framework. Components: - keepassxc-autofill.appex: Credential Provider extension implementing ASCredentialProviderViewController with a table-based credential picker - keepassxc-autofill-xpc.xpc: XPC service bridging the sandboxed extension and the main KeePassXC process - AutoFill class (Qt-side): manages XPC lifecycle, identity store refresh, and database change monitoring The build assumes a valid Apple Developer signing identity and provisioning profile. The extension appears in System Settings > Passwords > AutoFill Passwords once properly signed and registered. Only password credentials are supported. The main app must be running with at least one database unlocked.
|
That's a lot of code for a seemingly simple feature. But thanks, I'll check it when I find the time. |
Agree, a lot of the complexity comes from the KeepassXC app and the macOS extension communicating via an XPC service. Strongbox, afaict, uses a unix domain socket (see https://github.com/strongbox-password-safe/Strongbox/blob/master/macbox/autofill-proxy/AutoFillProxyClient.m and https://github.com/strongbox-password-safe/Strongbox/blob/master/macbox/autofill-proxy/AutoFIllRequestHandler.swift), but follows a similar client-server architecture for AutoFill. |
|
This is one PR which you probably don't want to write with AI:
Even if this is thoroughly reviewed (which I assume it will be), it can attract a lot of negative response (or slip in potentially risky bugs, which is worse). |
|
We'll use it as a start and see what we can keep and what we must throw away. This will certainly need a lot of editing, but I'll have to study the code first. I would trust a human PR of this complexity as little as this one. At the moment, the tests don't even pass. |
|
The latest changes should fix the failing test and remove some of the clutter introduced during my local troubleshooting |
Fixes #6265
Disclaimer: Like explained in #6265 I did use claude to write 95% of the code (although it took dozens of iterations and manual reading of lots of documentation) + I couldn't really manually test the changes because I don't have an Apple Developer certificate.
This PR adds a native macOS AutoFill Credential Provider to KeePassXC.
Once enabled, Safari and any app that uses the system password AutoFill sheet
can pull credentials directly from an unlocked KeePassXC database without browser extension.
It consists of two new components that live inside the app bundle:
keepassxc-autofill.appex-- the Credential Provider extension itself.It implements
ASCredentialProviderViewController, presents matching entriesin a table, and hands the selected credential back to the system.
keepassxc-autofill-xpc.xpc-- an XPC service that bridges theextension (which runs in its own sandbox) and the main KeePassXC process.
The main app pushes its credential store to the XPC service whenever databases
are unlocked, locked, or modified.
Only password credentials are supported for now. Entries without a URL or
password are ignored. The URL matching logic (host + subdomain) mirrors what
the desktop app already does for browser integration.
Building
Standard KeePassXC build, no extra flags. I tried with
ldidto embedentitlements, but
codesignwith a privisioning profile should actually do it.The build produces the
.appexand.xpcbundles automatically and copiesthem into the right places inside
KeePassXC.app.Testing Strategy
Unit tests
59 tests cover the URL/host matching utilities:
cmake --build . --target testautofillutils ./tests/Debug/testautofillutilsManual testing
You need a proper Apple Developer signing identity.
I never got past this last step, even in a macOS VM with SIP disabled.
Open Safari, visit a site that has a matching entry in your database, click the
password field, and KeePassXC should show up in the AutoFill popover.
Useful debugging commands
Limitations
to unlock KeePassXC -- it cannot unlock the database itself.
ldidfor entitlement embedding; standardcodesignsilently drops entitlements without a provisioning profile.Source layout
Type of change