Skins: harden Add skin and import skins from other viewers (convert colours/textures, validate or skip incompatible XUI, safe unpack) #1599

Open
opened 2026-11-17 22:22:11 +00:00 by sky_line · 0 comments
Owner

Today, Preferences > Skins > Add skin (inherited from Alchemy: LLFloaterPreference::onAddSkinCallback) only takes a .zip with a manifest.json carrying a "name". It unpacks it blindly into the user skins/ folder. There is no validation, no way to import from another viewer's install, and a skin whose XUI files don't match ours can break or hide parts of the UI.

Harden the existing path

  • Safe unpack:
    • reject path traversal (.., absolute paths, symlinks) and files outside the expected skin layout;
    • cap the total size and file count;
    • unpack to a temporary folder first, then move into place, so a failed install leaves nothing half-installed;
    • make the skin name safe for a folder name, and handle a clash with an existing skin (replace or keep both).
  • Manifest: a missing or broken manifest.json is no longer fatal for a folder or zip that otherwise looks like a skin; generate one from the folder name. Also read the optional fields: author, version, viewer.
  • A clear result: a summary after install of what was installed, converted and skipped.

Expand: import from other viewers

  • "Import skin from another viewer...":
    • find the skins in installed viewers (Firestorm, Alchemy, LL / Second Life, Black Dragon, Catznip, Kokua, and others: their install skins/ folders and user skin folders, per OS);
    • also accept any picked folder or zip, with or without a manifest.

Compatibility: convert or ignore bad entries

  • Colours (colors.xml): import every colour name we use, and drop or warn about names we don't. Map the known renamed colours between viewers (a small alias table).
  • Textures (textures/ + textures.xml): import the images for texture names we use, and drop unknown ones. Check formats and sizes. A missing or invalid image falls back to ours, never a blank.
  • XUI files (layout):
    • default: layout files are not imported; only colours and textures, which are safe;
    • optional "include layout files": each imported XUI file is checked against ours. It parses; its root element and file name match one of our files; and it doesn't remove or rename named controls our code looks up (getChild / findChild names in the matching panel or floater). Files that fail are skipped and listed. Files that pass load as overrides, as now.
  • Fonts and skin_settings.xml: import only known keys; ignore unknown ones.
  • Runtime safety net: when a skin's XUI override fails to build a panel (a missing required child, a parse error), fall back to our default file for that panel and log it, instead of a broken UI.

Done when

  • A Firestorm skin folder and an Alchemy skin zip both install.
  • Colours and textures apply.
  • Incompatible XUI is skipped or falls back, with a listed summary.
  • A malformed zip or a zip-slip test can't write outside the skin folder.
Today, **Preferences > Skins > Add skin** (inherited from Alchemy: `LLFloaterPreference::onAddSkinCallback`) only takes a `.zip` with a `manifest.json` carrying a `"name"`. It unpacks it blindly into the user `skins/` folder. There is no validation, no way to import from another viewer's install, and a skin whose XUI files don't match ours can break or hide parts of the UI. ## Harden the existing path - **Safe unpack:** - reject path traversal (`..`, absolute paths, symlinks) and files outside the expected skin layout; - cap the total size and file count; - unpack to a temporary folder first, then move into place, so a failed install leaves nothing half-installed; - make the skin name safe for a folder name, and handle a clash with an existing skin (replace or keep both). - **Manifest:** a missing or broken `manifest.json` is no longer fatal for a folder or zip that otherwise looks like a skin; generate one from the folder name. Also read the optional fields: author, version, viewer. - **A clear result:** a summary after install of what was installed, converted and skipped. ## Expand: import from other viewers - **"Import skin from another viewer...":** - find the skins in installed viewers (Firestorm, Alchemy, LL / Second Life, Black Dragon, Catznip, Kokua, and others: their install `skins/` folders and user skin folders, per OS); - also accept any picked folder or zip, with or without a manifest. ## Compatibility: convert or ignore bad entries - **Colours** (`colors.xml`): import every colour name we use, and drop or warn about names we don't. Map the known renamed colours between viewers (a small alias table). - **Textures** (`textures/` + `textures.xml`): import the images for texture names we use, and drop unknown ones. Check formats and sizes. A missing or invalid image falls back to ours, never a blank. - **XUI files (layout):** - **default:** layout files are not imported; only colours and textures, which are safe; - **optional "include layout files":** each imported XUI file is checked against ours. It parses; its root element and file name match one of our files; and it doesn't remove or rename named controls our code looks up (`getChild` / `findChild` names in the matching panel or floater). Files that fail are skipped and listed. Files that pass load as overrides, as now. - **Fonts and `skin_settings.xml`:** import only known keys; ignore unknown ones. - **Runtime safety net:** when a skin's XUI override fails to build a panel (a missing required child, a parse error), fall back to our default file for that panel and log it, instead of a broken UI. ## Done when - A Firestorm skin folder and an Alchemy skin zip both install. - Colours and textures apply. - Incompatible XUI is skipped or falls back, with a listed summary. - A malformed zip or a zip-slip test can't write outside the skin folder.
sky_line added this to the Slipstream project 2026-11-17 22:22:11 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
sky_line/Slipstream#1599
No description provided.