Skip to content
This repository was archived by the owner on Nov 10, 2023. It is now read-only.

Commit 2286fc9

Browse files
authored
feat: Update isValidMessage() check for Safe Apps (#3907)
* Change the way to check if the message is being sent from an iframe * Add separate job for executing e2e tests
1 parent 78e97d1 commit 2286fc9

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

.github/workflows/deploy.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,3 +163,15 @@ jobs:
163163
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
164164
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
165165
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
166+
e2e:
167+
runs-on: ubuntu-20.04
168+
name: E2E on Chrome
169+
needs: deploy
170+
steps:
171+
- uses: actions/checkout@v2
172+
- uses: cypress-io/github-action@v2
173+
with:
174+
spec: cypress/integration/smoke/*.spec.js
175+
browser: chrome
176+
record: false
177+
config: baseUrl=https://pr${{ github.event.number }}--safereact.review-safe.gnosisdev.com/app/

src/routes/safe/components/Apps/communicator.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ class AppCommunicator {
4343
return true
4444
}
4545

46-
// @ts-expect-error .parent doesn't exist on some possible types
47-
const sentFromIframe = msg.source.parent === window.parent
46+
const sentFromIframe = this.iframeRef.current?.contentWindow === msg.source
4847
const knownMethod = Object.values(Methods).includes(msg.data.method)
4948

5049
return sentFromIframe && knownMethod

0 commit comments

Comments
 (0)