From 9b51d1914edbb85d5882fc0764ed41fb513c18f0 Mon Sep 17 00:00:00 2001 From: Ben Moon Date: Wed, 8 Nov 2023 10:46:10 +0000 Subject: [PATCH] Add tests for expecting ignore unknown surrogates --- .../domain_matching_tests.json | 56 ++++++++++++++ .../tracker_radar_reference.json | 76 ++++++++++++++++++- 2 files changed, 130 insertions(+), 2 deletions(-) diff --git a/tracker-radar-tests/TR-domain-matching/domain_matching_tests.json b/tracker-radar-tests/TR-domain-matching/domain_matching_tests.json index 15dd4f6..5c9c3de 100644 --- a/tracker-radar-tests/TR-domain-matching/domain_matching_tests.json +++ b/tracker-radar-tests/TR-domain-matching/domain_matching_tests.json @@ -1070,6 +1070,62 @@ "expectAction": "redirect", "expectRedirect": "data:application/javascript;base64,KGZ1bmN0aW9uKCkge3dpbmRvdy5zdXJyb2dhdGUxPXRydWV9KSgpOw==", "expectExpression": "window.surrogate1 === true" + }, + { + "name": "Encountering unknown surrogate with default:block should ignore", + "siteURL": "https://example.com", + "requestURL": "https://unknownsurrogates1.test/request1", + "requestType": "script", + "expectAction": "ignore" + }, + { + "name": "Encountering unknown surrogate with default:ignore should ignore", + "siteURL": "https://example.com", + "requestURL": "https://unknownsurrogates2.test/request1", + "requestType": "script", + "expectAction": "ignore" + }, + { + "name": "Encountering unknown surrogate with default:block and failing options check, should block", + "siteURL": "https://example.com", + "requestURL": "https://unknownsurrogates1.test/request2", + "requestType": "script", + "expectAction": "block" + }, + { + "name": "Encountering unknown surrogate with default:block and successful options check, should ignore", + "siteURL": "https://selectedsite1.com", + "requestURL": "https://unknownsurrogates1.test/request2", + "requestType": "script", + "expectAction": "ignore" + }, + { + "name": "Encountering unknown surrogate with default:ignore and failing options check, should ignore", + "siteURL": "https://example.com", + "requestURL": "https://unknownsurrogates2.test/request2", + "requestType": "script", + "expectAction": "ignore" + }, + { + "name": "Encountering unknown surrogate with default:ignore and successful options check, should ignore", + "siteURL": "https://selectedsite1.com", + "requestURL": "https://unknownsurrogates2.test/request2", + "requestType": "script", + "expectAction": "ignore" + }, + { + "name": "Encountering unknown surrogate with exemption (default:block) should ignore", + "siteURL": "https://exemptedsite1.com", + "requestURL": "https://unknownsurrogates1.test/request1", + "requestType": "script", + "expectAction": "ignore" + }, + { + "name": "Encountering unknown surrogate with exemption (default:ignore) should ignore", + "siteURL": "https://exemptedsite1.com", + "requestURL": "https://unknownsurrogates2.test/request1", + "requestType": "script", + "expectAction": "ignore" } ] } diff --git a/tracker-radar-tests/TR-domain-matching/tracker_radar_reference.json b/tracker-radar-tests/TR-domain-matching/tracker_radar_reference.json index 655da06..ebe4516 100644 --- a/tracker-radar-tests/TR-domain-matching/tracker_radar_reference.json +++ b/tracker-radar-tests/TR-domain-matching/tracker_radar_reference.json @@ -745,6 +745,74 @@ ], "default": "block" }, + "unknownsurrogates1.test": { + "domain": "unknownsurrogates1.test", + "owner": { + "name": "Test Site for Surrogates", + "displayName": "Surrogates Site", + "privacyPolicy": "", + "url": "http://blockedsurrogates.test" + }, + "prevalence": 0.1, + "fingerprinting": 3, + "cookies": 0.1, + "categories": [], + "rules": [ + { + "rule": "unknownsurrogates1\\.test/request1", + "surrogate": "unknownsurrogate1", + "exceptions": { + "domains": [ + "exemptedsite1.com" + ] + } + }, + { + "rule": "unknownsurrogates1\\.test/request2", + "surrogate": "unknownsurrogate1", + "options": { + "domains": [ + "selectedsite1.com" + ] + } + } + ], + "default": "block" + }, + "unknownsurrogates2.test": { + "domain": "unknownsurrogates2.test", + "owner": { + "name": "Test Site for Surrogates", + "displayName": "Surrogates Site", + "privacyPolicy": "", + "url": "http://blockedsurrogates.test" + }, + "prevalence": 0.1, + "fingerprinting": 3, + "cookies": 0.1, + "categories": [], + "rules": [ + { + "rule": "unknownsurrogates2\\.test/request1", + "surrogate": "unknownsurrogate2", + "exceptions": { + "domains": [ + "exemptedsite1.com" + ] + } + }, + { + "rule": "unknownsurrogates2\\.test/request2", + "surrogate": "unknownsurrogate2", + "options": { + "domains": [ + "selectedsite1.com" + ] + } + } + ], + "default": "ignore" + }, "format.test": { "domain": "format.test", "owner": { @@ -861,7 +929,9 @@ "domains": [ "other-surrogates.test", "surrogates.test", - "blockedsurrogates.test" + "blockedsurrogates.test", + "unknownsurrogates1.test", + "unknownsurrogates2.test" ], "prevalence": 0.1, "displayName": "Test Site for Surrogates" @@ -896,6 +966,8 @@ "sub.ignore.test": "Ignore Site for Tracker Blocking", "surrogates.test": "Test Site for Surrogates", "other-surrogates.test": "Test Site for Surrogates", - "blockedsurrogates.test": "Test Site for Surrogates" + "blockedsurrogates.test": "Test Site for Surrogates", + "unknownsurrogates1.test": "Test Site for Surrogates", + "unknownsurrogates2.test": "Test Site for Surrogates" } }