{"record":{"id":"edb830a9333a3bcf","repo":"siyuan-note/siyuan","slug":"invalid-style-w","errorCode":null,"errorMessage":"invalid style: %w","messagePattern":"invalid style: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/boot_appearance.go","lineNumber":448,"sourceCode":"\tif manifest.OfficialUI.ShowLogo != nil {\n\t\tret.OfficialUI.ShowLogo = *manifest.OfficialUI.ShowLogo\n\t}\n\tif manifest.OfficialUI.ShowDetails != nil {\n\t\tret.OfficialUI.ShowDetails = *manifest.OfficialUI.ShowDetails\n\t}\n\tfor _, color := range []string{manifest.OfficialUI.TextColor, manifest.OfficialUI.ProgressColor,\n\t\tmanifest.OfficialUI.TrackColor} {\n\t\tif err = validateOptionalBootAppearanceColor(color); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tret.OfficialUI.TextColor = manifest.OfficialUI.TextColor\n\tret.OfficialUI.ProgressColor = manifest.OfficialUI.ProgressColor\n\tret.OfficialUI.TrackColor = manifest.OfficialUI.TrackColor\n\n\tif manifest.Style != \"\" {\n\t\tif _, _, err = validateBootAppearanceResource(pluginDir, appearanceDir, manifest.Style, \"style\"); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid style: %w\", err)\n\t\t}\n\t\tret.Style = bootAppearanceAssetURL(pkg.Name, appearanceID, manifest.Style)\n\t}\n\n\tlayerIDs := map[string]bool{}\n\tfor _, layer := range manifest.Layers {\n\t\tif layer == nil || !isValidBootAppearanceID(layer.ID) || layerIDs[layer.ID] {\n\t\t\terr = errors.New(\"invalid or duplicate layer ID\")\n\t\t\treturn nil, err\n\t\t}\n\t\tlayerIDs[layer.ID] = true\n\t\tif layer.Type != \"image\" && layer.Type != \"video\" {\n\t\t\terr = fmt.Errorf(\"unsupported layer type [%s]\", layer.Type)\n\t\t\treturn nil, err\n\t\t}\n\t\tif _, _, err = validateBootAppearanceResource(pluginDir, appearanceDir, layer.Src, layer.Type); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid layer source: %w\", err)\n\t\t}","sourceCodeStart":430,"sourceCodeEnd":466,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/boot_appearance.go#L430-L466","documentation":"When the manifest declares a \"style\" (custom CSS resource), loadBootAppearance validates it with validateBootAppearanceResource, which checks the path resolves safely inside the appearance directory, exists, and matches the expected resource type (\"style\"). Any failure is wrapped as \"invalid style\". This prevents path traversal, missing files, and wrong file kinds.","triggerScenarios":"manifest.json has a non-empty \"style\" field but the referenced file does not exist in the appearance directory, is a symlink or escapes the directory, has an extension not accepted for style resources, or exceeds size limits.","commonSituations":"Typo in the style file name in the manifest; style file forgotten when packaging the plugin; path written with \"../\" or an absolute path; style shipped as a different file type (e.g. .less instead of .css).","solutions":["Ensure the file named in \"style\" exists inside the appearance directory and is committed/packaged with the plugin.","Make \"style\" a relative path with no \"..\", symlinks, or absolute segments.","Use a supported stylesheet extension (e.g. .css) for the style resource.","Set \"style\" to \"\" in the manifest if no custom stylesheet is intended."],"exampleFix":"// before: manifest.json\n\"style\": \"../shared/theme.css\"\n// after\n\"style\": \"theme.css\"  // file present in the appearance directory","handlingStrategy":"validation","validationCode":"const p = path.resolve(appearanceDir, manifest.style);\nif (!p.startsWith(path.resolve(appearanceDir) + path.sep)) throw new Error('style escapes appearance dir');\nif (!fs.existsSync(p)) throw new Error('style file missing: ' + manifest.style);","typeGuard":null,"tryCatchPattern":"try { loadAppearance(id); } catch (e) { if (/invalid style/.test(String(e))) { /* check style path existence and containment */ } }","preventionTips":["Always use relative paths without '..' for style","Verify packaged archives contain the stylesheet","Use plain .css files only"],"tags":["boot-appearance","stylesheet","resource-validation","path-traversal"],"backgroundTag":"path-traversal-blocked","analyzedSha":"9f775e8a12daef8255556097396f9b2739078892","analyzedAt":"2026-09-19T03:17:15.984Z","contentChangedAt":"2026-09-19T03:17:15.984Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}