Skip to content

fix(respondable): avoid crashes if the data in window.postMessage is null#3249

Merged
straker merged 2 commits intodequelabs:developfrom
esanzgar:postMessag-null
Nov 12, 2021
Merged

fix(respondable): avoid crashes if the data in window.postMessage is null#3249
straker merged 2 commits intodequelabs:developfrom
esanzgar:postMessag-null

Conversation

@esanzgar
Copy link
Copy Markdown
Contributor

@esanzgar esanzgar commented Nov 2, 2021

axe-core crashes if another process sends a window.postMessage with
data equals to null.

In the previous version, because null has a type of 'object', it
crashed when trying to access the channelId.

This change detects first if the data is not null.

@esanzgar esanzgar requested a review from a team as a code owner November 2, 2021 10:39
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Nov 2, 2021

CLA assistant check
All committers have signed the CLA.

straker
straker previously requested changes Nov 4, 2021
Copy link
Copy Markdown
Contributor

@straker straker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the pr. Could you add a test for this case in the respondable test? Probably after the repeater test

axe-core crashes if another process sends a `window.postMessage` with
data equals to `null`.

In the previous version, because `null` has a type of `'object'`, it
crashed when trying to access the `channelId` on `null`.
@esanzgar
Copy link
Copy Markdown
Contributor Author

esanzgar commented Nov 9, 2021

I added the test. I am not very familiar with the internals with axe-core, so I am afraid you will need to take it from there.

@straker straker dismissed their stale review November 11, 2021 16:59

Resolved

@straker
Copy link
Copy Markdown
Contributor

straker commented Nov 12, 2021

Reviewed for security

@straker straker changed the title Avoid crashes if the data in window.postMessage is null fix(respondable): avoid crashes if the data in window.postMessage is null Nov 12, 2021
@straker straker merged commit b37b2f6 into dequelabs:develop Nov 12, 2021
@esanzgar esanzgar deleted the postMessag-null branch November 15, 2021 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants