Skip to content

Harden plugin manifest scan framing and fix plugin lifecycle races - #19961

Merged
dhh merged 2 commits into
quattrofrom
audit/shell-core-plugin-security-lifecycle
Nov 24, 2026
Merged

dhh merged 2 commits into
quattrofrom
audit/shell-core-plugin-security-lifecycle

Conversation

@dhh

@dhh dhh commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Fixes an in-band delimiter injection vulnerability in PluginRegistry manifest scanning and several async plugin lifecycle races in shell.qml:

  • Length-framed manifest scanning (shell/services/PluginRegistry.qml): Previously, rescan() emitted raw manifest.json bodies delimited only by ===<kind>::<dir>=== / === EOM === text markers, allowing a crafted third-party manifest.json containing a synthetic ===firstparty::...=== line to spoof __isFirstParty = true, hijack omarchy.* IDs, and inherit trusted authentication capabilities. Framing each manifest by its exact line count (using bash builtin mapfile -t with zero extra subprocesses) prevents payload lines from ever being parsed as headers, backed by a firstPartyDir containment check, NUL-delimited first-party find traversal, and rejection of control characters, backslashes, and prototype-polluting plugin IDs.
  • Service & widget async load races (shell/shell.qml): Track in-flight loads in ensureService() and loadPluginWidget() with per-load tokens so overlapping rescans or reloads cannot instantiate duplicate services or register stale components after teardown, and destroy completed/abandoned QQmlComponent wrappers.
  • Kept-panel facade refresh (shell/shell.qml): Refresh shell, manifest, and service on panels kept across a rescan so they cannot hold a revoked/destroyed PluginShellApi after a capability profile change.
  • Avoid duplicate post-scan syncs (shell/shell.qml): On a normal rescan (pluginReloading === false), onPluginsChanged already runs _syncServices(), syncPanelEntries(), and syncPluginWidgets(), so onScanFinished now runs them only when finishing a full plugin reload.

Verified by Codex and Claude

@greptile-apps

greptile-apps Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Critical impact] The PR appears safe to merge; both previously reported lifecycle bugs are fixed.

Summary

This PR tightens manifest scanning and prevents old plugin loads from completing after removal or reload.

  • Manifest scans keep plugin data separate from scan headers.
  • Plugin loads follow the current plugin state through rescans.
  • Kept panels receive the current plugin facade after a scan.
  • Ordinary scans sync plugin lists once, while full reloads rebuild them.

Reviews (2) · Last reviewed commit: "Fail closed on empty firstPartyDir and c..." · Reviewed by Greptile

Comment thread shell/shell.qml Resolved
Comment thread shell/shell.qml Resolved
@omarchybot omarchybot added the bug Something isn't working label Nov 23, 2026
@dhh
dhh merged commit 0810fdb into quattro Nov 24, 2026
3 checks passed
@dhh
dhh deleted the audit/shell-core-plugin-security-lifecycle branch November 24, 2026 08:35
cursor Bot pushed a commit to mark-groves/omarchy that referenced this pull request Nov 24, 2026
…macom#19961)

* Harden plugin manifest scan framing and fix plugin lifecycle races

* Fail closed on empty firstPartyDir and cancel stale pending plugin loads
@emirb emirb added this to the 4.6.0 milestone Dec 1, 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants