logoESLint React
Rules

no-missing-iframe-sandbox

Enforces an explicit 'sandbox' attribute for 'iframe' elements.

Full Name in eslint-plugin-react-dom

react-dom/no-missing-iframe-sandbox

Full Name in @eslint-react/eslint-plugin

@eslint-react/dom-no-missing-iframe-sandbox

Features

🔧

Presets

strict strict-typescript strict-type-checked

Rule Details

The sandbox attribute enables an extra set of restrictions for the content in the iframe. Using the sandbox attribute is considered a good security practice.

Common Violations

Invalid

function MyComponent() {
  return <iframe src="https://eslint-react.xyz" />;
  //     ^^^ Missing 'sandbox' attribute on iframe component.
}

Valid

function MyComponent() {
  return <iframe src="https://eslint-react.xyz" sandbox="allow-popups" />;
}

Resources

Further Reading


See Also

On this page