Skip to content

Browser autofill agent — desktop + extension - #1556

Open
YoannDev90 wants to merge 3 commits into
AChep:masterfrom
YoannDev90:feat/browser-autofill-agent-v2
Open

Browser autofill agent — desktop + extension#1556
YoannDev90 wants to merge 3 commits into
AChep:masterfrom
YoannDev90:feat/browser-autofill-agent-v2

Conversation

@YoannDev90

@YoannDev90 YoannDev90 commented Aug 27, 2026

Copy link
Copy Markdown

Closes #1524

What

Adds a browser autofill agent that bridges the browser extension (Chrome/Firefox/Vivaldi/Edge) and the desktop vault. The user enables the agent in settings, the extension communicates with the desktop via Native Messaging (Chrome/Firefox/Edge) or WebSocket (Safari), and credentials are filled automatically.

How it works

Desktop side:

  • BrowserAutofillAgentManager launches two servers concurrently:
    • NM server — IPC socket for Native Messaging (the browser launches the agent binary)
    • WS server — Rust agent process listening on 127.0.0.1:<port> with ECDH + HMAC challenge-response handshake
  • A pairing code is generated automatically on first activation, copied into the extension to derive the shared secret
  • Status service (BrowserAutofillAgentStatusService) exposes state (Starting/Ready/Failed/Unsupported/Stopped) to the UI

Extension side:

  • Modular architecture: background.js (orchestrator) + 10 modules in lib/
  • Two communication modes: Native Messaging (nm-client.js) and WebSocket (ws-client.js)
  • Crypto: X25519 ECDH native (Web Crypto API) + AES-256-GCM + HMAC-SHA256
  • MV3 with separate manifests for Chrome (service_worker) and Firefox (scripts)
  • Dynamic context menu, keyboard shortcut Ctrl+Shift+Space, locked/unlocked icon state

Desktop changes

File Change
BrowserAutofillAgentManager.kt Non-suspend start(), IPC cleanup in finally, @Volatile on wsAgentProcess, dead code removed (onBeforeStart, extraCliArgs)
Main.kt LaunchedEffect with awaitCancellation(), status service, port constant, rememberUpdatedState for port
SettingBrowserAgent.kt Status display (Starting/Ready/Failed/Unsupported/Stopped), pairing code with copy button
strings.xml 4 new i18n strings for status + pairing code
SettingsRepository.kt Port + pairing code preferences
FingerprintRepositoryModule.kt BrowserAutofillAgentStatusService binding
GlobalModuleCommon.kt Get/Put browser agent use case bindings
AgentManager.kt, AgentIpcServer.kt Browser agent integration into existing IPC infrastructure
desktopApp/build.gradle.kts, settings.gradle desktopBrowserAgent module (Rust)

Extension changes (new)

File Purpose
manifest.chrome.json MV3 Chrome/Vivaldi/Edge — service_worker
manifest.firefox.json MV3 Firefox — scripts + gecko settings
background.js Orchestrator: mode detection, NM/WS routing, icon, shortcuts
content.js Credential injection into forms
lib/crypto.js X25519 ECDH + AES-256-GCM (native Web Crypto)
lib/ws-client.js WebSocket client with ECDH + HMAC handshake, request IDs, 10s timeout
lib/nm-client.js Native Messaging client with double-connect guard
lib/messaging.js Internal message listeners (query, secret, fill, status)
lib/context-menu.js Dynamic per-site context menu
lib/logger.js Cross-context log ring buffer
lib/base64.js, lib/hmac.js Utilities
options.js Pairing/unpairing page, PBKDF2 600K iterations
switch-browser.sh Script to switch between Chrome/Firefox manifests

Rust native host (new)

desktopBrowserAgent/ — Rust binary that bridges the IPC socket (nm) and the WS server. Built via Cargo for desktop.

Security

  • X25519 native via Web Crypto (Chrome 133+, Firefox 130+, Safari TP 211+)
  • Shared secret derived from pairing code via HKDF
  • __kgSetSecret restricted to extension pages (chrome-extension:// / moz-extension://)
  • fill message uses only sender.tab.id (no message.tabId fallback)
  • PBKDF2 600K iterations for at-rest secret encryption

Testing

Tested with the AppImage on CachyOS + Firefox. If anyone can test the full flow on other OS/browsers (macOS, Windows, Chrome, Vivaldi, Edge, Safari), it would help catch issues before shipping to production.

Note

An AI coding assistant was used as a development aid to accelerate implementation and research.

Adds a browser autofill agent that bridges the browser extension
(Chrome/Firefox/Vivaldi/Edge) and the desktop vault via Native
Messaging or WebSocket with ECDH + HMAC challenge-response.

Desktop: BrowserAutofillAgentManager, status service, settings UI,
pairing code flow, Rust native host module.

Extension: MV3 with modular ES architecture (10 lib modules),
native Web Crypto X25519, dual Chrome/Firefox manifests,
context menu, keyboard shortcut, locked/unlocked icon.

Closes AChep#1524
@YoannDev90

Copy link
Copy Markdown
Author

And sorry for the long AI comment, I didn't know what to say.

- extension/build-extension.sh: package chrome/firefox with version injection
- .github/workflows/build-extension.yml: build + publish (Chrome/Firefox/Safari)
- safari/generate-project.sh: generate Xcode project (run once on macOS)
- safari/build-safari-extension.sh: build Safari .app for testing
- PlasmoHQ/bpp integration for Chrome Web Store + Firefox Add-ons publishing
- App Store Connect upload via xcodebuild + notarytool

Closes AChep#1524
@YoannDev90
YoannDev90 force-pushed the feat/browser-autofill-agent-v2 branch from b786dec to 8b5ce44 Compare August 30, 2026 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT] browser extension

1 participant