{"record":{"id":"427277c7576f0da8","repo":"DioxusLabs/dioxus","slug":"cannot-copy-global-asset-for-component-b","errorCode":null,"errorMessage":"Cannot copy global asset '{}' for component '{}' because it is outside of the component registry '{}'","messagePattern":"Cannot copy global asset '(.+?)' for component '(.+?)' because it is outside of the component registry '(.+?)'","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"packages/cli/src/cli/component.rs","lineNumber":811,"sourceCode":"async fn copy_global_assets(\n    registry_root: &Path,\n    assets_root: &Path,\n    component: &ResolvedComponent,\n) -> Result<()> {\n    let canonical_registry_root = dunce::canonicalize(registry_root)?;\n    for path in &component.global_assets {\n        let src = component.path.join(path);\n        let absolute_source = dunce::canonicalize(&src).with_context(|| {\n            format!(\n                \"Failed to find global asset '{}' for component '{}'\",\n                src.display(),\n                component.name\n            )\n        })?;\n\n        // Make sure the source is inside the component registry somewhere\n        if !absolute_source.starts_with(&canonical_registry_root) {\n            bail!(\n                \"Cannot copy global asset '{}' for component '{}' because it is outside of the component registry '{}'\",\n                absolute_source.display(),\n                component.name,\n                canonical_registry_root.display()\n            );\n        }\n\n        // Copy the file into the assets directory, preserving the file name and extension\n        let dest = assets_root.join(\n            absolute_source\n                .components()\n                .next_back()\n                .context(\"Global assets must have at least one file component\")?,\n        );\n\n        // Make sure the asset dir exists\n        if let Some(parent) = dest.parent() {\n            if !parent.exists() {","sourceCodeStart":793,"sourceCodeEnd":829,"githubUrl":"https://github.com/DioxusLabs/dioxus/blob/24f6a829df0dfa203961a98ea4cae21c2ff27e28/packages/cli/src/cli/component.rs#L793-L829","documentation":"Path-containment guard in copy_global_assets (called from add_component): after canonicalizing the registry root and the component's global asset path, the source resolves to a location outside the canonicalized registry root, so copying it would pull in files that are not part of the component registry (a potential path-traversal or misconfigured registry layout). The inputs at fault are the component's global_assets path and the registry layout.","triggerScenarios":"Thrown at packages/cli/src/cli/component.rs:811 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["The global asset lies outside the component registry. Move the asset inside the registry or fix the component manifest."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"24f6a829df0dfa203961a98ea4cae21c2ff27e28","analyzedAt":"2026-08-23T07:10:14.078Z","contentChangedAt":"2026-08-23T07:10:14.078Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}