Introducing a new way to review your PRs.

Read the announcement

fwdai / rowel

🔑 Local-first Secrets Manager

View on GitHub

23 documents · Updated Oct 9, 2026

docs / browser-extension-automation

Browser extension automation

The Rowel browser extension brings vault access into supported browsers. It connects the browser to the Rowel desktop app, finds login fields on web pages, retrieves matching credentials, and fills them only through user settings or user action. It also supports one-time codes, credential save prompts, HTTP authentication, and passkeys where the selected browser build and Rowel version allow them. See the parent page Browser integration and autofill for the wider desktop-to-browser model.

Extension architecture

The extension separates browser-wide work from page work. The background side owns the Rowel connection, tab state, settings, menus, and browser events. Content scripts run in each page frame and own field detection, in-page controls, credential selection, and filling.

The main message path moves from a page to the background service and then to the Rowel app. Results return through the same path so that page state and toolbar state stay aligned.

flowchart LR
    Page[Web page and frames] <--> Content[Content scripts]
    Content <--> Background[Background service]
    Popup[Toolbar and options pages] <--> Background
    Background <--> Host[Rowel desktop app]
    Host <--> Vault[Open vault]

Background coordination

The background service is the extension's shared control point. It keeps connection and association state, caches short-lived tab data, routes messages, updates the toolbar icon, and starts browser listeners for navigation, commands, context menus, and HTTP authentication. This lets many page frames use one browser-to-app session without owning that session themselves (extension/…/background_service.js• L3-20, extension/…/event.js• L3-14).

References: extension/…/background_service.js• L3-20 extension/…/event.js• L3-14 extension/…/tabs.js• L18-27

Content-script automation

The content scripts work inside web pages and frames. They identify visible login, password, custom, and one-time-code fields, add small in-page controls, and ask the background side for matching entries. They do not decide whether a vault is open or associated; they reflect that state and stop or clear page data when the connection or vault state changes (extension/…/rowel.js• L17-27, extension/…/rowel.js• L358-394, extension/…/rowel.js• L778-788).

References: extension/…/rowel.js• L17-27 extension/…/rowel.js• L358-394 extension/…/rowel.js• L778-788

Connection lifecycle

The extension treats connection, vault availability, and vault association as separate states. A connection means the extension can reach Rowel. An open vault means Rowel can answer vault requests. Association means the extension has been approved for the current vault and may use its saved connection material.

Connection and association states

At startup, the extension loads settings and saved association records, creates tab state, and attempts to connect to the configured Rowel host. It then exchanges public keys, learns the current vault identity, and checks the saved association. A first-time connection asks the user to approve the association. A failed connection, locked vault, changed vault identity, or rejected association changes the toolbar and page state instead of exposing credentials (extension/…/init.js• L116-130, extension/…/keepass.js• L831-857).

The connection uses native messaging by default. A WebSocket option exists in the shared protocol model but is hidden until the supported Rowel side advertises it. Safari uses a compatibility port that presents the same connection behavior while the Safari app extension carries messages to the desktop app (extension/…/page.js• L8-47, extension/…/safari-native.js• L3-18).

References: extension/…/init.js• L116-130 extension/…/keepass.js• L831-857 extension/…/page.js• L8-47 extension/…/safari-native.js• L3-18

Disconnect and vault changes

When the native port closes, the extension marks itself disconnected, clears association and database state, removes cached logins, and tells active content scripts to update their status. When the vault changes or locks, it follows the same safety boundary by clearing page credentials before it updates the toolbar and page indicators (extension/…/client.js• L409-422, extension/…/keepass.js• L984-1020).

References: extension/…/client.js• L409-422 extension/…/keepass.js• L984-1020

Credential discovery and filling

Credential automation starts with the page, not with a blind request for every entry in the vault. The content side finds usable fields and derives the page URL and form action. The background side sends that context to Rowel, receives the matching entries, and keeps the result tied to the tab until navigation, tab switching, or a configured timeout clears it.

Field detection and matching

Field detection groups visible inputs into likely username-password combinations. It also handles username-only pages, custom field definitions, dynamically added fields, and segmented one-time-code fields. Site preferences and predefined site rules can adjust detection, while ignored sites and unsafe cross-origin frames block retrieval (extension/…/fields.js• L14-69, extension/…/fields.js• L594-662, extension/…/rowel.js• L1002-1025).

After detection, the content side sends the page URL and form action to the background side. The background side checks association, asks Rowel for matching logins, removes duplicate entries, and stores the result in the current tab's short-lived state. This keeps later popup or context-menu actions tied to the page that requested the credentials (extension/…/rowel.js• L648-687, extension/…/page.js• L175-204, extension/…/keepass.js• L124-179).

References: extension/…/fields.js• L14-69 extension/…/fields.js• L594-662 extension/…/rowel.js• L648-687 extension/…/rowel.js• L1002-1025 extension/…/page.js• L175-204 extension/…/keepass.js• L124-179

Fill and save journeys

The extension supports several fill entry points. A user can select an entry from the toolbar popup or autocomplete list, use a context-menu or keyboard action, or enable automatic fill for a single or relevant match. The fill path writes the selected username, password, custom fields, and optional one-time code into the detected controls, then performs auto-submit only when the setting and site rules allow it (extension/…/fill.js• L24-77, extension/…/fill.js• L218-299, extension/…/fill.js• L321-346).

The same page observer watches trusted form submissions. When it sees a new or changed password, it stores the submitted values briefly across redirects and shows a save banner or saves directly according to settings. The redirect allowance prevents an old submission from being offered after too many navigations (extension/…/form.js• L13-40, extension/…/rowel.js• L541-613, extension/…/rowel.js• L871-887).

References: extension/…/fill.js• L24-77 extension/…/fill.js• L218-299 extension/…/fill.js• L321-346 extension/…/form.js• L13-40 extension/…/rowel.js• L541-613 extension/…/credentials.js• L37-65

Login and HTTP-auth experiences

The toolbar reflects the current tab's usable actions. It changes icon state for connection, locked-vault, association, and error conditions. When matching credentials exist, it changes the popup and badge so the user can choose an entry for that page.

Login selection

The normal login popup presents the matching entries for the active tab. Selecting one sends its entry identity back to the content script, which fills the page's detected combination. The popup also offers recovery actions such as reconnect, reopen, lock, and field redetection when the current state needs user attention (extension/…/browserAction.js• L6-30, extension/…/popup.js• L24-65, extension/…/popup_login.js• L13-39).

References: extension/…/browserAction.js• L6-30 extension/…/popup.js• L24-65 extension/…/popup_login.js• L13-39

HTTP authentication

HTTP Basic Auth is handled as a browser request rather than as a normal page form. When the setting is enabled, the background side intercepts the authentication challenge, asks Rowel for entries marked for that URL, and supplies the only match automatically. If several matches exist, it opens a dedicated popup so the user can choose one or dismiss the request. Safari does not expose this flow in its extension build (extension/…/httpauth.js• L8-35, extension/…/httpauth.js• L62-107, extension/…/popup_httpauth.js• L8-52).

References: extension/…/browserAction.js• L6-30 extension/…/popup.js• L24-65 extension/…/popup_login.js• L13-39 extension/…/httpauth.js• L8-35 extension/…/httpauth.js• L62-107 extension/…/popup_httpauth.js• L8-52

Settings and site controls

Settings define how much automation the extension performs and which sites may use it. They are stored in extension storage, receive defaults on first load, and can be supplied by browser-managed policy. The options page changes these values and tells the background side when a live listener or toolbar state must change (extension/…/page.js• L8-47, extension/…/page.js• L76-105, extension/…/options.js• L34-90).

Automation settings

The settings group controls the main user choices:

  • Whether credentials are retrieved automatically.
  • Whether one match, a relevant match, a one-time code, or a form is filled automatically.
  • Whether the extension submits forms or fills HTTP authentication.
  • How entries are sorted and how long tab data remains available.
  • Whether passkeys, notifications, icons, dynamic detection, or debug logging are enabled.
  • Which vault group receives new credentials or passkeys.

Managed browser policy can provide these settings for controlled deployments. The policy schema describes the supported shape and default intent without replacing the extension's normal setting load (extension/…/managed_storage.json• L1-21, extension/…/managed_storage.json• L117-212).

References: extension/…/page.js• L8-47 extension/…/page.js• L76-105 extension/…/options.js• L63-126 extension/…/managed_storage.json• L1-21 extension/…/managed_storage.json• L117-212

Site preferences and frame boundaries

Site preferences give a page-specific answer when general detection is not enough. A user can ignore a site, allow cross-origin frames, enable username-only or improved detection, and disable auto-submit for that site. The extension checks these rules before retrieving or filling credentials, and it only accepts a cross-origin frame when its domain relationship or an explicit site rule permits it (extension/…/options.js• L543-687, extension/…/rowel.js• L729-762, extension/…/page.js• L272-287, extension/…/page.js• L348-360).

References: extension/…/options.js• L543-687 extension/…/rowel.js• L729-762 extension/…/page.js• L272-287 extension/…/page.js• L348-360

Localization and presentation

The extension uses browser locale catalogs for popup text, options pages, in-page messages, errors, and command labels. HTML elements declare translation keys, while shared translation helpers resolve text and placeholders through the browser internationalization API (extension/…/translate.js• L3-42, extension/…/global.js• L184-186).

Locale and product language

The English catalog defines Rowel-facing product language such as “vault” and the connection guidance. The string sync script applies the Rowel product name across every locale and keeps the English copy consistent after upstream changes. This keeps user-visible copy separate from the upstream protocol and internal names (scripts/extension-strings.mjs• L1-12, scripts/extension-strings.mjs• L23-59).

References: extension/…/messages.json scripts/extension-strings.mjs• L1-12 scripts/extension-strings.mjs• L23-59

Theme and in-page surfaces

The extension follows the desktop light, dark, or system theme. Its toolbar pages and injected page surfaces use the generated Rowel design tokens, so autocomplete lists, banners, notifications, and field controls remain readable inside arbitrary websites (docs/browser-extension.md• L92-117, extension/…/options.js• L847-854).

References: extension/…/translate.js• L3-42 extension/…/global.js• L184-186 scripts/extension-strings.mjs• L1-12 scripts/extension-strings.mjs• L23-59 docs/browser-extension.md• L92-117 extension/…/options.js• L847-854

Browser-specific builds

The source extension is packaged into browser-specific manifests because the browsers differ in background lifetime, manifest format, permissions, and extension identity. The build keeps the shared automation behavior aligned while adapting the delivery details required by Chromium, Firefox, and Safari.

Chromium and Firefox packages

Chromium uses a Manifest V3 service worker and a pinned development identity. Firefox uses a Manifest V2 background page and the fixed add-on ID browser@rowel.app. The unpacked builds are useful for local loading, while store archives use the packaging rules required by each browser (extension/…/manifest_chromium.json• L1-10, extension/…/manifest_firefox.json• L1-49, extension/rowel-build.js• L4-15).

References: extension/…/manifest_chromium.json• L1-10 extension/…/manifest_firefox.json• L1-49 extension/rowel-build.js• L4-15

Safari app extension

Safari ships the same extension behavior inside the Rowel app. Its build is derived from the Firefox package but uses a persistent background page and a native port shim because Safari does not launch a native messaging host in the same way as Chromium or Firefox. HTTP authentication remains unavailable in this build (extension/…/build.mjs• L9-22, extension/…/safari-native.js• L3-18, extension/…/httpauth.js• L8-11). For the desktop protocol, consent, and passkey side of browser integration, see Native browser services and passkeys.

References: extension/…/build.mjs• L9-22 extension/…/safari-native.js• L3-18 extension/…/httpauth.js• L8-11

Build identity and host compatibility

The browser package and the Rowel desktop host share fixed connection identifiers. The native host name, Firefox add-on ID, and Chromium extension ID must remain aligned with the host manifests. The build check validates those values and also checks the Safari background arrangement, because a mismatch can look like a silent connection failure rather than a build error (docs/browser-extension.md• L25-43, scripts/check-extension-build.mjs• L1-6, scripts/check-extension-build.mjs• L31-59).

References: extension/…/manifest_chromium.json• L1-10 extension/…/manifest_firefox.json• L1-49 extension/rowel-build.js• L4-15 extension/…/build.mjs• L9-22 extension/…/safari-native.js• L3-18 extension/…/httpauth.js• L8-11 docs/browser-extension.md• L25-43 scripts/check-extension-build.mjs• L31-59

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep the native host name, Firefox add-on ID, Chromium identity, and desktop host allow-list aligned.
  • Keep the content-script message names aligned with the background message handler map and with popup or command actions.
  • When changing connection or vault state, preserve the clear-before-update behavior for cached tab credentials.
  • When changing settings, update the defaults, managed policy schema, options controls, and any live listener that depends on the setting.
  • When changing a user-facing string, reapply the locale transformation and check the English placeholders and product terms.
  • When changing the shared manifest, verify the Chromium, Firefox, and Safari derived manifests still express the right background model and permissions.
  • When changing HTTP authentication behavior, check the browser permission model and the Safari feature exclusion.

Important failure modes

TriggerConsequenceGuard
Extension identity or host allow-list does not matchThe extension cannot reach Rowel even when the app is runningBuild checks compare the packaged IDs and host name with the expected values
Rowel closes, disables browser integration, or loses the native portCached logins are cleared and page filling stopsDisconnect handling resets connection, vault, and association state
The vault is locked or the saved association is unknownThe toolbar shows a recovery state and no credentials are returnedAssociation checks run before retrieval and filling
A page uses an unsafe cross-origin or sandboxed frameCredential retrieval is blocked for that frameFrame checks require a safe origin, a matching base domain, or an explicit site rule
HTTP Auth is enabled with more than one matching entryThe browser request waits for a user choiceThe extension opens the HTTP-auth selection popup instead of choosing an entry silently
A locale string loses a required placeholderThe UI shows a translation error or wrong guidanceTranslation helper checks placeholder presence and the string check runs in the build workflow

Key files

FileWhy to read it
extension/…/manifest.jsonDefines the shared extension surface, page scripts, permissions, commands, and default locale.
extension/…/init.jsShows how startup listeners, settings, tabs, menus, HTTP Auth, and reconnect begin.
extension/…/event.jsShows the message boundary between page scripts, popup pages, and background services.
extension/…/client.jsShows the connection port, request matching, disconnect behavior, and protected message exchange.
extension/…/keepass.jsShows the high-level lifecycle for association, vault state, credential retrieval, filling support, and passkeys.
extension/…/rowel.jsShows content-script startup, page state, field setup, credential retrieval, and action routing.
extension/…/fields.jsShows the page-level rules for recognizing login, custom, and one-time-code fields.
extension/…/fill.jsShows the user and automatic fill paths, form submission rules, and page event behavior.
extension/…/httpauth.jsShows the HTTP Basic Auth request flow and its user-choice boundary.
extension/…/options.jsShows settings, site preferences, connected vault records, and browser-specific option handling.
extension/rowel-build.jsShows how Chromium and Firefox unpacked builds and store archives are produced.
extension/…/build.mjsShows how the Safari app-extension package is derived and adapted.
scripts/extension-strings.mjsShows how localized product wording is kept consistent across locales.
scripts/check-extension-build.mjsShows the checks that protect browser identity and host compatibility.