Web Security · Senior · Question 24 of 75

What does a resource isolation policy based on Fetch Metadata do?

if (req.headers['sec-fetch-site'] === 'cross-site' &&
    !(req.headers['sec-fetch-mode'] === 'navigate' && req.method === 'GET')) {
  return res.status(403).end();
}

Explanation

Endpoints meant to be embedded or called cross-site (public APIs, images for other sites) need explicit exceptions.

Further reading

Problem with a question

Web Security · Senior · question 24

Test yourself

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

Take this quiz