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-sandboxFull Name in @eslint-react/eslint-plugin
@eslint-react/dom-no-missing-iframe-sandboxFeatures
🔧
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
react-dom/no-missing-button-type
Enforces an explicittypeattribute forbuttonelements.react-dom/no-unsafe-iframe-sandbox
Enforces that thesandboxattribute foriframeelements is not set to unsafe combinations.