{"record":{"id":"947479f347d5876d","repo":"oxc-project/oxc","slug":"an-iframe-element-defines-a-sandbox-attribute-wi","errorCode":null,"errorMessage":"An `iframe` element defines a sandbox attribute with both allow-scripts and allow-same-origin which is invalid","messagePattern":"An `iframe` element defines a sandbox attribute with both allow-scripts and allow-same-origin which is invalid","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/react/iframe_missing_sandbox.rs","lineNumber":33,"sourceCode":"    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\",\n    \"popups-to-escape-sandbox\",\n    \"presentation\",\n    \"same-origin\",\n    \"scripts\",\n    \"storage-access-by-user-activation\",\n    \"top-navigation\",","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/react/iframe_missing_sandbox.rs#L15-L51","documentation":"Raised by react/iframe_missing_sandbox when an iframe's `sandbox` attribute contains both `allow-scripts` and `allow-same-origin`. At the throw site the combination lets the framed content remove its own sandbox attribute (same-origin access plus script execution), making the sandbox effectively useless as a security boundary. validate_sandbox_value checks the token set and reports the attribute via invalid_sandbox_combination_prop.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/react/iframe_missing_sandbox.rs:33 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove either allow-scripts or allow-same-origin from the sandbox attribute.","Serve the embedded content from a different origin if both flags are genuinely needed."],"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"}