Skip to content

fix(shell): keep __sourceDir on third-party plugin manifests - #11925

Merged
spencerbull merged 3 commits into
omacom:quattrofrom
joewinke:fix/plugin-thirdparty-sourcedir
Oct 3, 2026
Merged

spencerbull merged 3 commits into
omacom:quattrofrom
joewinke:fix/plugin-thirdparty-sourcedir

Conversation

@joewinke

@joewinke joewinke commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Problem

publicPluginManifest() (shell/shell.qml) deletes __sourceDir from third-party plugin manifests. Third-party service and panel plugin instances receive only this stripped manifest (inst.manifest = shell.publicPluginManifest(manifest)) and — unlike barWidgets, which get sourceDir via their meta — have no other channel to their own directory.

As a result, any third-party service/panel plugin that reads manifest.__sourceDir to locate its bundled files now gets "", so every Process/script it launches resolves to an absolute /scripts/... and fails silently.

Observed in the wild after upgrading to 4.0.3:

  • Omarchy-Spotify hangs forever on "Checking playback support…" — its keyring/credential/requirement scripts never run (Process failed to start … Command: QList("/scripts/keyring-store.sh", …) in the qslog).
  • A third-party dictionary plugin errors similarly.

Worked before 4.0.3.

Fix

Stop stripping __sourceDir. A plugin's own install directory is not a privilege signal — the plugin's code already resides and runs there, and barWidgets already receive it via meta.sourceDir. The genuine privilege markers (__isFirstParty, __hostCapabilities) remain withheld from third parties.

Testing

test/shell.d/plugin-auth-boundary-test.sh passes (all 13 checks) — the change doesn't touch the object-tree detachment / auth-capability boundary that suite guards. The test asserts nothing about __sourceDir, confirming it was collateral rather than a deliberate boundary.

🤖 Generated with Claude Code

Fixes #10863

Fixes #12308

Fixes #12418

publicPluginManifest() stripped __sourceDir from every non-first-party
manifest, but service and panel plugin instances receive only that
stripped manifest and no separate sourceDir (unlike barWidgets, which
get meta.sourceDir). That left third-party service/panel plugins with
no way to locate their own bundled scripts and assets: any plugin that
launches a bundled script resolves it against an empty base path and
fails silently (e.g. Omarchy-Spotify hangs on "Checking playback
support…", its keyring/credential scripts never run).

__sourceDir is the plugin's own install directory, not a privilege
signal — the plugin's code already runs from there. Keep withholding
the real privilege markers (__isFirstParty, __hostCapabilities) but
stop stripping __sourceDir. The plugin auth-boundary test suite still
passes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@omarchybot omarchybot added the bug Something isn't working label Sep 27, 2026
@llstrk

llstrk commented Sep 28, 2026

Copy link
Copy Markdown

Automated AI review

Community review: Independent automated community review, unaffiliated with the Omarchy team, intended to help prepare PRs for their review.

Verified: the one-line change gives third-party plugins their own __sourceDir again, on every path that hands a plugin its manifest, while __isFirstParty and __hostCapabilities stay withheld. No functional issue was found in the tested scope. The suggestions below concern the wording of the new code comment and PR description, a regression test, and issue links.

publicPluginManifest() output for a third-party plugin Merge base and quattro tip This PR (head, and merged onto the tip)
__sourceDir removed kept
__isFirstParty, __hostCapabilities removed removed (also for a clone carrying ["authentication"])
Omarchy-Spotify script path (from pluginDir in Service.qml) /scripts/keyring-store.sh (the command in the PR's log) <plugin dir>/scripts/keyring-store.sh
Editing the plugin's copy changes the registry entry no no

Verified in more detail:

  • Every caller passes the recipient plugin's own manifest: the replacement bar, service first load, kept services and authentication-capable clones on rescan, the panel/overlay/menu loader, and PluginRegistryApi (whose installedPlugins holds only the plugin's own entry). The fix therefore covers reloads too, and no plugin sees another plugin's __sourceDir through this function.
  • __sourceDir is not a privilege input: __isFirstParty comes from the registry scan kind, and host entry points are resolved from registry manifests, not from the plugin's copy.
  • delete copy.__sourceDir arrived with Restrict third-party plugin access to authentication services #9618 (released in 4.0.3). No stated reason for withholding __sourceDir was found in that PR's description, comments, reviews or documentation, and v4.0.2 and earlier passed the raw manifest, so "worked before 4.0.3" matches the history. Whether the removal was intended is for the Restrict third-party plugin access to authentication services #9618 author to confirm.
  • The PR merges without conflicts onto the current quattro tip, and the merged function matches the PR head. It also merges without conflicts with Own pending shell service loads across reloads #11492 and Discover shell plugins through XDG data directories #12872, which change this function or its __sourceDir handling in shell/shell.qml.

Code comment and description overstate two points

The new comment in shell/shell.qml and the PR description say:

  1. "barWidgets already receive it via meta.sourceDir". sourceDir is stored in the bar-widget registry metadata (shell/shell.qml, sourceDir: manifest.__sourceDir || ""), but a bar-widget instance is not given it: ModuleSlot.injectProps() in shell/plugins/bar/Bar.qml sets only bar, moduleName and settings.
  2. Stripping the field "left those plugins with no way to find their own files" (the description: "no other channel to their own directory"). Entry components are created from file URLs, so Qt.resolvedUrl(".") inside the plugin's own QML resolves to its directory as a file:// URL, which the plugin can convert to a path. shell/plugins/agents/Panel.qml already resolves bundled assets this way. A plugin that declares pluginRegistry can also call pluginRegistry.entryPointUrl(pluginRegistry.manifest, kind) with its own entry kind, which returns its entry file's URL. None of these alternatives is documented, and the plugins named in Regression (4.0.2→4.0.3): publicPluginManifest() strips __sourceDir, breaking third-party plugins that locate their own files #10863, Third-party plugins cannot locate their own directory after 4.0.4 manifest sanitization #12308 and Third-party plugin services can't resolve their own install directory (manifest.__sourceDir is stripped) #12418 relied on manifest.__sourceDir, so the compatibility case for this PR still holds.

Impact: the comment will be read as the rationale for this trust boundary. Its contrast with bar widgets is inaccurate, and the absolute "no way" wording misstates what plugins could do.

Suggested change: shorten the comment, for example:

// Keep __sourceDir: third-party plugins use their own install directory to
// find bundled scripts and assets. Only the host trust markers are withheld.

Optional test improvement: plugin-auth-boundary-test.sh gives the same result with and without this change (its runtime fixture uses its own shell.qml), so nothing guards the fix. The block below, run inside run_node_test <<'JS' with fs and vm required like the existing AuthServiceStore block, failed on the merge base and the quattro tip and passed on the PR head and the merged tip:

const source = fs.readFileSync(path.join(root, 'shell/shell.qml'), 'utf8')
const match = source.match(/\n  function publicPluginManifest\([^]*?\n  \}/)
assert(!!match, 'shell defines publicPluginManifest')
const host = {}
vm.createContext(host)
vm.runInContext(match[0], host)
const raw = { id: 'acme.demo', kinds: ['service'], entryPoints: { service: 'Service.qml' },
  __sourceDir: '/plugins/acme.demo', __isFirstParty: false, __hostCapabilities: ['authentication'] }
const copy = host.publicPluginManifest(raw)
assertEqual(copy.__sourceDir, '/plugins/acme.demo', 'third-party manifests keep their own source directory')
assert(!('__isFirstParty' in copy) && !('__hostCapabilities' in copy), 'third-party manifests drop host trust markers')
copy.__sourceDir = '/elsewhere'
assertEqual(raw.__sourceDir, '/plugins/acme.demo', 'changing the plugin copy cannot move the registry entry')

Related issues: #10863 reports exactly this regression (Omarchy-Spotify, Omamail, omajam), and #12308 and #12418 report it again. Adding Fixes #10863, Fixes #12308 and Fixes #12418 would close all three when this PR merges.


Review information

Test scope: Source review of the PR head, merge base and current quattro tip, plus the history of #9618. The real publicPluginManifest() and related helpers were extracted from each snapshot and run in Node in an isolated sandbox. Existing plugin test suites ran in the same sandbox without a compositor, so their runtime cases were skipped. The Qt.resolvedUrl(".") behavior was checked with a QtQml core probe, not in Quickshell. No live shell session ran and no third-party plugin was installed or run; the unnamed dictionary plugin was not identified.

AI process: Opus 5.5 Medium coordination and synthesis, Opus 5.5 Xhigh technical review and final fact check, GPT 6 Sol Xhigh search for related issues, Opus 5.5 Medium editorial check.

Opt out: To stop receiving these reviews, reply to this comment saying so.

@spencerbull

Copy link
Copy Markdown
Contributor

Reviewed at 6df574c, merged onto the current quattro tip (the branch is 199 commits behind). The fix is correct and safe; two small things are worth adding before it lands, both already raised in @llstrk's review above.

Reproduced on a fresh Omarchy VM. A minimal third-party service plugin in ~/.config/omarchy/plugins/acme.srcdir runs a bundled script from manifest.__sourceDir, the way Omarchy-Spotify does. On the quattro tip it receives __sourceDir = "" and the script never runs. With this PR merged onto the tip it receives its install directory and the script runs. In both cases __isFirstParty and __hostCapabilities stay withheld.

Boundary. Nothing #9618 guards is weakened. The only reader of __sourceDir is PluginRegistry.entryPointUrl, which resolves from the registry's own manifests, never from a plugin's copy. Every caller of publicPluginManifest() hands a plugin its own manifest. Plugin directories were never secret anyway: publicBarWidgetSnapshot() already gives third-party bars every widget's metadata.sourceDir.

Tests on the VM: every plugin suite under test/shell.d/ passes with 0 skips (menu-plugin, plugin-add, plugin-auth-boundary, plugin-clone, plugin-enable, plugin-registry-contract, plugins, plugin-validate). As the description notes, none of them guards the fix: they pass the same with delete copy.__sourceDir restored.

Suggested changes:

  1. The comment says bar widgets "already receive it via meta.sourceDir". They don't: ModuleSlot.injectProps() in shell/plugins/bar/Bar.qml sets only bar, moduleName and settings. It also says plugins had "no way" to find their files, which overstates it (Qt.resolvedUrl(".") works). Two lines are enough:
    // Keep __sourceDir: third-party plugins use their own install directory
    // to find bundled scripts. Only the host trust markers are withheld.
  1. A regression test. This goes at the end of the Node block in test/shell.d/plugins-test.sh, next to the existing unloadPluginServices check that extracts a function from shell.qml the same way. It passes on this branch and on the branch merged onto quattro, and fails once delete copy.__sourceDir is put back:
const publicManifestMatch = shellSource.match(/function publicPluginManifest\(manifest\) \{[\s\S]*?\n  \}/)
check(!!publicManifestMatch, 'publicPluginManifest is defined')
if (publicManifestMatch) {
  const host = {}
  require('vm').runInNewContext(publicManifestMatch[0] + '\nthis.publicPluginManifest = publicPluginManifest', host)
  const raw = { id: 'acme.demo', __sourceDir: '/plugins/acme.demo', __isFirstParty: false, __hostCapabilities: ['authentication'] }
  const copy = host.publicPluginManifest(raw)
  check(copy.__sourceDir === '/plugins/acme.demo', 'third-party manifests keep their own source directory')
  check(!('__isFirstParty' in copy) && !('__hostCapabilities' in copy), 'third-party manifests drop host trust markers')
}

This PR fixes #10863, #12308 and #12418. Adding Fixes #10863, Fixes #12308 and Fixes #12418 to the description would close them on merge.

Review and VM runs by Opus 5.5 in Claude Code. Codex XHigh was the second opinion: it found no behavioural or security defect and flagged the same comment and test gap. That is agreement, and its independence is not guaranteed.

Waiting on the author for the two changes above, then on a maintainer.

omarchybot and others added 2 commits October 1, 2026 04:49
Bar widget instances are not handed sourceDir (ModuleSlot.injectProps sets only bar, moduleName and settings), and a plugin could reach its directory through Qt.resolvedUrl, so the comment's rationale was wrong on both counts. Two lines carry what the code cannot say.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
No suite failed with the strip restored, so nothing kept the 4.0.3 regression from coming back.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@omarchybot omarchybot added verified Omarchy Triage has verified that this issue is ready for final review and removed verified Omarchy Triage has verified that this issue is ready for final review labels Oct 1, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed and reproduced at 84e88b4. The fix is right, and I pushed two small commits on top of it.

Reproduced on an Omarchy worker VM. With the shell running this branch, a minimal third-party service plugin in ~/.config/omarchy/plugins/acme.srcdir reads manifest.__sourceDir and runs its bundled scripts/mark.sh. On this head it gets its install directory and the script runs. With delete copy.__sourceDir put back, it gets "" and the shell logs Process failed to start … Command: QList("/scripts/mark.sh"), which is the failure in the description and in #10863. With the fix restored, it runs again.

Boundary. Every caller of publicPluginManifest() hands a plugin its own manifest. No host code trusts __sourceDir read back from a plugin's copy: PluginRegistryApi.entryPointUrl and the other entry-point lookups resolve from the registry's own manifests. __isFirstParty and __hostCapabilities are still withheld, so nothing #9618 guards is weakened.

Pushed to your branch:

  • 146fe5d shortens the comment to two lines that are true. The old one said bar widgets receive meta.sourceDir, but ModuleSlot.injectProps() in shell/plugins/bar/Bar.qml passes only bar, moduleName and settings. It also said plugins had no other way to find their files, but Qt.resolvedUrl(".") works. Both points were raised in the earlier reviews here.
  • 84e88b4 adds a regression test at the end of test/shell.d/plugins-test.sh. It runs the real publicPluginManifest() from shell.qml and checks three things: a third-party copy keeps __sourceDir, it drops both trust markers, and editing the copy cannot move the registry entry. No existing suite failed with the strip restored. This test does.

Tests on the worker: ./test/cli passes. These plugin suites pass with no skips, both on this head and merged onto quattro 8b4eae6 (the branch is 227 commits behind but merges cleanly): plugins, plugin-auth-boundary, plugin-registry-contract, plugin-clone, plugin-enable, plugin-add, plugin-validate and menu-plugin. The new check fails with the strip restored.

Linked #10863, #12308 and #12418, which all report this regression, so they close when this merges.

Review, worker runs and fixes by Claude Opus 5.5. Codex Medium was the second opinion on this head. It found nothing: it checked the same callers and boundary, and confirmed the new test cannot pass vacuously. It agreed with my conclusion, and its independence is not guaranteed.

Nothing is left for the author. This is waiting on CI, which has not run on this pull request, and then on a maintainer.

@omarchybot omarchybot added the verified Omarchy Triage has verified that this issue is ready for final review label Oct 1, 2026
@greptile-apps

greptile-apps Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium risk] Changes which plugin manifest fields are exposed to third-party code.

The PR appears safe to merge.

Summary

The PR preserves the host-assigned __sourceDir in third-party plugin manifests so services and panels can locate bundled files, while continuing to remove host trust markers.

  • Adds a focused test for path retention, marker removal, and copy isolation.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Plugin directory scan] --> B[Registry manifest with host-assigned __sourceDir]
  B --> C[publicPluginManifest]
  C --> D[Third-party service or panel]
  C --> E[Copy retains __sourceDir; trust markers removed]
Loading

Reviews (1) · Last reviewed commit: "Guard third-party manifests keeping __so..."

@spencerbull
spencerbull merged commit 0537ae1 into omacom:quattro Oct 3, 2026
1 check passed
buger added a commit to probelabs/omarchy that referenced this pull request Oct 3, 2026
None of the 31 changed upstream files is in the verification scope; the menu
and lock code is byte-identical across the merge. The only contact is
shell/shell.qml (omacom#11925), whose one-line insertion moves the cited summon
lines by one: the threat surface and SW-REQ-260928-8VJQ now cite
shell.qml:1841 and :1144. Research note in
review/upstream-a85e29ab-research-delta.md; upstream_refresh_v1 steps 1-13
confirmed, coverage and the campaign stamp follow the audit.
ryanrhughes pushed a commit that referenced this pull request Oct 16, 2026
fix(shell): keep __sourceDir on third-party plugin manifests

(cherry picked from commit 0537ae1)
ryanrhughes added a commit that referenced this pull request Oct 16, 2026
#11925 keeps __sourceDir on third-party public manifests so plugins can find
their bundled scripts; the clone still drops the host trust markers.
@emirb emirb added this to the 4.0.5 milestone Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working verified Omarchy Triage has verified that this issue is ready for final review

Projects

None yet

5 participants