Skip to content

Commit 2288e02

Browse files
authored
Fix false positively suspicious google urls (#428)
* Fix false positively suspicious google urls * Add an integration test
1 parent 61a5bf0 commit 2288e02

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

modules/web-discovery-project/sources/web-discovery-project.es

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1732,6 +1732,8 @@ const WebDiscoveryProject = {
17321732
sanitizeUrl(activeURL, {
17331733
testMode: WebDiscoveryProject.testMode,
17341734
}).result !== "safe"
1735+
// For search engine URLs we check if the query is suspicious
1736+
&& !WebDiscoveryProject.isSearchEngineUrl(activeURL)
17351737
) {
17361738
logger.debug("[onLocationChange] isSuspiciousURL", activeURL);
17371739
return;

modules/web-discovery-project/tests/integration/web-discovery-project-test.es

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,22 @@ export default function () {
104104
});
105105
});
106106

107+
describe("web-discovery-project.searchEngineUrl", function () {
108+
const testSearchEngineUrl = "https://google.com/search?q=apple+pie&sca_esv=3204631f57a9e94fc9b15156c2a60e5a&ei=6e19f02b9aade4603fe3bc81768743f6";
109+
110+
it(`${testPrivateUrl} is private`, function () {
111+
WebDiscoveryProject.isAlreadyMarkedPrivate(testPrivateUrl, (e) => {
112+
expect(e.private).to.equal(1);
113+
});
114+
});
115+
116+
it(`${testSearchEngineUrl} is public`, function () {
117+
WebDiscoveryProject.isAlreadyMarkedPrivate(testSearchEngineUrl, (e) => {
118+
expect(e.private).to.equal(0);
119+
});
120+
});
121+
});
122+
107123
describe("web-discovery-project.storage", function () {
108124
it("storage test", function (done) {
109125
WebDiscoveryProject.db.saveRecordTelemetry("unit-test", "test", () => {

0 commit comments

Comments
 (0)