Skip to content

Give third-party plugins their own entry settings and auth service - #12260

Open
chessing234 wants to merge 2 commits into
omacom:quattrofrom
chessing234:fix/10969-plugin-own-entry-and-service
Open

chessing234 wants to merge 2 commits into
omacom:quattrofrom
chessing234:fix/10969-plugin-own-entry-and-service

Conversation

@chessing234

@chessing234 chessing234 commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Expose entrySettings on PluginShellApi (and refresh it with shell config) so third-party non-bar plugins can read their own shell.json entry fields instead of silently seeing {}.
  • Resolve a plugin's own authentication service from AuthServiceStore in pluginServiceFor, and use that path when injecting service into panel/overlay loaders so lock/polkit clones are not stuck with service === null.

Closes #10969.

Test plan

  • bash test/shell.d/plugin-auth-boundary-test.sh
  • Install a third-party lock/overlay plugin with inline entry settings; confirm the plugin sees those fields via shell.entrySettings
  • Confirm a lock clone's overlay receives a non-null service and can call into it

@llstrk

llstrk commented Sep 25, 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.

Outcome: Both parts of #10969 are addressed for the plugin's own facade, but the new authentication-service fallback also makes lock and polkit services reachable from the host ShellRoot, which the project's plugin docs say must not happen. entrySettings also shares nested objects with host config after a refresh. Splitting the auth-service change from the entrySettings change may make each easier to evaluate.

Verified (pinned head 70c62cb, source plus an isolated headless model):

  • A third-party plugin's facade receives its own plugins[] entry without id in entrySettings, and a top-level read-modify-write through updateEntryInline persists.
  • entrySettings refreshes on config change (onShellConfigChanged → pluginsChanged → syncPluginApis).
  • A lock clone's own facade now returns its own authentication service (the reported bug), and the facade still returns null for a foreign id.
  • The four changed source files are unchanged on current quattro, so the findings below still apply there.

Authentication services become reachable from ShellRoot

pluginServiceFor(pluginId, requestedId) is a public ShellRoot function, and pluginOwnsTarget only compares the two strings the caller passes in. That is sound inside the host-built facade closure, where the host fixes pluginId, but not for a direct call. A third-party service created by ensureService() (Qt.createComponent in shell.qml) or a panel loaded by the shell.qml Loader gets a QML context that is a child of shell.qml's context. If the plugin root does not declare its own shell property, the bare name shell resolves to ShellRoot { id: shell }.

third-party plugin root (no `shell` property)
  └─ shell  ──resolves via parent QML context──▶ ShellRoot
       └─ shell.pluginServiceFor("omarchy.lock", "omarchy.lock")
            base: serviceFor() → null (auth services are not in _services)
            head: serviceFor() → null → AuthServiceStore.get() → live lock service
Probe (headless model, verbatim base/head functions) Base Head
Unshadowed plugin root resolves shell to ShellRoot yes yes
shell.pluginServiceFor("omarchy.lock","omarchy.lock") returns the lock service no yes
Same, from a panel loaded through an Instantiator/Loader no yes
Control: plugin root declares property var shell not reached not reached

With an active lock clone, shell.pluginServiceFor(cloneId, cloneId) returns the clone the same way. The polkit service is exposed the same way. Two other new paths lead to the same object from ShellRoot: shell.panelLoaders[id].item.service and a cached facade in shell._pluginShellApis.

Impact: The lock service exposes enteredPassword/pendingPassword, and its finishUnlock() sets sessionLock.locked = false without checking authentication (shell/plugins/lock/Service.qml). The project documents this boundary in shell.qml ("without adding a traversable property or QObject parent back to the host shell"), docs/omarchy-shell.md, manual/32-shell-plugins.md and agents/skills/shell-dev.md ("Do not expose authentication services through new third-party-facing properties"). Plugins already run unsandboxed with user file and process access, so this is not a remote or cross-user issue. It removes the in-process credential protection that the base commit still has.

Suggested change: Keep the AuthServiceStore lookup out of any function or property reachable from ShellRoot. Moving it into the facade closure alone does not close the gap, because _pluginShellApis and panelLoaders also hang off ShellRoot. One option is to keep auth-capable UI inside the service object, as omarchy.lock already does. Another is to give the overlay a narrow, non-credential API instead of the service. Add a runtime negative test showing that shell.pluginServiceFor(authId, authId) stays null. The current text-pattern assertion pins the exact new fallback line.

entrySettings shares nested objects with host config after a refresh

pluginEntrySettings() copies only top-level keys. The initial value passes through createObject and arrives detached. The refresh in syncPluginApis() is a plain JS assignment, so nested arrays and objects become the host's live shellConfig objects.

s = shell.entrySettings        // after any config refresh
s.favorites.push(x)            // mutates shell.shellConfig in place
shell.updateEntryInline(id, s) // → false, nothing written (config already "equal")

Impact: A nested read-modify-write, like the pattern behind #10907, is silently not saved after the first refresh. For a replacement bar the entry is the bar option, so entrySettings.layout is the host's live shellConfig.bar.layout. The docs say third-party configuration snapshots are detached.

Suggested change: Return a JSON deep copy with id removed, the same pattern publicBarConfig() and publicIdleConfigFor() already use.

Note: Widgets rendered by a third-party replacement bar get their facade from pluginShellForBarEntry(), which never sets entrySettings, so it stays {} there. Their settings property still carries the entry, so this matters only if entrySettings is meant to be available to bar widgets too. If so, set it there. If not, document the exception.


Review information

Test scope: Source review of the pinned head, merge-base and current quattro, plus Quickshell v0.3.1 and qtdeclarative source for QML context resolution. Isolated headless Quickshell 0.3.1 runs used a model built from verbatim base/head functions and the real AuthServiceStore.js/PluginShellApi.qml, with a stub lock service. It was not the full shell. No desktop session was run, the polkit password-field path was not exercised, and the repository test script was not executed.

AI process: Opus 5.5 Medium coordination and synthesis, independent Opus 5.5 Xhigh and GPT 6 Sol Xhigh technical assessments with targeted follow-up questions, Opus 5.5 Medium editorial check.

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

Resolve own lock/polkit instances only inside the facade closure and the
host panel Loader. Deep-copy entrySettings so nested config is detached.
@chessing234

Copy link
Copy Markdown
Contributor Author

addressed the review: auth services no longer come back through pluginServiceFor on ShellRoot, and entrySettings is a deep copy now.

@chessing234
chessing234 force-pushed the fix/10969-plugin-own-entry-and-service branch from 70c62cb to 72eb616 Compare September 25, 2026 15:36
@llstrk

llstrk commented Sep 27, 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.

Outcome: This follow-up checks head 72eb616 against the earlier review and the author's reply. The PR was rebased, and its first commit is unchanged from the previously reviewed 70c62cb. The deep copy resolves the entrySettings finding. The authentication-service finding is still present. pluginServiceFor no longer returns authentication services, but the fallback moved into facade closures that other ShellRoot functions create and cache. Lock and polkit services therefore stay reachable from ShellRoot, including on a stock install with no clone.

Earlier item Status at 72eb616
Authentication services reachable from ShellRoot Still present, through other paths
entrySettings shares nested objects with host config Resolved
Note: replacement-bar widgets get no entrySettings Unchanged

Verified (isolated headless model built from verbatim head functions, stub services):

  • After a config refresh, entrySettings has no id, and a nested push no longer changes host config. A nested read-modify-write through updateEntryInline now persists. At 70c62cb it returned false.
  • shell.pluginServiceFor(...) now returns null for the lock, polkit and lock-clone ids.
  • A lock clone's own facade and its overlay's service still return its own authentication service (the 4.0.3: third-party plugins cannot read their own shell.json entry, and lock clones cannot reach their own service #10969 fix). A foreign id still returns null.
  • The PR's shell/shell.qml merges onto current quattro without conflicts, and the model gives the same results on that merge.

Authentication services are still reachable from ShellRoot

The author's reply is accurate for pluginServiceFor. The AuthServiceStore fallback now sits in the _serviceLookup and _firstPartyServiceLookup closures inside createScopedPluginShell. Their key and allowOwnService come from the arguments of public ShellRoot functions. As the earlier review showed, a plugin root without its own shell property resolves the bare name shell to ShellRoot. From there:

Probe from a plugin without its own shell property Scenario Base Head
shell.pluginServiceFor("omarchy.lock", "omarchy.lock") stock null null
shell.pluginShellFor({ id: "omarchy.lock" }).serviceFor("omarchy.lock") stock null lock service
shell.createScopedPluginShell({ id: "omarchy.lock" }, "k", true, false).serviceFor("omarchy.lock") stock null lock service
shell.pluginShellForId("user.lockclone").serviceFor("user.lockclone") lock clone null clone service
shell._pluginShellApis["user.lockclone"].serviceFor("user.lockclone") lock clone null clone service
shell.panelLoaders["user.lockclone"].item.service lock clone null clone service

shell.pluginShellFor({ id: "omarchy.polkit" }).serviceFor("omarchy.polkit") returns the polkit service in the same way. The two stock-install rows that return the service at head also returned it at 70c62cb, so 72eb616 did not introduce them. They are now the main remaining path, and they need no clone.

Impact: Unchanged from the earlier review. The lock service exposes enteredPassword/pendingPassword. Its finishUnlock() sets sessionLock.locked = false without checking authentication (shell/plugins/lock/Service.qml, from source; the call was not run). manual/32-shell-plugins.md describes authentication state as protected "by keeping those services outside the reachable host object graph", and agents/skills/shell-dev.md says "Do not expose authentication services through new third-party-facing properties."

Suggested change: Keep anything that can return an authentication service off every object reachable from ShellRoot:

  • the facade factories (pluginShellFor, createScopedPluginShell, pluginShellForId);
  • the _pluginShellApis cache;
  • panel items reachable as panelLoaders[id].item.

Handing the overlay the raw service always exposes it through panelLoaders. The earlier options still apply: keep auth-capable UI inside the service object, as omarchy.lock does, or give the overlay a narrow proxy without credential fields or unlock actions. Refusing the fallback only for ids whose installed manifest is first-party would close the stock path and leave the clone paths open. A runtime negative test from a plugin without its own shell property could assert that both shell.pluginServiceFor(authId, authId) and shell.pluginShellFor({ id: authId }).serviceFor(authId) stay null. The new assertion only checks that the text of the pluginServiceFor body does not mention AuthServiceStore.

Semantic conflict with open #12996

#12996 adds reinjectLoadedPanelShellApis(), called from every syncPluginApis(), which sets item.service = shell.serviceFor(id). The two PRs merge without a textual conflict, and both PRs' tests pass on the combination. serviceFor never returns authentication services, though. In the model, a lock clone overlay's service goes from the clone service to null after the first sync, both on head plus #12996 and on quattro plus both PRs.

Impact: This applies only if both PRs land. A lock clone overlay that reads service, the pattern from #10969, would lose it on the first plugin sync after loading. An overlay that calls shell.serviceFor(ownId) on its own facade keeps working.

Suggested change: Whichever PR lands second could have the reinjection leave service untouched, or make both injection sites resolve service the same way (subject to the authentication suggested change above).

entrySettings notes

Optional test improvement: The three new entrySettings assertions are text matches. Three mutants of pluginEntrySettings each still pass the whole test script: one returns ({}), one returns the live entry (which brings back the earlier nested-sharing bug), and one keeps id. A config-backed check could read a scoped facade's entrySettings, assert that it equals the entry without id, mutate a nested value and confirm that host config is unchanged. That would cover the lookup, the deep copy and the id removal.

Documentation: docs/omarchy-shell.md and agents/skills/shell-dev.md list what the third-party facade provides but do not mention entrySettings. A sentence on it (a JSON snapshot of the plugin's own entry, id removed, refreshed on config change) would make it discoverable. The earlier note still applies: widgets hosted by a replacement bar get their facade from pluginShellForBarEntry(), which never sets entrySettings. Their settings property still carries the entry, so this matters only if entrySettings is meant for bar widgets too. If it is, it could be set there. If not, the exception could be documented.


Review information

Test scope: Source review of head 72eb616, previously reviewed 70c62cb, the base, current quattro and open #12996. Isolated headless Quickshell 0.3.1 runs used a model built from each source's verbatim host functions, including merges onto quattro and with #12996. The model used the real plugin registry, AuthServiceStore.js, PluginShellApi.qml and lock/polkit manifests, with stub service and overlay objects. It was not the full shell. No desktop session was run, finishUnlock() was not called, and the real polkit agent was not exercised. The PR's test script passed in a sandbox, where its compositor-dependent section was skipped.

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.

@jandrusk

Copy link
Copy Markdown

Two notes from going through this again:

@omarchybot

Copy link
Copy Markdown
Collaborator

Omabot looked at this pull request at 72eb616. It has not added a class label, because the models that classified it independently gave three different answers. Claude read it as a bug fix (#10907, a regression in 4.0.3). DeepSeek V4.1 Flash read it as an enhancement, because it adds a new entrySettings property to the plugin API. GPT 6 Luna, the tiebreaker, read it as not actionable.

Part of the reason is that the pull request does two separate things: it lets third-party plugins read their own entry, and it lets lock and polkit clones reach their own authentication service. A change that fixes one thing and adds another should be two pull requests. @jandrusk's suggestion to split it would also settle this: the entrySettings half could land on its own as the fix for #10907, while the authentication-service half is reconsidered.

Because the classification is unsettled, nothing here was run on a worker and the open finding about authentication services being reachable from ShellRoot was not checked again. This now waits on the maintainer to say what kind of change it is, or on the author to split it.

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.

4.0.3: third-party plugins cannot read their own shell.json entry, and lock clones cannot reach their own service

4 participants