diff --git a/src/background/analysis/analyze.js b/src/background/analysis/analyze.js index 8e7d885c..3f7df8f3 100644 --- a/src/background/analysis/analyze.js +++ b/src/background/analysis/analyze.js @@ -202,11 +202,11 @@ async function analyze(request, userData) { const parent = tagParent(reqUrl); // push the job to the Queue (will add the evidence for one HTTP request at a time) - evidenceQ.push(function (cb) { + evidenceQ.push(async function (cb) { //@ts-ignore cb( undefined, - addToEvidenceStore( + await addToEvidenceStore( allEvidence, parent, rootUrl, diff --git a/src/background/analysis/buildUserData/structuredRoutines.js b/src/background/analysis/buildUserData/structuredRoutines.js index 5d076cbe..02e75095 100644 --- a/src/background/analysis/buildUserData/structuredRoutines.js +++ b/src/background/analysis/buildUserData/structuredRoutines.js @@ -135,11 +135,7 @@ export function buildGeneralRegex(genString) { for (let i = 0; i < genString.length; i++) { const c = genString.charAt(i); // add digits regularly - if ( - (c >= "0" && c <= "9") || - (c >= "A" && c <= "Z") || - (c >= "a" && c <= "z") - ) { + if (new RegExp(/[\p{L}\p{N}]/, "u").test(c)){ regexString.push(c); } // optional non-digit otherwise diff --git a/src/background/analysis/interactDB/addEvidence.js b/src/background/analysis/interactDB/addEvidence.js index 23e27045..86001cd1 100644 --- a/src/background/analysis/interactDB/addEvidence.js +++ b/src/background/analysis/interactDB/addEvidence.js @@ -107,7 +107,7 @@ function updateFetchedDict(evidenceDict, e) { * @param {string|undefined} parent Parent company of the request Url, if possible * @param {string} rootU The rootUrl of the request * @param {string} requestU The requestUrl of the request - * @returns {Promise} Side effects only + * @returns {Promise} Side effects only * */ diff --git a/src/background/analysis/requestAnalysis/scanHTTP.js b/src/background/analysis/requestAnalysis/scanHTTP.js index bfafddcf..71dd2d8b 100644 --- a/src/background/analysis/requestAnalysis/scanHTTP.js +++ b/src/background/analysis/requestAnalysis/scanHTTP.js @@ -46,6 +46,13 @@ export function getAllEvidenceForRequest(request, userData) { "requestBody", "responseData", ]); + request.reqUrl = decodeURI(request.reqUrl); + const decodedStrReq = JSON.stringify(request, [ + "reqUrl", + "requestBody", + "responseData", + ]); + //console.log(strRequest); /** * @type {Evidence[]|any[]} @@ -126,7 +133,7 @@ export function getAllEvidenceForRequest(request, userData) { watchlistDict[typeEnum.userKeyword].forEach((keyword) => { executeAndPush( regexSearch( - strRequest, + decodedStrReq, keyword, rootUrl, reqUrl, diff --git a/src/libs/indexed-db/settings/index.js b/src/libs/indexed-db/settings/index.js index 8a2000c9..09aff342 100644 --- a/src/libs/indexed-db/settings/index.js +++ b/src/libs/indexed-db/settings/index.js @@ -43,7 +43,7 @@ export const setDefaultSettings = async () => { browser.tabs.create({ url: browser.runtime.getURL("options.html") }); } - loadModel(); + await loadModel(); } /**