Skip to content

Commit

Permalink
Change expectedAction string to expectBlock boolean
Browse files Browse the repository at this point in the history
  • Loading branch information
not-a-rootkit committed Jan 17, 2025
1 parent 96e74f9 commit 3293de5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
6 changes: 3 additions & 3 deletions malicious-site-protection/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Test suite specific fields:

- `featureName` - string - name of the privacy feature as defined in the config
- `siteURL` - string - the URL of the site we are testing protections for
- `expectedAction` - string - `"block"` or `"allow"`
- `expectBlock` - bool - true if expected to be blocked, false otherwise

## Pseudo-code implementation

Expand All @@ -30,11 +30,11 @@ for $testSet in test.json
if $test.exceptPlatforms includes 'current-platform'
skip
$action = loadSiteInWebView(
$blocked = MaliciousSiteDetector.evaluate(
url=$test.siteURL,
)
expect($action === $test.expectedAction)
expect($blocked === $test.expectBlock)
```

## Platform exceptions
Expand Down
28 changes: 14 additions & 14 deletions malicious-site-protection/tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{
"name": "phishing wildcard regex test",
"siteURL": "https://malicious.example.com/all/paths/should/match/phishing",
"expectedAction": "block",
"expectBlock": true,
"exceptPlatforms": [
"web-extension",
"safari-extension"
Expand All @@ -15,7 +15,7 @@
{
"name": "phishing wildcard regex test 2",
"siteURL": "https://malicious.example.com/all/other/paths/should/match/phishing/too",
"expectedAction": "block",
"expectBlock": true,
"exceptPlatforms": [
"web-extension",
"safari-extension"
Expand All @@ -24,7 +24,7 @@
{
"name": "multiple path phishing match",
"siteURL": "https://phishing-site.com/download/transaction/safety/check",
"expectedAction": "block",
"expectBlock": true,
"exceptPlatforms": [
"web-extension",
"safari-extension"
Expand All @@ -33,7 +33,7 @@
{
"name": "multiple subdomain phishing match",
"siteURL": "https://stealing.your.data.co.uk/loading/login/connect/alert/download/information/your/transaction",
"expectedAction": "block",
"expectBlock": true,
"exceptPlatforms": [
"web-extension",
"safari-extension"
Expand All @@ -42,7 +42,7 @@
{
"name": "phishing wildcard and subdomain regex test",
"siteURL": "https://impersonating-gov-uk.co.uk/login/protect/account/account/data/account/urgent/service/install/support",
"expectedAction": "block",
"expectBlock": true,
"exceptPlatforms": [
"web-extension",
"safari-extension"
Expand All @@ -51,7 +51,7 @@
{
"name": "exclusively not in phishing dataset",
"siteURL": "https://not-in-dataset.com/anything.html",
"expectedAction": "allow",
"expectBlock": false,
"exceptPlatforms": [
"web-extension",
"safari-extension"
Expand All @@ -60,7 +60,7 @@
{
"name": "hash match in malware dataset, but not regex",
"siteURL": "https://impersonating-gov-uk.co.uk/path/not/in/dataset",
"expectedAction": "allow",
"expectBlock": false,
"exceptPlatforms": [
"web-extension",
"safari-extension"
Expand All @@ -75,7 +75,7 @@
{
"name": "malware wildcard regex test",
"siteURL": "https://drive-by-attack.com/anything.html",
"expectedAction": "block",
"expectBlock": true,
"exceptPlatforms": [
"web-extension",
"safari-extension"
Expand All @@ -84,7 +84,7 @@
{
"name": "malware wildcard regex test 2",
"siteURL": "https://drive-by-attack.com/anything/else/should/match/too",
"expectedAction": "block",
"expectBlock": true,
"exceptPlatforms": [
"web-extension",
"safari-extension"
Expand All @@ -93,7 +93,7 @@
{
"name": "multiple path malware match",
"siteURL": "https://malicious.example.com/login/safe/urgent/notification",
"expectedAction": "block",
"expectBlock": true,
"exceptPlatforms": [
"web-extension",
"safari-extension"
Expand All @@ -102,7 +102,7 @@
{
"name": "multiple subdomain malware match",
"siteURL": "https://stealing.your.data.co.uk/loading/login/connect/alert/download/information/your/transaction",
"expectedAction": "block",
"expectBlock": true,
"exceptPlatforms": [
"web-extension",
"safari-extension"
Expand All @@ -111,7 +111,7 @@
{
"name": "malware wildcard and subdomain regex test",
"siteURL": "https://danger.malware.distribution.com/support/confirm/safety/login/notification/password/password/information/information",
"expectedAction": "block",
"expectBlock": true,
"exceptPlatforms": [
"web-extension",
"safari-extension"
Expand All @@ -120,7 +120,7 @@
{
"name": "exclusively not in malware dataset",
"siteURL": "https://not-in-dataset.com/anything.html",
"expectedAction": "allow",
"expectBlock": false,
"exceptPlatforms": [
"web-extension",
"safari-extension"
Expand All @@ -129,7 +129,7 @@
{
"name": "hash match in malware dataset, but not regex",
"siteURL": "https://danger.malware.distribution.com/path/not/in/dataset",
"expectedAction": "allow",
"expectBlock": false,
"exceptPlatforms": [
"web-extension",
"safari-extension"
Expand Down

0 comments on commit 3293de5

Please sign in to comment.