Skip to content

Commit 03dfe91

Browse files
committed
bitwarden and 1password integrations: ensure protocol matches
1 parent e232d6d commit 03dfe91

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

js/passwordManager/bitwarden.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ class Bitwarden {
9696

9797
// Loads credential suggestions for given URL.
9898
async loadSuggestions (command, url) {
99-
var domain = new URL(url).hostname
99+
var urlObj = new URL(url)
100100
try {
101-
const process = new ProcessSpawner(command, ['list', 'items', '--url', this.sanitize(domain), '--session', this.sessionKey])
101+
const process = new ProcessSpawner(command, ['list', 'items', '--url', urlObj.protocol + '//' + this.sanitize(urlObj.hostname), '--session', this.sessionKey])
102102
const data = await process.execute()
103103

104104
const matches = JSON.parse(data)

js/passwordManager/onePassword.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ class OnePassword {
140140

141141
// Loads credential suggestions for given URL.
142142
async loadSuggestions (command, url) {
143-
var domain = new URL(url).hostname
143+
var urlObj = new URL(url)
144144
try {
145145
const process = new ProcessSpawner(command, ['item', 'list', '--categories', 'login', '--session=' + this.sessionKey, '--format=json'], { OP_DEVICE: this.deviceID })
146146
const data = await process.executeSyncInAsyncContext()
@@ -149,8 +149,8 @@ class OnePassword {
149149

150150
const credentials = matches.filter((match) => {
151151
try {
152-
var matchHost = new URL(match.urls.find(url => url.primary).href).hostname
153-
return matchHost === domain
152+
var matchHost = new URL(match.urls.find(url => url.primary).href)
153+
return matchHost.hostname === urlObj.hostname && matchHost.protocol === urlObj.protocol
154154
} catch (e) {
155155
return false
156156
}

0 commit comments

Comments
 (0)