Repository navigation
Conversation
Introduce a declarative extension manifest under extensions/ so plugins can
be distributed as external npm packages and installed on demand via
'openclaw plugins install <npm-spec>'. WeCom (@wecom/wecom-openclaw-plugin)
is the first adopter.
- extensions/manifest.json + manifest.schema.json: bundled manifest of
extension entries (channel/provider/tool/hook/skill kinds), designed to
be forward-compatible with local-override and remote sources planned for
phase-2/3.
- src/plugins/extension-registry/: manifest resolver with priority
local-override > remote > bundled; bundled-source, local-override-source,
remote-source stubs; unit tests.
- src/channels/bundled-channel-catalog-read.ts: merge extension-manifest
channel entries as virtual bundled entries so they appear in
CHAT_CHANNEL_ORDER / listChatChannels() (the onboard picker seed).
Wrapped in try/catch so manifest failures never block onboard.
- src/channels/plugins/catalog.ts: add EXTENSION_MANIFEST_PRIORITY seam so
installable catalog entries for manifest-declared channels surface during
onboard ("install plugin to enable").
- src/commands/channel-setup/install-plan-progress.ts: 6-step install
progress (resolve -> download -> verify -> scan -> extract -> register)
for the onboard UX, with unit tests.
- src/channels/plugins/catalog.extension-manifest.test.ts: integration
test proving manifest-only entries appear as installable catalog
entries.
Refs #70150
🔒 Aisle Security AnalysisWe found 2 potential security issue(s) in this PR:
1. 🟠 Untrusted local override manifest path can lead to confused-deputy plugin selection
Description
If OpenClaw is ever executed in a more-privileged context (e.g., as root, a service account, via sudo, or by an automated installer) while an attacker can influence the environment variables or provide a writable/symlinked config directory, the attacker may be able to point the process at an attacker-controlled manifest and cause it to offer/install attacker-chosen extensions (confused deputy / local privilege escalation vector depending on how extensions are later fetched/executed). RecommendationHarden the override-manifest trust boundary:
Example (sketch): import os from "node:os";
function isPrivileged(): boolean {
const getuid = process.getuid?.bind(process);
const geteuid = process.geteuid?.bind(process);
return Boolean(getuid && geteuid && geteuid() === 0 || (getuid && geteuid && geteuid() !== getuid()));
}
load(ctx) {
const env = ctx.env ?? process.env;
if (isPrivileged()) {
// Ignore env-based overrides in privileged context
env = { ...env, OPENCLAW_STATE_DIR: "", OPENCLAW_CONFIG_PATH: "" } as NodeJS.ProcessEnv;
}
const configDir = resolveConfigDir(env);
const manifestPath = path.join(configDir, OVERRIDE_RELATIVE_PATH);
const st = fs.lstatSync(manifestPath);
if (st.isSymbolicLink() || (st.mode & 0o022) !== 0) return [];
// optionally: check st.uid matches expected uid
...
}This prevents attacker-controlled config paths from being used as an authority source when the process runs with elevated privileges. 2. 🟡 Terminal escape/log injection via unsanitized install progress detail rendered to CLI spinner
Description
Vulnerable code: if (event.detail) {
return `${base} — ${event.detail}`;
}
...
progress.update(formatInstallPlanLabel(event));A helper already exists ( RecommendationSanitize/normalize any untrusted text before rendering it to the terminal. Option A (local fix in this module): import { sanitizeTerminalText } from "../../terminal/safe-text.js";
export function formatInstallPlanLabel(event: InstallPlanEvent): string {
const counter = `[${event.index}/${event.total}]`;
const base = `${counter} ${event.label}`;
if (event.detail) {
return `${base} — ${sanitizeTerminalText(event.detail)}`;
}
return base;
}Option B (defense-in-depth): also sanitize inside Ensure the sanitization removes ANSI escapes and replaces Analyzed PR: #70176 at commit Last updated on: 2026-04-22T13:10:09Z |
Greptile SummaryThis PR introduces a phase-1 extension manifest system: a new Confidence Score: 5/5Safe to merge; all findings are P2 quality/design suggestions with no blocking defects. All four findings are P2: a phase-1 scoping gap (local-override excluded from sync path), silent error swallowing, an inaccurate comment, and a coarse failure-step attribution. None cause incorrect data, breakage, or security risk. The degradation behaviour is well-tested and explicitly designed to be non-blocking. src/plugins/extension-registry/index.ts (local-override excluded from sync default sources), src/commands/channel-setup/install-plan-progress.ts (comment/failure-step accuracy)
|
| * runs inside sync discovery paths). Only consults the bundled source — the | ||
| * remote/local-override sources may do IO and are opted out of the sync path | ||
| * deliberately. | ||
| * | ||
| * Phase 2 note: if remote caching moves to a fully-materialised on-disk | ||
| * cache, it can also expose a sync read and be added here. | ||
| */ | ||
| export function resolveExtensionManifestSync( | ||
| options: ResolveExtensionManifestOptions = {}, | ||
| ): ResolvedExtensionEntry[] { | ||
| const sources = options.sources ?? [createBundledManifestSource()]; |
There was a problem hiding this comment.
Local-override source is sync but excluded from the sync path
local-override-source.ts uses fs.readFileSync, so it returns ExtensionEntry[] (not a Promise). The sync guard in resolveExtensionManifestSync (if (!Array.isArray(entries))) would correctly handle it. However, the default sources list for the sync variant is [createBundledManifestSource()] only, which means any operator who creates $OPENCLAW_CONFIG_DIR/extensions/manifest.json to pin/inject extensions will have those entries silently ignored by the channel picker, since all catalog callers use the sync path.
The comment says "may do IO and are opted out… deliberately," but local-override-source.ts uses synchronous IO. If the phase-1 intent is that local overrides are not yet active, the exported createLocalOverrideManifestSource is never reachable from production code paths (only from tests), which should be documented or the factory omitted until phase 2.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/plugins/extension-registry/index.ts
Line: 107-117
Comment:
**Local-override source is sync but excluded from the sync path**
`local-override-source.ts` uses `fs.readFileSync`, so it returns `ExtensionEntry[]` (not a `Promise`). The sync guard in `resolveExtensionManifestSync` (`if (!Array.isArray(entries))`) would correctly handle it. However, the default sources list for the sync variant is `[createBundledManifestSource()]` only, which means any operator who creates `$OPENCLAW_CONFIG_DIR/extensions/manifest.json` to pin/inject extensions will have those entries silently ignored by the channel picker, since all catalog callers use the sync path.
The comment says "may do IO and are opted out… deliberately," but `local-override-source.ts` uses synchronous IO. If the phase-1 intent is that local overrides are not yet active, the exported `createLocalOverrideManifestSource` is never reachable from production code paths (only from tests), which should be documented or the factory omitted until phase 2.
How can I resolve this? If you propose a fix, please make it concise.The aliases in CHAT_CHANNEL_ALIASES are derived from listBundledChannelCatalogEntries(), which merges extensions/manifest.json as Layer 2. The test was comparing against listChannelCatalogEntries({ origin: 'bundled' }) which only reflects physically discovered plugins, so manifest-only entries (e.g. WeCom's qywx/wework aliases) appeared on the expected side but not the received side.
Use the same source as the production constant so the assertion stays meaningful and does not regress when new channel entries are declared in the manifest without a bundled package.
Refs #70150
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f4bae187d0
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if (!packageRoot) { | ||
| return []; | ||
| } | ||
| const manifestPath = path.join(packageRoot, MANIFEST_DIR_NAME, MANIFEST_FILE_NAME); |
There was a problem hiding this comment.
Resolve bundled manifest from packaged extension tree
Load path is hardcoded to ${packageRoot}/extensions/manifest.json, but installed builds resolve bundled plugins from dist/extensions (and npm packaging only ships dist/**), so this source returns [] in packaged CLIs and external manifest channels never appear in onboarding/catalog flows. This means the feature works in source checkouts but silently disappears for end users running the published package.
Useful? React with 👍 / 👎.
|
Maintainer review notes from local pass. Request changes before treating this as closing #70150. Blocking:
Other gaps vs the issue: no manifest generation/check script, no docs update, no Verification:
|
|
This is superseded by #70012.
I reviewed
Thanks for the WeCom example and the registry-layering exploration. If we want a future external registry, we should build it on top of the generalized onboarding install/catalog seams in |
feat(extensions): phase-1 extension manifest and plugin install progress
The approach adds a
manifest.jsonunderextensionto declare which external plugins are available. The entries in the manifest are loaded into the onboarding UI based on their type, and when a user selects one, it is automatically installed via NPM with progress feedback shown during the process. From an architecture perspective, the file structure also leaves room for future extensions such as remote registry support and plugin marketplace-style expansion.The PR uses
wecomas an example and has been tested. Review would be appreciated.#70150