-
Notifications
You must be signed in to change notification settings - Fork 428
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: restrict safe pass safe app access for ofac blocked addresses #4066
Conversation
Branch preview✅ Deploy successful! Storybook: |
ESLint Summary View Full Report
Report generated by eslint-plus-action |
📦 Next.js Bundle Analysis for safe-wallet-webThis analysis was generated by the Next.js Bundle Analysis action. 🤖
|
Page | Size (compressed) |
---|---|
global |
961.24 KB (🟡 +12 B) |
Details
The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.
Any third party scripts you have added directly to your app using the <script>
tag are not accounted for in this analysis
If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!
Five Pages Changed Size
The following pages changed size from the code in this PR compared to its base branch:
Page | Size (compressed) | First Load |
---|---|---|
/apps/open |
55.18 KB (🟡 +1.99 KB) |
1016.42 KB |
/balances |
30.94 KB (🟡 +5 B) |
992.18 KB |
/home |
58.24 KB (🟡 +41 B) |
1019.48 KB |
/stake |
597 B (🟢 -5 B) |
961.82 KB |
/swap |
733 B (🟡 +1 B) |
961.96 KB |
Details
Only the gzipped size is provided here based on an expert tip.
First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link
is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.
Any third party scripts you have added directly to your app using the <script>
tag are not accounted for in this analysis
Next to the size is how much the size has increased or decreased compared with the base branch of this PR. If this percentage has increased by 20% or more, there will be a red status indicator applied, indicating that special attention should be given to this.
Coverage report
Show new covered files 🐣
Show files with reduced coverage 🔻
Test suite run success1508 tests passing in 205 suites. Report generated by 🧪jest coverage report action from de491bf |
if (isSafeSanctioned) { | ||
return safeAddress | ||
} | ||
if (isWalletSanctioned) { | ||
return wallet?.address | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data
contains the error message in case the useGetIsSanctionedQuery
throws so I think it would falsely say that an address is sanctioned if the network request fails.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that is not true. The error seems to be transformed and returned in the error
field of useGetIsSanctionedQuery
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is expected to either return a data
or error
field.
https://redux-toolkit.js.org/rtk-query/usage/customizing-queries#implementing-a-queryfn
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we remove the data assignment on error then inside the ofacApi
query?
return { error: { status: 'CUSTOM_ERROR', data: (error as Error).message } }
ESLint Summary View Full Report
Report generated by eslint-plus-action |
@@ -50,6 +50,10 @@ export const isBlockedBridge = (origin: string) => { | |||
return BlockedBridges.some((bridge) => origin.includes(bridge)) | |||
} | |||
|
|||
export const isSafePassApp = (origin: string) => { | |||
return origin.includes('community.safe.global') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we if not avoid hardcode then at least make it a constant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use the constant SAFE_PASS_URL
here?
I think checking blocked addresses from within apps/open and WalletConnect is a bit excessive. It would be better if we just hide all links to this app, and inside the app itself check for blocked addresses (would have to port that hook there). |
You cannot receive the connected wallet within the Safe app. We only get the |
Geoblocking is now in place, so it would be good to hide the header widget if the app cannot be loaded. |
ESLint Summary View Full Report
Report generated by eslint-plus-action |
Should we do this in the scope of this PR? @schmanu |
What this PR changes
How to test it
Screenshots
Open Task
Checklist