Skip to main content
Background Background

Modifying A Buggy Browser Extension

The 1Password browser extension has been misbehaving lately… lets fix it! #

The problem that I have been having is a recent bug introduced into 1Password where it will not autofill on local http websites. The reason for this is a problem importing window.crypto.randomUUID() within a non-secure context and is outlined here.

This guide will walk you through how to fix this issue, and also how to modify other Firefox extensions.

Step 1: Figure out where your Firefox profile is stored #

Open a new firefox tab and type about:support into the url bar. Then find the Profile Directory section and click the Open Directory button.

Firefox about:support

Step 2: Extract the extension #

Within the Firefox profile directory, go into the extensions folder and you will find one .xpi file for each extension you are using in Firefox. One of these extensions will be the one you want.

Firefox Profile Extensions

I have found the easiest way to figure out which .xpi file is correct is to open them up in an archive manager (you can rename the file to *.zip first if you want), then check inside the credits.html file.

Extension Archive

The extension name is near the top under <meta content=[EXTENSION_NAME]/>

Credits HTML

Step 3: Edit the extension #

To solve our particular problem, extract this whole .xpi file into a new folder. We will want to edit the /[Folder Name]/inline/injected.js file.

Open a new terminal window here (in the folder with injected.js) and…

For Linux Users: #

sed -i 's/QDe=yte==="client"?window\.crypto\.randomUUID()\.slice(0,8):void 0/QDe=yte==="client"\&\&window.crypto.randomUUID?window.crypto.randomUUID().slice(0,8):void 0/g' injected.js

For Windows Users: #

Warning! The powershell command below was converted from the above version by AI and I haven’t tested it since I don’t have Windows!
(Get-Content injected.js -Raw) -replace 'QDe=yte==="client"\?window\.crypto\.randomUUID\(\)\.slice\(0,8\):void 0','QDe=yte==="client"\&\&window.crypto.randomUUID\?window.crypto.randomUUID().slice(0,8):void 0' | Set-Content injected.js

This uses sed (or powershell Get-Content) to find and replace a string. We are replacing the existing call to window.crypto.randomUUID() to a ternary operator which will check if window.crypto.randomUUID exists and if so use it, if not fall back to void 0 (undefined) which will cause the existing 1Password code to fall back to a counter-based ID instead.

Note that this sed statement will not work if the 1Password extension significantly changes, so you may need to modify it. Hopefully if the extension changes it means the maintainers have fixed this bug and we don’t need to do this in the first place!

Step 4: Add the modified extension into Firefox #

In a Firefox tab go to about:debugging#/runtime/this-firefox

Click the Load Temporary Add-on button.

Temporary Addon

Load the addon by pointing to your /[Folder Name]/manifest.json file.

1Password should now offer to autofill on http websites as normal.

All done!!!