{"record":{"id":"9fa55905aabad1da","repo":"oxc-project/oxc","slug":"an-iframe-element-defines-a-sandbox-attribute-with","errorCode":null,"errorMessage":"An iframe element defines a sandbox attribute with invalid value: {value}","messagePattern":"An iframe element defines a sandbox attribute with invalid value: (.+?)","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/react/iframe_missing_sandbox.rs","lineNumber":27,"sourceCode":"use oxc_macros::declare_oxc_lint;\nuse oxc_span::Span;\n\nuse crate::{\n    AstNode,\n    ast_util::is_method_call,\n    context::LintContext,\n    rule::Rule,\n    utils::{get_prop_value, has_jsx_prop_ignore_case, is_create_element_call},\n};\n\nfn missing_sandbox_prop(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"An iframe element is missing a sandbox attribute\")\n        .with_help(\"Add a `sandbox` attribute to the `iframe` element.\")\n        .with_label(span)\n}\n\nfn invalid_sandbox_prop(span: Span, value: &str) -> OxcDiagnostic {\n    OxcDiagnostic::warn(format!(\"An iframe element defines a sandbox attribute with invalid value: {value}\"))\n        .with_help(\"Check this link for the valid values of `sandbox` attribute: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#sandbox.\")\n        .with_label(span)\n}\n\nfn invalid_sandbox_combination_prop(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"An `iframe` element defines a sandbox attribute with both allow-scripts and allow-same-origin which is invalid\")\n        .with_help(\"Remove `allow-scripts` or `allow-same-origin`.\")\n        .with_label(span)\n}\n\nconst ALLOWED_VALUES: [&str; 14] = [\n    \"downloads-without-user-activation\",\n    \"downloads\",\n    \"forms\",\n    \"modals\",\n    \"orientation-lock\",\n    \"pointer-lock\",\n    \"popups\",","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/react/iframe_missing_sandbox.rs#L9-L45","documentation":"Raised by react/iframe_missing_sandbox when an iframe's `sandbox` attribute has a string value containing tokens that are not valid sandbox directives. At the throw site the declared restrictions are not in effect as intended — unknown tokens are ignored by browsers, so the iframe may be more permissive than the author assumed. validate_sandbox_value tokenizes the attribute value and calls invalid_sandbox_prop with the offending value string.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/react/iframe_missing_sandbox.rs:27 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Correct the token to a valid sandbox value (allow-forms, allow-scripts, allow-same-origin, etc.).","Remove unrecognized tokens from the sandbox attribute."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e1e7af627c8843ab64044ed466b128fcc21a035b","analyzedAt":"2026-08-20T07:01:07.079Z","contentChangedAt":"2026-08-20T07:01:07.079Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}