Remove debugger permissions (#226)
This commit is contained in:
@@ -281,8 +281,7 @@ In order to remove all metadata, use the "Clear usage data" button in the extens
|
|||||||
Browserpass extension requests the following permissions:
|
Browserpass extension requests the following permissions:
|
||||||
|
|
||||||
| Name | Reason |
|
| Name | Reason |
|
||||||
| -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
| -------------------- | ---------------------------------------------------------------------------------------------------------------- |
|
||||||
| `debugger` | Only used for "auto-submit" functionality: if all attepts to locate a "Submit" button failed, Browserpass will put focus inside the login form and issue an <kbd>Enter</kbd> keypress. This is only available in Chromium-based browsers, and sadly this permission [cannot be specified as optional](https://developer.chrome.com/apps/permissions) |
|
|
||||||
| `activeTab` | To get URL of the current tab, used for example to determine which passwords to show you by default in the popup |
|
| `activeTab` | To get URL of the current tab, used for example to determine which passwords to show you by default in the popup |
|
||||||
| `alarms` | To set a timer for clearing the clipboard 60 seconds after credentials are copied |
|
| `alarms` | To set a timer for clearing the clipboard 60 seconds after credentials are copied |
|
||||||
| `tabs` | To get URL of a given tab, used for example to set count of the matching passwords for a given tab |
|
| `tabs` | To get URL of a given tab, used for example to set count of the matching passwords for a given tab |
|
||||||
|
@@ -316,36 +316,10 @@ async function dispatchFocusOrSubmit(settings, request, allFrames, allowForeign)
|
|||||||
foreignFills: settings.foreignFills[settings.origin] || {},
|
foreignFills: settings.foreignFills[settings.origin] || {},
|
||||||
});
|
});
|
||||||
|
|
||||||
let perFrameResults = await chrome.tabs.executeScript(settings.tab.id, {
|
await chrome.tabs.executeScript(settings.tab.id, {
|
||||||
allFrames: allFrames,
|
allFrames: allFrames,
|
||||||
code: `window.browserpass.focusOrSubmit(${JSON.stringify(request)});`,
|
code: `window.browserpass.focusOrSubmit(${JSON.stringify(request)});`,
|
||||||
});
|
});
|
||||||
|
|
||||||
// if necessary, dispatch Enter keypress to autosubmit the form
|
|
||||||
// currently only works on Chromium and requires debugger permission
|
|
||||||
try {
|
|
||||||
for (let frame of perFrameResults) {
|
|
||||||
if (frame.needPressEnter) {
|
|
||||||
chrome.debugger.attach({ tabId: settings.tab.id }, "1.2");
|
|
||||||
for (let type of ["keyDown", "char", "keyUp"]) {
|
|
||||||
chrome.debugger.sendCommand(
|
|
||||||
{ tabId: settings.tab.id },
|
|
||||||
"Input.dispatchKeyEvent",
|
|
||||||
{
|
|
||||||
type: type,
|
|
||||||
key: "Enter",
|
|
||||||
windowsVirtualKeyCode: 13,
|
|
||||||
nativeVirtualKeyCode: 13,
|
|
||||||
unmodifiedText: "\r",
|
|
||||||
text: "\r",
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
chrome.debugger.detach({ tabId: settings.tab.id });
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (e) {}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -220,9 +220,7 @@
|
|||||||
* @return object result of focusing or submitting a form
|
* @return object result of focusing or submitting a form
|
||||||
*/
|
*/
|
||||||
function focusOrSubmit(request) {
|
function focusOrSubmit(request) {
|
||||||
var result = {
|
var result = {};
|
||||||
needPressEnter: false,
|
|
||||||
};
|
|
||||||
|
|
||||||
// get the login form
|
// get the login form
|
||||||
let loginForm = undefined;
|
let loginForm = undefined;
|
||||||
@@ -258,11 +256,6 @@
|
|||||||
submit.focus();
|
submit.focus();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// There is no submit button.
|
|
||||||
if (request.autoSubmit) {
|
|
||||||
// signal background script that we want it to press Enter for us
|
|
||||||
result.needPressEnter = true;
|
|
||||||
}
|
|
||||||
// We need to keep focus somewhere within the form, so that Enter hopefully submits the form.
|
// We need to keep focus somewhere within the form, so that Enter hopefully submits the form.
|
||||||
for (let selectors of [OPENID_FIELDS, PASSWORD_FIELDS, USERNAME_FIELDS]) {
|
for (let selectors of [OPENID_FIELDS, PASSWORD_FIELDS, USERNAME_FIELDS]) {
|
||||||
let field = find(selectors, loginForm);
|
let field = find(selectors, loginForm);
|
||||||
|
@@ -27,7 +27,6 @@
|
|||||||
"open_in_tab": false
|
"open_in_tab": false
|
||||||
},
|
},
|
||||||
"permissions": [
|
"permissions": [
|
||||||
"debugger",
|
|
||||||
"activeTab",
|
"activeTab",
|
||||||
"alarms",
|
"alarms",
|
||||||
"tabs",
|
"tabs",
|
||||||
|
Reference in New Issue
Block a user