mirror of
https://github.com/keepassxreboot/keepassxc-browser.git
synced 2026-03-11 08:54:43 +00:00
Prevent retrieving credentials from background tabs
This commit is contained in:
parent
f4ae11b277
commit
5406d76a06
1 changed files with 10 additions and 2 deletions
|
|
@ -196,17 +196,25 @@ page.createTabEntry = function(tabId) {
|
|||
// Page reload or tab switch clears the cache.
|
||||
// If the retrieval is forced (from Credential Banner), get new credentials normally.
|
||||
page.retrieveCredentials = async function(tab, args = []) {
|
||||
if (!tab?.active) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const [ url, submitUrl, force ] = args;
|
||||
if (page.tabs[tab.id]?.credentials.length > 0 && !force) {
|
||||
return page.tabs[tab.id].credentials;
|
||||
}
|
||||
|
||||
// Ignore duplicate requests
|
||||
if (page.currentRequest.url === url && page.currentRequest.submitUrl === submitUrl && !force) {
|
||||
// Ignore duplicate requests from the same tab
|
||||
if (page.currentRequest.url === url
|
||||
&& page.currentRequest.submitUrl === submitUrl
|
||||
&& page.currentRequest.tabId === tab.id
|
||||
&& !force) {
|
||||
return [];
|
||||
} else {
|
||||
page.currentRequest.url = url;
|
||||
page.currentRequest.submitUrl = submitUrl;
|
||||
page.currentRequest.tabId = tab.id;
|
||||
}
|
||||
|
||||
const credentials = await keepass.retrieveCredentials(tab, args);
|
||||
|
|
|
|||
Loading…
Reference in a new issue