work on prompt() solution

This commit is contained in:
Kevin F 2021-10-12 18:36:09 +00:00
parent b84a28f062
commit bd81c3c582
4 changed files with 27 additions and 11 deletions

View File

@ -12,7 +12,7 @@ There are spy libraries that can determine how long keys are held down and the t
This addon was created to skew the key press timing by limiting the speed of presses. The speed is changed randomly on each page load, with a min of 150ms and a max of 300ms. This addon was created to skew the key press timing by limiting the speed of presses. The speed is changed randomly on each page load, with a min of 150ms and a max of 300ms.
It uses a less than ideal thread locking solution, as simply buffering text does not stop event listeners from spies. It uses a less than ideal thread locking solution, as simply buffering text does not stop event listeners from spies. **Now it also has a non-default setting to use prompt() on non-password single line input elements. This reduces CPU usage and increase typing speed while offering better protection than the delay approach.**
You can whitelist domains that you trust on the addon settings page, but it was decided not to support changing the key speed manually as that would add another fingerprinting avenue. You can whitelist domains that you trust on the addon settings page, but it was decided not to support changing the key speed manually as that would add another fingerprinting avenue.

View File

@ -19,6 +19,13 @@
const defaultHosts = "<all_urls>"; const defaultHosts = "<all_urls>";
let appCode = function (){ let appCode = function (){
let popupEnabled = false
let popupGetter = browser.storage.sync.get("keyboardprivacyprompt")
popupGetter.then(function(val){
popupEnabled = val['keyboardprivacyprompt']
console.debug(popupEnabled)
}, function(){})
let clearSelect = function() let clearSelect = function()
{ {
if (window.getSelection) {window.getSelection().removeAllRanges()} if (window.getSelection) {window.getSelection().removeAllRanges()}
@ -45,13 +52,10 @@ let appCode = function (){
if (! inputType){ if (! inputType){
text = prompt("[PrivateKeyboard]\n\nEnter text for the text field:", e.target.value) text = prompt("[PrivateKeyboard]\n\nEnter text for the text field:", e.target.value)
} }
else if (! ["text", "search", "email", "password", "number"].includes(inputType.toLowerCase())){ else if (! ["text", "search", "email", "number"].includes(inputType.toLowerCase())){
return return
} }
else{ else{
if (inputType == "password"){
inputType = "password (SHOWN IN PLAIN TEXT)"
}
text = prompt("[PrivateKeyboard]\n\nEnter text for the " + inputType + " field:", e.target.value) text = prompt("[PrivateKeyboard]\n\nEnter text for the " + inputType + " field:", e.target.value)
} }
if (text !== null) { if (text !== null) {
@ -66,8 +70,9 @@ let appCode = function (){
let popupMode = function(){ let popupMode = function(){
if (popupEnabled){
document.addEventListener('focusin', doPopup, true) document.addEventListener('focusin', doPopup, true)
}
} }
@ -124,11 +129,12 @@ let appCode = function (){
return true; return true;
} }
else{ else{
console.debug(e.key)
} }
setTimeout( if (popupEnabled){
function(){doPopup(e)}, 10) setTimeout(
function(){doPopup(e)}, 10)
}
pausecomp(down); pausecomp(down);
return true; return true;

View File

@ -10,7 +10,7 @@
<form> <form>
<input type="checkbox" id="usePrompt"> <input type="checkbox" id="usePrompt">
<label for="usePrompt">Use prompt() dialogs on single-line inputs. This option will reveal typed passwords and may break some websites, but allows for faster typing and less CPU usage.</label> <label for="usePrompt">Use prompt() dialogs on single-line inputs. Faster typing and less CPU usage, but can break some websites and features like autocomplete.</label>
<br> <br>
<input type="checkbox" id="whitelistLAN"> <input type="checkbox" id="whitelistLAN">
<label for="whitelistLAN">Whitelist private IP + localhost range hostnames (e.g. routers)</label> <label for="whitelistLAN">Whitelist private IP + localhost range hostnames (e.g. routers)</label>

View File

@ -24,6 +24,9 @@ function saveOptions(e) {
browser.storage.sync.set({ browser.storage.sync.set({
keyboardprivacylan: document.querySelector("#whitelistLAN").checked keyboardprivacylan: document.querySelector("#whitelistLAN").checked
}) })
browser.storage.sync.set({
keyboardprivacyprompt: document.querySelector("#usePrompt").checked
})
document.getElementById('saved').innerHTML = '<br><b>Saved</b>' document.getElementById('saved').innerHTML = '<br><b>Saved</b>'
setTimeout(function(){ setTimeout(function(){
document.getElementById('saved').innerHTML = '<br>' document.getElementById('saved').innerHTML = '<br>'
@ -42,6 +45,10 @@ function saveOptions(e) {
document.querySelector("#whitelistLAN").checked = result['keyboardprivacylan'] document.querySelector("#whitelistLAN").checked = result['keyboardprivacylan']
} }
function setCurrentPrompt(result){
document.querySelector("#usePrompt").checked = result['keyboardprivacyprompt']
}
function onError(error) { function onError(error) {
console.log(`Error: ${error}`); console.log(`Error: ${error}`);
} }
@ -51,6 +58,9 @@ function saveOptions(e) {
let gettingLAN = browser.storage.sync.get("keyboardprivacylan"); let gettingLAN = browser.storage.sync.get("keyboardprivacylan");
gettingLAN.then(setCurrentLAN, onError); gettingLAN.then(setCurrentLAN, onError);
let gettingPrompt = browser.storage.sync.get("keyboardprivacyprompt");
gettingPrompt.then(setCurrentPrompt, onError);
} }
document.addEventListener("DOMContentLoaded", restoreOptions); document.addEventListener("DOMContentLoaded", restoreOptions);