Repository navigation
feat(onboarding): auto-install missing provider and channel plugins - #70012
Conversation
🔒 Aisle Security AnalysisWe found 2 potential security issue(s) in this PR:
1. 🟠 Integrity pinning bypass when npm resolution lacks `integrity` despite `expectedIntegrity`
DescriptionIntegrity verification is skipped when either
Vulnerable code: const expectedIntegrity = normalizeIntegrity(params.expectedIntegrity);
const actualIntegrity = normalizeIntegrity(params.resolution.integrity);
if (!expectedIntegrity || !actualIntegrity) {
return { proceed: true };
}RecommendationFail closed when an integrity pin is configured but the resolved artifact integrity is missing. Suggested fix:
Example: const expectedIntegrity = normalizeIntegrity(params.expectedIntegrity);
const actualIntegrity = normalizeIntegrity(params.resolution.integrity);
// If caller pinned integrity, require actual integrity to be present.
if (expectedIntegrity && !actualIntegrity) {
const payload = params.createPayload({
spec: params.spec,
expectedIntegrity,
actualIntegrity: "(missing)",
resolution: params.resolution,
});
params.warn?.(payload);
return { proceed: false, payload };
}
if (!expectedIntegrity || !actualIntegrity) return { proceed: true };
if (expectedIntegrity === actualIntegrity) return { proceed: true };
// ... drift handling as beforeAlso consider adding a unit test that asserts install aborts when 2. 🟡 Spoofable git-workspace trust check enables local plugin loading in non-git directories
Description
However,
This does not validate that the referenced Impact:
Vulnerable code: function resolveGitDirectoryMarker(dir: string): string | null {
...
const match = /^gitdir:\s*(.+)$/i.exec(content);
...
return resolveRealDirectory(path.isAbsolute(gitDir) ? gitDir : path.resolve(dir, gitDir));
}
function hasTrustedGitWorkspace(root: string): boolean {
...
for (let dir = realRoot; ; dir = path.dirname(dir)) {
if (resolveGitDirectoryMarker(dir)) {
return true;
}
...
}
}RecommendationTighten the trust decision so it cannot be satisfied by an arbitrary Recommended approaches (pick one):
import { execFileSync } from "node:child_process";
function isRealGitWorktree(dir: string): boolean {
try {
const out = execFileSync("git", ["-C", dir, "rev-parse", "--is-inside-work-tree"], {
stdio: ["ignore", "pipe", "ignore"],
encoding: "utf8",
});
return out.trim() === "true";
} catch {
return false;
}
}
Also consider limiting the search to the provided Finally, consider defaulting to npm install unless the local path is a bundled source or explicitly approved by the user with a stronger warning when outside a confirmed git worktree. Analyzed PR: #70012 at commit Last updated on: 2026-04-23T05:04:11Z |
Greptile SummaryThis PR introduces a shared Confidence Score: 5/5Safe to merge; all findings are minor style or coverage suggestions with no correctness impact. No P0 or P1 issues found. The No files require special attention.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 376d7fb6b6
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c726add2be
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a4612a057f
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
This also supersedes #70176.
I reviewed |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e89755d656
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (!installResult.installed) { | ||
| return { config: nextConfig }; | ||
| } | ||
| nextConfig = installResult.cfg; |
There was a problem hiding this comment.
Return updated config when post-install provider match fails
After a successful ensureOnboardingPluginInstalled call, this path updates nextConfig, but if provider resolution still fails afterward (for example, the installed plugin does not expose the selected auth choice at runtime), the function later returns null. The caller treats that as an unmatched choice and falls back to the original config, dropping the install/enable updates even though the plugin was already installed on disk.
Useful? React with 👍 / 👎.
| return resolveProviderInstallCatalogEntries({ | ||
| ...params, | ||
| includeUntrustedWorkspacePlugins: false, | ||
| }) | ||
| .filter((entry) => includesProviderFlowScope(entry.onboardingScopes, scope)) |
There was a problem hiding this comment.
Filter install-catalog choices that cannot be enabled
This contribution builder only filters by scope and untrusted workspace state, so it can still expose install-catalog provider choices that are blocked by global plugin disablement or denylist policy. Those selections are dead ends because applyAuthChoiceLoadedPluginProvider immediately exits when enablePluginInConfig reports the plugin cannot be enabled, so onboarding presents options that can never complete.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c68302b510
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| workspaceDir, | ||
| }); | ||
| if (!installResult.installed) { | ||
| return { config: installResult.cfg, retrySelection: true }; |
There was a problem hiding this comment.
Handle retrySelection in setup wizard auth loop
applyAuthChoiceLoadedPluginProvider now returns { retrySelection: true } when install-on-demand is skipped or fails, but src/wizard/setup.ts still treats any applyAuthChoice(...) result as final and continues onboarding instead of re-prompting for auth. This means users who pick an install-catalog provider and then decline/install-fail are pushed forward with no provider configured and no chance to choose an alternative in the same setup run (unlike configure.gateway-auth and agents.commands.add, which were updated to loop on retrySelection).
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c4d51bed44
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| function isWithinBaseDirectory(baseDir: string, targetPath: string): boolean { | ||
| const relative = path.relative(baseDir, targetPath); | ||
| return relative === "" || (!relative.startsWith(`..${path.sep}`) && relative !== ".."); |
There was a problem hiding this comment.
Reject cross-drive targets in base-directory check
isWithinBaseDirectory treats a target as inside the trusted root whenever path.relative does not start with .., but on Windows path.relative('C:\\repo', 'D:\\evil') returns an absolute-like D:\\evil string that passes this check. In that case a manifest localPath on another drive is incorrectly accepted as trusted, so onboarding can offer and enable a local plugin path outside the intended workspace/cwd boundary.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f24193ce81
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (authResult.retrySelection) { | ||
| if (authChoiceFromPrompt) { | ||
| continue; | ||
| } | ||
| break; |
There was a problem hiding this comment.
Abort fixed-choice setup when auth install asks for retry
When setup is launched with an explicit authChoice (so authChoiceFromPrompt is false), a provider install failure/skip now returns retrySelection: true, but this branch just breaks and continues the wizard instead of failing or re-prompting. In practice, openclaw setup --auth-choice <install-catalog choice> can silently finish without configuring auth if install-on-demand is declined or fails, which is a regression from the expected semantics of an explicit auth selection.
Useful? React with 👍 / 👎.
* refactor: consolidate command and cron preparation paths Keep one sub-CLI metadata/registration catalog, common cron payload updates, canonical agent migration visitors, and shared account-state projection. Trust typed internal adapters while retaining external validation, effect authority, cancellation settlement, supported migrations and path containment. Wave-5 y10: BELOW-500, 353 net production lines removed (+440/-793 in 19 files). Branch-only handoff for the coordinator's bundle; no standalone PR. Best-effort tradeoffs accepted: - Cron mid-setup reload recovery (#146582): synthetic retirement, no human incident. Setup may fail; the next invocation refreshes the cache. - Recursive shared preparation retry (#102494/#138337): synthetic concurrent callers; production serializes same-job work. Duplicate direct callers may share cancellation. Failed-owner eviction preserves the next sequential run. - Progress publication generation (#143621): synthetic held update/reset. Presentation dedupe may briefly be stale until a subsequent render/reset. - Doctor adapter schema mirror (#69919): malformed synthetic hooks. Invalid executable adapters fail visibly; missing-hook fallbacks and config checks stay. - Setup adapter schema mirror (#165492): typed internal union. Invalid internal adapters fail when used; both supported wizard forms remain. - Injected process schema mirror (#84381): malformed injection was not human SIGTERM report #71710. Invalid adapters fail registration; cancellation stays. - Loaded registry row revalidation/copy (#114942/#158830/#114476): rows already admitted/normalized. Corrupt trusted rows can fail; first-wins authority stays. - Custom compatibility duplicate check (#14223): all callers parse/type it. Hand-crafted invalid JS uses the default branch; external flags still reject it. - Log probe identity matching (#88159, superseded by #168587): abort now joins the sole probe, so replacement cannot race its result. Recovery/settlement stay. - Whole-config deep copy (#71218): no detached-copy incident. Structural copy updates agents/defaults; unrelated future mutation must respect config ownership. - Repeated plugin-root probes (#70012): no disappearing-root incident. Resolve roots once; root replacement can fail discovery. Symlink containment stays. - Second payload getter read (#135319): synthetic review/corpus, not a human report. Ordinary decoded records are read once; stateful accessors may differ. Proof: fresh independent review clean; core types, targeted lint/format, runtime and static cycles, assertion/line-cap ratchets, and suppression suite passed. Focused CLI cohort: 8 files / 41 tests passed. Earlier unchanged account/setup and cold-import checks passed. Cron and commands cohorts were interrupted after partial results; complete owner tests, payload merging, test-graph types, broad check-changed and build/smoke remain unproved at commit preparation. Unattributed local 120-second timeouts retained: two root-command-descriptions catalog cases and agent-via-gateway's Gateway attempt-budget case. No timeout, retry, skip or kept-behavior expectation changes. Env-name budget mismatch (455 vs 454) also exists at original HEAD and pinned main 7dccff5. All runtime proof used isolated HOME/OpenClaw/XDG state; Phase E untouched. * refactor: consolidate cron payload and lazy CLI paths Share daemon and cron method forwarding through the existing lazy binder, remove the cron CLI reexport shim, and consolidate normalization and merge handling without changing public fields, explicit clears, or effect authority. Remove the obsolete bundled discovery reentry mechanism and impossible Doctor issue helper. The full lane now removes 475 net production lines. Best-effort tradeoffs accepted: - Unknown Doctor issue variants supplied by hand-crafted JavaScript return the invalid value rather than a custom error. Typed local producers and exhaustive switches remain; reporting feature #95979 cites no human unknown-kind incident. - Synchronous bundled-module self-discovery may fail through the existing loader diagnostic instead of returning empty inventory. Commit 65f18d6 only pins injected Jiti reentry, not a human incident; ordinary caches remain. - Cron defaults trust staggerMs normalized earlier in the same synchronous call. No await or mutation boundary intervenes; externally supplied invalid values remain rejected by the normalizer. * fix(channels): retain replacement preview deduplication Withdraw the progress compositor generation removal after the Mattermost retiring-publication case failed CI and bounded serial head/base replays remained inconclusive under load. Restore that file exactly to the branch base and keep all Mattermost tests unchanged, following the campaign fallback. Prune the single obsolete mock-export allowance left by the removed bundled discovery reentry fixture. The local mock ratchet passes with 9586 factories. The remaining lane reduction is 471 net production lines across 25 paths.
…#173036) * refactor: consolidate command and cron preparation paths Keep one sub-CLI metadata/registration catalog, common cron payload updates, canonical agent migration visitors, and shared account-state projection. Trust typed internal adapters while retaining external validation, effect authority, cancellation settlement, supported migrations and path containment. Wave-5 y10: BELOW-500, 353 net production lines removed (+440/-793 in 19 files). Branch-only handoff for the coordinator's bundle; no standalone PR. Best-effort tradeoffs accepted: - Cron mid-setup reload recovery (openclaw#146582): synthetic retirement, no human incident. Setup may fail; the next invocation refreshes the cache. - Recursive shared preparation retry (openclaw#102494/openclaw#138337): synthetic concurrent callers; production serializes same-job work. Duplicate direct callers may share cancellation. Failed-owner eviction preserves the next sequential run. - Progress publication generation (openclaw#143621): synthetic held update/reset. Presentation dedupe may briefly be stale until a subsequent render/reset. - Doctor adapter schema mirror (openclaw#69919): malformed synthetic hooks. Invalid executable adapters fail visibly; missing-hook fallbacks and config checks stay. - Setup adapter schema mirror (openclaw#165492): typed internal union. Invalid internal adapters fail when used; both supported wizard forms remain. - Injected process schema mirror (openclaw#84381): malformed injection was not human SIGTERM report openclaw#71710. Invalid adapters fail registration; cancellation stays. - Loaded registry row revalidation/copy (openclaw#114942/openclaw#158830/openclaw#114476): rows already admitted/normalized. Corrupt trusted rows can fail; first-wins authority stays. - Custom compatibility duplicate check (openclaw#14223): all callers parse/type it. Hand-crafted invalid JS uses the default branch; external flags still reject it. - Log probe identity matching (openclaw#88159, superseded by openclaw#168587): abort now joins the sole probe, so replacement cannot race its result. Recovery/settlement stay. - Whole-config deep copy (openclaw#71218): no detached-copy incident. Structural copy updates agents/defaults; unrelated future mutation must respect config ownership. - Repeated plugin-root probes (openclaw#70012): no disappearing-root incident. Resolve roots once; root replacement can fail discovery. Symlink containment stays. - Second payload getter read (openclaw#135319): synthetic review/corpus, not a human report. Ordinary decoded records are read once; stateful accessors may differ. Proof: fresh independent review clean; core types, targeted lint/format, runtime and static cycles, assertion/line-cap ratchets, and suppression suite passed. Focused CLI cohort: 8 files / 41 tests passed. Earlier unchanged account/setup and cold-import checks passed. Cron and commands cohorts were interrupted after partial results; complete owner tests, payload merging, test-graph types, broad check-changed and build/smoke remain unproved at commit preparation. Unattributed local 120-second timeouts retained: two root-command-descriptions catalog cases and agent-via-gateway's Gateway attempt-budget case. No timeout, retry, skip or kept-behavior expectation changes. Env-name budget mismatch (455 vs 454) also exists at original HEAD and pinned main 89f8219. All runtime proof used isolated HOME/OpenClaw/XDG state; Phase E untouched. * refactor: consolidate cron payload and lazy CLI paths Share daemon and cron method forwarding through the existing lazy binder, remove the cron CLI reexport shim, and consolidate normalization and merge handling without changing public fields, explicit clears, or effect authority. Remove the obsolete bundled discovery reentry mechanism and impossible Doctor issue helper. The full lane now removes 475 net production lines. Best-effort tradeoffs accepted: - Unknown Doctor issue variants supplied by hand-crafted JavaScript return the invalid value rather than a custom error. Typed local producers and exhaustive switches remain; reporting feature openclaw#95979 cites no human unknown-kind incident. - Synchronous bundled-module self-discovery may fail through the existing loader diagnostic instead of returning empty inventory. Commit ca10460 only pins injected Jiti reentry, not a human incident; ordinary caches remain. - Cron defaults trust staggerMs normalized earlier in the same synchronous call. No await or mutation boundary intervenes; externally supplied invalid values remain rejected by the normalizer. * fix(channels): retain replacement preview deduplication Withdraw the progress compositor generation removal after the Mattermost retiring-publication case failed CI and bounded serial head/base replays remained inconclusive under load. Restore that file exactly to the branch base and keep all Mattermost tests unchanged, following the campaign fallback. Prune the single obsolete mock-export allowance left by the removed bundled discovery reentry fixture. The local mock ratchet passes with 9586 factories. The remaining lane reduction is 471 net production lines across 25 paths.
summary
package.json#openclaw.installcontrols how onboarding fetches the pluginvalidation
pnpm test src/plugins/provider-install-catalog.test.ts src/flows/provider-flow.test.ts src/commands/auth-choice.apply.plugin-provider.test.ts src/flows/channel-setup.test.ts src/commands/channels.add.test.ts src/cli/channel-auth.test.tspnpm test src/plugins/provider-install-catalog.test.ts src/flows/provider-flow.test.ts src/commands/auth-choice.apply.plugin-provider.test.tspnpm format:checkpnpm check:changedsrc/docs/clawhub-plugin-docs.test.tssrc/gateway/reconnect-gating.test.tssrc/i18n/registry.test.tssrc/ui-app-settings.agents-files-refresh.test.tsnotes
openclaw.plugin.json