File tree Expand file tree Collapse file tree
src/app/pages/FiatOnrampPage Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -63,15 +63,35 @@ test.describe('Fiat on-ramp', () => {
6363 route . fulfill ( {
6464 status : 301 ,
6565 headers : {
66- Location : 'https://example .com/' ,
66+ Location : 'https://phishing-transak .com/' ,
6767 } ,
6868 } ) ,
6969 )
70+ await page . route ( 'https://phishing-transak.com/' , route => route . fulfill ( { body : `phishing` } ) )
7071
7172 await page
7273 . getByText (
7374 'I understand that I’m using a third-party solution and Oasis* does not carry any responsibility over the usage of this solution.' ,
7475 )
7576 . click ( )
7677 } )
78+
79+ test ( 'Sandbox should block top-navigation from iframe and fail' , async ( { page, baseURL } ) => {
80+ test . fail ( )
81+ expect ( baseURL ) . toBe ( 'http://localhost:5000' )
82+ expect ( ( await page . request . head ( '/' ) ) . headers ( ) ) . toHaveProperty ( 'content-security-policy' )
83+ await page . route ( 'https://global.transak.com/*' , route =>
84+ route . fulfill ( {
85+ body : `<script>window.top.location = 'https://phishing-wallet.com/';</script>` ,
86+ } ) ,
87+ )
88+ await page . route ( 'https://phishing-wallet.com/' , route => route . fulfill ( { body : `phishing` } ) )
89+
90+ await page
91+ . getByText (
92+ 'I understand that I’m using a third-party solution and Oasis* does not carry any responsibility over the usage of this solution.' ,
93+ )
94+ . click ( )
95+ await expect ( page ) . toHaveURL ( 'https://phishing-wallet.com/' )
96+ } )
7797} )
Original file line number Diff line number Diff line change @@ -113,7 +113,22 @@ export function FiatOnramp() {
113113 height = "875"
114114 title = "Transak On/Off Ramp Widget"
115115 allow = "camera;microphone;fullscreen;payment"
116- // TODO: maybe restrict top-navigation with sandbox=""
116+ // Restrict top-navigation
117+ sandbox = { [
118+ 'allow-downloads' ,
119+ 'allow-forms' ,
120+ 'allow-modals' ,
121+ 'allow-orientation-lock' ,
122+ 'allow-pointer-lock' ,
123+ 'allow-popups' ,
124+ 'allow-popups-to-escape-sandbox' ,
125+ 'allow-presentation' ,
126+ 'allow-same-origin' ,
127+ 'allow-scripts' ,
128+ // 'allow-storage-access-by-user-activation',
129+ // 'allow-top-navigation',
130+ // 'allow-top-navigation-by-user-activation',
131+ ] . join ( ' ' ) }
117132 src = { `${ process . env . REACT_APP_TRANSAK_URL } /?${ new URLSearchParams ( {
118133 // https://docs.transak.com/docs/query-parameters
119134 apiKey : process . env . REACT_APP_TRANSAK_PARTNER_ID ,
You can’t perform that action at this time.
0 commit comments