Skip to content

Commit 1da1a70

Browse files
feat: add trust signals to permission picker (#275)
* Add dappscanning to wallet_requestExecutionPermissions requests - trigger request to dapp scanning api when processing a permission request - show the result if it is WARN or BLOCK * Refactor trustSignal in permissionHandlerContent.tsx Fix tests * feat: add i18n support for malicious website labels (#276) Add translation keys for malicious and potentially malicious website labels: - maliciousWebsiteLabel: 'Malicious website' (English) - potentiallyMaliciousWebsiteLabel: 'Potentially malicious website' (English) Updated all locale files with these keys. Non-English translations are left empty for future translation work. Refs #275 Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: jeffsmale90 <jeffsmale90@users.noreply.github.com> * TrustSignalsClient only resolves a recommended action if 'isComplete'. Defaults to 'NONE' if no legitimate result is found. * Calls to updateConfirmation should queue and wait for previous calls to finish to avoid overwriting data * Rename 'trust signals api' to 'dapp scanning api' * Add security scanning api * Also show alerts for scanned "from" address * Refactor and simplify - fields with warnings - permissionRequestLifecycleOrchestrator's updateConfirmation function - fix tests * Ensure that address scanning results with label as empty string coalesce to the standard label * Pass new environment variables to GH actions --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: jeffsmale90 <jeffsmale90@users.noreply.github.com>
1 parent 00042e8 commit 1da1a70

33 files changed

+1515
-38
lines changed

.github/workflows/build-lint-test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ env:
1212
TOKENS_API_BASE_URL: ${{ vars.TOKENS_API_BASE_URL }}
1313
GATOR_PERMISSIONS_PROVIDER_SNAP_ID: ${{ vars.GATOR_PERMISSIONS_PROVIDER_SNAP_ID }}
1414
KERNEL_SNAP_ID: ${{ vars.KERNEL_SNAP_ID }}
15+
DAPP_SCANNING_BASE_URL: ${{ vars.DAPP_SCANNING_BASE_URL }}
16+
SECURITY_ALERTS_BASE_URL: ${{ vars.SECURITY_ALERTS_BASE_URL }}
1517

1618
jobs:
1719
prepare:

.github/workflows/publish-release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ env:
1616
TOKENS_API_BASE_URL: ${{ vars.TOKENS_API_BASE_URL }}
1717
GATOR_PERMISSIONS_PROVIDER_SNAP_ID: ${{ vars.GATOR_PERMISSIONS_PROVIDER_SNAP_ID }}
1818
KERNEL_SNAP_ID: ${{ vars.KERNEL_SNAP_ID }}
19+
DAPP_SCANNING_BASE_URL: ${{ vars.DAPP_SCANNING_BASE_URL }}
20+
SECURITY_ALERTS_BASE_URL: ${{ vars.SECURITY_ALERTS_BASE_URL }}
1921

2022
jobs:
2123
publish-release:

packages/gator-permissions-snap/.env.example

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ SNAP_ENV=local
66
# The base URL for the price API used to fetch realtime token spot prices.
77
PRICE_API_BASE_URL=https://price.dev-api.cx.metamask.io
88

9+
# The base URL for the dapp scanning API (e.g. domain reputation / phishing scan).
10+
DAPP_SCANNING_BASE_URL=https://dapp-scanning.example.com
11+
12+
# The base URL for the security alerts API (address scan).
13+
SECURITY_ALERTS_BASE_URL=https://security-alerts.api.cx.metamask.io
14+
915
# Set `STORE_PERMISSIONS_ENABLED=true` to enable profile sync storage features. This is needed when testing something related to storage otherwise leave `STORE_PERMISSIONS_ENABLED=false`
1016
STORE_PERMISSIONS_ENABLED=false
1117

packages/gator-permissions-snap/locales/de.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,18 @@
228228
},
229229
"introGotItButton": {
230230
"message": "Verstanden"
231+
},
232+
"maliciousWebsiteLabel": {
233+
"message": ""
234+
},
235+
"potentiallyMaliciousWebsiteLabel": {
236+
"message": ""
237+
},
238+
"maliciousAddressLabel": {
239+
"message": ""
240+
},
241+
"potentiallyMaliciousAddressLabel": {
242+
"message": ""
231243
}
232244
}
233245
}

packages/gator-permissions-snap/locales/el.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,18 @@
228228
},
229229
"introGotItButton": {
230230
"message": ""
231+
},
232+
"maliciousWebsiteLabel": {
233+
"message": ""
234+
},
235+
"potentiallyMaliciousWebsiteLabel": {
236+
"message": ""
237+
},
238+
"maliciousAddressLabel": {
239+
"message": ""
240+
},
241+
"potentiallyMaliciousAddressLabel": {
242+
"message": ""
231243
}
232244
}
233245
}

packages/gator-permissions-snap/locales/en.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,18 @@
228228
},
229229
"introGotItButton": {
230230
"message": "Got it"
231+
},
232+
"maliciousWebsiteLabel": {
233+
"message": "Malicious website"
234+
},
235+
"potentiallyMaliciousWebsiteLabel": {
236+
"message": "Potentially malicious website"
237+
},
238+
"maliciousAddressLabel": {
239+
"message": "Malicious address"
240+
},
241+
"potentiallyMaliciousAddressLabel": {
242+
"message": "Potentially malicious address"
231243
}
232244
}
233245
}

packages/gator-permissions-snap/locales/es_419.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,18 @@
228228
},
229229
"introGotItButton": {
230230
"message": "Entendido"
231+
},
232+
"maliciousWebsiteLabel": {
233+
"message": ""
234+
},
235+
"potentiallyMaliciousWebsiteLabel": {
236+
"message": ""
237+
},
238+
"maliciousAddressLabel": {
239+
"message": ""
240+
},
241+
"potentiallyMaliciousAddressLabel": {
242+
"message": ""
231243
}
232244
}
233245
}

packages/gator-permissions-snap/locales/fr.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,18 @@
228228
},
229229
"introGotItButton": {
230230
"message": ""
231+
},
232+
"maliciousWebsiteLabel": {
233+
"message": ""
234+
},
235+
"potentiallyMaliciousWebsiteLabel": {
236+
"message": ""
237+
},
238+
"maliciousAddressLabel": {
239+
"message": ""
240+
},
241+
"potentiallyMaliciousAddressLabel": {
242+
"message": ""
231243
}
232244
}
233245
}

packages/gator-permissions-snap/locales/hi.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,18 @@
228228
},
229229
"introGotItButton": {
230230
"message": ""
231+
},
232+
"maliciousWebsiteLabel": {
233+
"message": ""
234+
},
235+
"potentiallyMaliciousWebsiteLabel": {
236+
"message": ""
237+
},
238+
"maliciousAddressLabel": {
239+
"message": ""
240+
},
241+
"potentiallyMaliciousAddressLabel": {
242+
"message": ""
231243
}
232244
}
233245
}

packages/gator-permissions-snap/locales/id.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,18 @@
228228
},
229229
"introGotItButton": {
230230
"message": ""
231+
},
232+
"maliciousWebsiteLabel": {
233+
"message": ""
234+
},
235+
"potentiallyMaliciousWebsiteLabel": {
236+
"message": ""
237+
},
238+
"maliciousAddressLabel": {
239+
"message": ""
240+
},
241+
"potentiallyMaliciousAddressLabel": {
242+
"message": ""
231243
}
232244
}
233245
}

0 commit comments

Comments
 (0)