Web Security · Middle · Question 75 of 75

What must a message event handler for postMessage check?

window.addEventListener('message', (e) => {
  applySettings(e.data);
});

Explanation

Any window that holds a reference to yours can post messages. Without an origin check, another site can feed data into applySettings.

Further reading

Problem with a question

Web Security · Middle · question 75

Test yourself

Take the Web Security · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz