Skip to content

Decksters lab/palette creator - #343

Open
decksters-lab wants to merge 8 commits into
noctalia-dev:mainfrom
decksters-lab:decksters-lab/palette-creator
Open

Decksters lab/palette creator#343
decksters-lab wants to merge 8 commits into
noctalia-dev:mainfrom
decksters-lab:decksters-lab/palette-creator

Conversation

@decksters-lab

@decksters-lab decksters-lab commented Aug 11, 2026

Copy link
Copy Markdown

Plugin

  • Id: decksters-lab/palette-creator
  • New plugin
  • Update to an existing plugin (version bumped in plugin.toml)

What it does

External dependencies

Testing

  • Tested on Niri
  • Tested on Hyprland
  • Tested on Sway
  • Tested on another compositor: Wayfire, MangoWM
  • Noctalia version tested against: 5.0.0.r5173.g3854c86e2-1
  • Plugin API level: 9

Screenshots / Videos

thumbnail

Checklist

  • The directory name matches the part of id after the / in plugin.toml exactly.
  • It ships plugin.toml, README.md, thumbnail.webp, and translations/en.json.
  • README.md follows the
    README template, documents
    every entry id and dependency, and includes exact panel IPC commands and launcher prefixes where applicable.
  • I created thumbnail.webp with the thumbnail generator.
  • version follows semver and is bumped in this PR; plugin_api is the oldest API level this plugin requires.
  • Every non-English translation in this PR uses a locale supported by Noctalia core, and I can read, write, and
    understand that language well enough to review and maintain it (no unreviewed machine/LLM translations).
  • I did not edit catalog.toml; CI generates it.
  • This PR touches exactly one plugin directory.

Code review attestation

Plugins run as trusted, unsandboxed Luau in the user's session. Confirm:

  • The code is readable and not obfuscated, minified, or generated.
  • It does not download and execute remote code.
  • Every network call, filesystem write, and spawned process is something the description above accounts for.
  • I have the right to publish this code under the license declared in plugin.toml.

@decksters-lab

decksters-lab commented Aug 11, 2026

Copy link
Copy Markdown
Author

It was tested on Hyprland, Wayfire and MangoWM. As its listed in the actual description. Sorry. This is my first pull request ever.

@ItsLemmy

Copy link
Copy Markdown
Contributor
  1. blocking - palette-creator/panel.luau:646

The free-form palette name is appended directly to a filesystem path and interpolated into a shell
command at palette-creator/panel.luau:654. String-form noctalia.runAsync executes through /bin/sh
-c, as confirmed at ../noctalia-shell/src/scripting/luau_host.cpp:265.

A name containing "../" can overwrite writable JSON files outside the palette directory. Shell
metacharacters can execute arbitrary commands in the user's session. Restrict names to a safe
basename and invoke runAsync with an argv table instead of a command string.

  1. non-blocking - palette-creator/panel.luau:476

revertChanges and loadPaletteByName at palette-creator/panel.luau:521 reference applyPreview
before its local declaration at palette-creator/panel.luau:527. Those references resolve to the
global name, not the later local function. Resetting or loading while preview is active therefore
attempts to call nil instead of updating the preview.

Forward-declare local applyPreview before these functions, then assign its implementation at the
current declaration.

@ItsLemmy
ItsLemmy marked this pull request as draft August 12, 2026 13:36
@decksters-lab

Copy link
Copy Markdown
Author

Thank you for the detailed info on what I needed to change. I'm sorry for the mistakes, but I've updated the plugin to address both the blocking and non-blocking issues:

    Path Traversal & Shell Metacharacter Safety (panel.luau):
        Names are sanitized to safe alphanumeric basenames (sanitizeName).
        noctalia.runAsync now passes arguments in an argv array ({"noctalia", "msg", "color-scheme-set", "custom", name}) rather than interpolating shell strings.

    Function Declaration Order (panel.luau):
        Forward-declared applyPreview before revertChanges and loadPaletteByName so they resolve to the local function as intended.

also:
UI Improvements:
Replaced the dropdown selector (ui.select) with an inline scrollable list (ui.scroll) bounded to height = 260. This solves Wayland layer-shell popup focus issues and keeps the palette list cleanly contained with a scrollbar.

@decksters-lab
decksters-lab marked this pull request as ready for review August 13, 2026 00:09
@ItsLemmy

Copy link
Copy Markdown
Contributor

No worries. Code reviews are not accusation.
I don't see any new commit since my last comment tho, so I'm marking this back to draft until you push the new code.

@ItsLemmy
ItsLemmy marked this pull request as draft August 13, 2026 02:44
Addresses review feedback from ItsLemmy:

- Blocking: saveScheme() no longer builds a path or shell command
  directly from the free-form palette name field. Names are now run
  through sanitizeName() (strips "/", "..", and anything outside
  [A-Za-z0-9 _()-]) before touching disk. noctalia.runAsync now takes
  an argv table ({"noctalia", "msg", "color-scheme-set", "custom",
  name}) instead of a formatted shell string, so path traversal and
  shell metacharacter injection are both closed off.

- Non-blocking: forward-declared applyPreview alongside render, so
  revertChanges/loadPaletteByName (which call it before its own
  definition) resolve to the local function instead of a nil global.
  Reset/Load while Preview is active now actually updates the preview
  instead of silently failing.

Also reworked the Load picker while testing the above: replaced the
ui.select dropdown (which had focus issues under Wayland layer-shell
popups) with an inline ui.scroll list, and added a two-step
confirm/cancel on delete so a misclick on the trash icon can't
destroy a saved palette outright.
@decksters-lab
decksters-lab marked this pull request as ready for review August 13, 2026 03:01
@decksters-lab

Copy link
Copy Markdown
Author

We are getting there. lol. thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants