Skip to content

fix(config): migrate bundled private-network aliases#60862

Merged
vincentkoc merged 6 commits into
mainfrom
vk/allow-private-network-migration
Apr 5, 2026
Merged

fix(config): migrate bundled private-network aliases#60862
vincentkoc merged 6 commits into
mainfrom
vk/allow-private-network-migration

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

Summary

  • make bundled channel public config canonical on network.dangerouslyAllowPrivateNetwork
  • keep allowPrivateNetwork as compat-only input via channel doctor normalization on load
  • preserve existing private-network opt-in semantics; no posture change
  • centralize shared alias handling in the plugin SDK SSRF helper and refresh generated config metadata

Channels

  • Matrix
  • Mattermost
  • BlueBubbles
  • Nextcloud Talk
  • Tlon

Verification

  • git diff --check
  • pnpm plugin-sdk:api:gen
  • pnpm config:channels:gen
  • pnpm config:docs:gen
  • pnpm plugin-sdk:api:check
  • pnpm config:channels:check
  • pnpm config:docs:check
  • pnpm build
  • direct node --import tsx smoke for helper + all five doctor adapters

Notes

  • Vitest wrapper in this worktree remained unreliable under low-disk pressure, so I did not claim a green scoped test lane I could not observe finishing.
  • Existing false / unset posture is preserved. Only explicit opt-in continues to emit private-network SSRF allowance.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: bluebubbles Channel integration: bluebubbles channel: matrix Channel integration: matrix channel: mattermost Channel integration: mattermost channel: nextcloud-talk Channel integration: nextcloud-talk channel: tlon Channel integration: tlon size: L maintainer Maintainer-authored PR size: XL and removed size: L labels Apr 4, 2026
@vincentkoc vincentkoc marked this pull request as ready for review April 4, 2026 13:10
@greptile-apps

greptile-apps Bot commented Apr 4, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR centralizes private-network opt-in semantics across five bundled channel plugins (Matrix, BlueBubbles, Mattermost, Nextcloud Talk, Tlon) by making network.dangerouslyAllowPrivateNetwork the canonical public config key and keeping the legacy flat allowPrivateNetwork key as a compat-only input that is auto-migrated on load via channel doctor normalization.

Key changes:

  • src/plugin-sdk/ssrf-policy.ts adds migrateLegacyFlatAllowPrivateNetworkAlias (migrates flat key → nested key using OR semantics to preserve the most permissive posture when both keys exist) and expands isPrivateNetworkOptInEnabled/PrivateNetworkOptInInput to recognize both key forms simultaneously.
  • src/plugin-sdk/ssrf-runtime.ts exports the new migration helpers through the public SDK surface so extensions can import them via openclaw/plugin-sdk/ssrf-runtime.
  • All five channel extensions receive new or updated ChannelDoctorAdapter.normalizeCompatibilityConfig implementations that call migrateLegacyFlatAllowPrivateNetworkAlias at both the top-level and per-account scopes.
  • Type definitions (types.ts) and config schemas (config-schema.ts) for each extension now only declare network.dangerouslyAllowPrivateNetwork; the legacy key is handled at the doctor/compat layer, not the schema layer.
  • extensions/matrix/src/matrix/config-update.tsMatrixAccountPatch.allowPrivateNetwork retains the clean patch-API name but updateMatrixAccountConfig now writes to network.dangerouslyAllowPrivateNetwork under the hood.
  • Four of the five channels (all except Mattermost) received new doctor.test.ts files verifying the migration produces the correct output for both the top-level and account-level scopes.
  • The migration is backward-compatible: existing false/unset posture is preserved, and only an explicit true opt-in continues to emit private-network SSRF allowance at runtime.

Confidence Score: 4/5

Safe to merge — the migration is backward-compatible, preserves existing private-network opt-in semantics, and the core logic is well-tested.

The implementation is consistent across all five channel adapters, the OR-based migration logic handles all realistic config combinations correctly, and isPrivateNetworkOptInEnabled correctly handles both legacy and canonical keys during the transition window. Score docked one point because the Mattermost doctor's normalizeCompatibilityConfig function has no corresponding test while all other four channels do, and the PR author noted that the Vitest lane was unreliable during authoring.

extensions/mattermost/src/doctor.ts — the only changed doctor file without a corresponding test. src/plugin-sdk/ssrf-policy.test.ts — minor gap in the conflict-case test matrix.

Prompt To Fix All With AI
This is a comment left during a code review.
Path: extensions/mattermost/src/doctor.ts
Line: 77-142

Comment:
**Missing doctor test for Mattermost**

All four other channels modified in this PR (Matrix, BlueBubbles, Nextcloud Talk, Tlon) received new or updated `doctor.test.ts` files covering the `normalizeCompatibilityConfig` migration. Mattermost's `normalizeMattermostCompatibilityConfig` function is new in this PR but has no corresponding test.

This isn't a correctness issue — the implementation mirrors the other four adapters — but it's a coverage gap that is inconsistent with the rest of the PR. A minimal smoke test like the ones added for the other channels would confirm the top-level and account-level migrations both produce the expected output (e.g., `allowPrivateNetwork: true``network.dangerouslyAllowPrivateNetwork: true`).

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: src/plugin-sdk/ssrf-policy.test.ts
Line: 134-153

Comment:
**Conflict case only tested in one direction**

The existing test covers `{ allowPrivateNetwork: true, network: { dangerouslyAllowPrivateNetwork: false } }``true` (legacy wins over new-key `false`). The symmetric case — `{ allowPrivateNetwork: false, network: { dangerouslyAllowPrivateNetwork: true } }``true` (new key wins over legacy `false`) — is not covered but is equally valid. Both branches exercise the same OR logic, and the omission is unlikely to hide a bug, but adding the reverse case would make the test table complete and the contract explicit.

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "Merge branch 'main' into vk/allow-privat..." | Re-trigger Greptile

Comment thread extensions/mattermost/src/doctor.ts
Comment thread src/plugin-sdk/ssrf-policy.test.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 393af03cc8

ℹ️ 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".

Comment thread extensions/mattermost/src/config-schema.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 92b01313d3

ℹ️ 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".

Comment thread src/plugin-sdk/ssrf-policy.ts Outdated
Comment on lines +75 to +81
if (
typeof legacyAllowPrivateNetwork === "boolean" ||
typeof currentDangerousAllowPrivateNetwork === "boolean"
) {
// Preserve current effective posture while collapsing to the canonical key.
resolvedDangerousAllowPrivateNetwork =
legacyAllowPrivateNetwork === true || currentDangerousAllowPrivateNetwork === true;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Honor explicit false when migrating conflicting network keys

When both allowPrivateNetwork and network.dangerouslyAllowPrivateNetwork are present, this migration collapses them with a boolean OR, which can silently turn a disabled config into enabled private-network access. In mixed/stale configs (for example legacy allowPrivateNetwork: false plus a leftover/new network.dangerouslyAllowPrivateNetwork: true), upgrade now rewrites to true, widening SSRF scope unexpectedly. The conflict resolution should be deterministic (prefer one source key) rather than OR-merging.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: be33869ec7

ℹ️ 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".

Comment thread src/config/legacy-migrate.test.ts
@vincentkoc vincentkoc force-pushed the vk/allow-private-network-migration branch from be33869 to 26d63b9 Compare April 5, 2026 06:27
@vincentkoc vincentkoc merged commit c863ee1 into main Apr 5, 2026
23 of 36 checks passed
@vincentkoc vincentkoc deleted the vk/allow-private-network-migration branch April 5, 2026 07:49
lovewanwan pushed a commit to lovewanwan/openclaw that referenced this pull request Apr 28, 2026
* refactor(plugin-sdk): centralize private-network opt-in semantics

* fix(config): migrate bundled private-network aliases

* fix(config): add bundled private-network doctor adapters

* fix(config): expose bundled channel migration hooks

* fix(config): prefer canonical private-network key

* test(config): refresh rebased private-network outputs
ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
* refactor(plugin-sdk): centralize private-network opt-in semantics

* fix(config): migrate bundled private-network aliases

* fix(config): add bundled private-network doctor adapters

* fix(config): expose bundled channel migration hooks

* fix(config): prefer canonical private-network key

* test(config): refresh rebased private-network outputs
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 2026
* refactor(plugin-sdk): centralize private-network opt-in semantics

* fix(config): migrate bundled private-network aliases

* fix(config): add bundled private-network doctor adapters

* fix(config): expose bundled channel migration hooks

* fix(config): prefer canonical private-network key

* test(config): refresh rebased private-network outputs
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
* refactor(plugin-sdk): centralize private-network opt-in semantics

* fix(config): migrate bundled private-network aliases

* fix(config): add bundled private-network doctor adapters

* fix(config): expose bundled channel migration hooks

* fix(config): prefer canonical private-network key

* test(config): refresh rebased private-network outputs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: bluebubbles Channel integration: bluebubbles channel: matrix Channel integration: matrix channel: mattermost Channel integration: mattermost channel: nextcloud-talk Channel integration: nextcloud-talk channel: tlon Channel integration: tlon docs Improvements or additions to documentation maintainer Maintainer-authored PR size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant