Skip to content

fix(qqbot): limit channel API targets to configured groups [AI] - #101765

Merged
pgondhi987 merged 6 commits into
openclaw:mainfrom
mmaps:maintenance/update-20260707-153158-b96650
Jul 10, 2026
Merged

pgondhi987 merged 6 commits into
openclaw:mainfrom
mmaps:maintenance/update-20260707-153158-b96650

Conversation

@mmaps

@mmaps mmaps commented Jul 7, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where QQBot channel API tool calls could request QQ guild or channel resources without applying the operator-configured QQBot group scope.

Why This Change Was Made

The QQBot channel API executor now receives the active OpenClaw config and account id from tool registration, classifies guild/channel targets from the requested API path, and checks those targets with the existing QQBot group policy resolver before making the outbound QQ API request. Scoped configurations deny broad guild listing and out-of-scope guild/channel paths before fetch; wildcard group scope and unscoped configurations keep the existing behavior.

AI-assisted: yes.

User Impact

Operators who configure QQBot group scope get the same target boundary on the raw QQ channel API tool. Existing unscoped or wildcard-scoped setups continue to use the channel API proxy normally.

Evidence

  • git diff --check
  • ./node_modules/.bin/oxfmt --write --threads=1 extensions/qqbot/src/engine/tools/channel-api.ts extensions/qqbot/src/engine/tools/channel-api.test.ts extensions/qqbot/src/bridge/tools/channel.ts
  • node scripts/run-vitest.mjs extensions/qqbot/src/engine/tools/channel-api.test.ts (14 tests passed)

Proof gap: remote Testbox/Crabbox validation was not available in this workspace because the Crabbox and Blacksmith CLIs were not installed; the focused local fallback above passed.

  • Runtime proof (credentialless, no secrets): direct executor probe with a redacted invalid token returned local scoped denial for groups: { G1: {} } on /users/@me/guilds; wildcard and unscoped probes reached the QQ endpoint and returned upstream token not exist or expire with status 500.

@liuhao1024

Copy link
Copy Markdown
Contributor

外部 feat PR,根据项目贡献策略不接受

@clawsweeper

clawsweeper Bot commented Jul 7, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 9, 2026, 11:53 AM ET / 15:53 UTC.

Summary
The PR passes QQBot config/account context into qqbot_channel_api, denies raw guild/channel API targets when QQBot groups are scoped, and adds focused executor tests.

PR surface: Source +77, Tests +110. Total +187 across 3 files.

Reproducibility: yes. Current main passes only accessToken into executeChannelApi, so configured QQBot group scope is not checked before the raw QQ API fetch path; the posted credentialless executor probe supports the runtime behavior.

Review metrics: 1 noteworthy metric.

  • Config-derived API gate: 1 added. The PR changes raw QQ channel API behavior based on existing channels.qqbot.groups, so maintainers need to notice upgrade behavior before merge.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🐚 platinum hermit
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] Get QQBot owner approval for the fail-closed scoped raw API behavior before merge.

Risk before merge

  • [P1] Existing scoped QQBot operators can lose raw guild/channel API access unless they switch to wildcard or unscoped QQBot group configuration.
  • [P1] The PR changes authorization behavior for an authenticated QQ API proxy, so green tests do not settle whether this is the intended permanent security boundary.

Maintainer options:

  1. Confirm fail-closed QQBot policy (recommended)
    Have a QQBot owner approve that narrowed group configs disable raw guild/channel API calls, then merge with the posted runtime proof.
  2. Add a target-scope contract
    Require a separate guild/channel allowlist with docs and compatibility tests before changing scoped raw API behavior.
  3. Pause as direction mismatch
    If maintainers do not want external PRs changing this QQBot boundary, pause or close this PR and ask for an owner-led design.

Next step before merge

  • [P2] The remaining action is QQBot owner/security-boundary approval, not a concrete code repair for automation.

Maintainer decision needed

  • Question: Should qqbot_channel_api fail closed for raw QQ guild/channel API paths whenever QQBot group scope is narrowed, unless wildcard or unscoped policy is configured?
  • Rationale: The patch is mechanically sound, but the permanent behavior is both an authorization boundary and an upgrade-compatibility choice for an authenticated QQ API proxy.
  • Likely owner: yuehuali — They authored the original QQBot channel extension and raw channel-management surface affected by this boundary.
  • Options:
    • Approve fail-closed scoped raw API (recommended): Keep this PR's behavior and merge after QQBot owner confirmation because scoped group configs intentionally disable broad raw guild/channel paths.
    • Require target-scope design: Pause this PR and design a dedicated guild/channel target allowlist if maintainers want scoped raw API access instead of a blanket block.
    • Decline this boundary change: Leave raw channel API behavior unchanged and track any broader QQBot API security design separately.

Security
Cleared: No concrete supply-chain or patch security defect was found; the diff narrows an authenticated QQ API proxy boundary but still needs owner approval for the intended policy.

Review details

Best possible solution:

Merge only after a QQBot owner confirms that narrowed group configs should disable raw guild/channel API paths rather than requiring a separate guild/channel target allowlist.

Do we have a high-confidence way to reproduce the issue?

Yes. Current main passes only accessToken into executeChannelApi, so configured QQBot group scope is not checked before the raw QQ API fetch path; the posted credentialless executor probe supports the runtime behavior.

Is this the best way to solve the issue?

Yes conditionally. The latest fail-closed scoped behavior is a narrow mitigation that avoids treating QQ group OpenIDs as guild/channel IDs, but it is the best fix only if maintainers approve that compatibility and security boundary.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against ef53c20497e1.

Label changes

Label justifications:

  • P2: This is normal-priority QQBot security and compatibility hardening with limited plugin blast radius but real merge-readiness requirements.
  • merge-risk: 🚨 compatibility: Existing scoped QQBot setups can lose raw guild/channel API access unless wildcard or unscoped group configuration is used.
  • merge-risk: 🚨 security-boundary: The PR changes authorization behavior for an authenticated QQ API proxy and needs explicit boundary approval.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR includes after-fix live output from a credentialless executor probe showing local scoped denial and wildcard/unscoped requests reaching the real QQ endpoint with redacted invalid-token failure.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR includes after-fix live output from a credentialless executor probe showing local scoped denial and wildcard/unscoped requests reaching the real QQ endpoint with redacted invalid-token failure.
Evidence reviewed

PR surface:

Source +77, Tests +110. Total +187 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 2 78 1 +77
Tests 1 110 0 +110
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 188 1 +187

What I checked:

Likely related people:

  • yuehuali: Authored the initial QQBot channel extension that included the original channel-management tool surface. (role: original feature author; confidence: high; commits: 7902ccbd4344; files: extensions/qqbot/src/tools/channel.ts, extensions/qqbot/skills/qqbot-channel/SKILL.md, extensions/qqbot/src/channel.ts)
  • sliverp: Opened and carried the merged QQBot channel PR that brought the plugin into the bundled channel tree. (role: original PR owner and QQBot contributor; confidence: medium; commits: bf6f506dfae6; files: extensions/qqbot/src/tools/channel.ts, extensions/qqbot/openclaw.plugin.json, extensions/qqbot/src/types.ts)
  • Peter Steinberger: Authored scoped group-policy and fail-closed allowlist work that defines the shared policy helper this PR uses. (role: group-policy area contributor; confidence: medium; commits: 9cbfbd18e35e, 0932adf361b1; files: src/config/group-policy.ts)
  • Vincent Koc: Recently touched the exact QQBot bridge and channel API files during release/plugin-SDK stabilization work. (role: recent exact-file contributor; confidence: medium; commits: e085fa1a3ffd; files: extensions/qqbot/src/bridge/tools/channel.ts, extensions/qqbot/src/engine/tools/channel-api.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
Review history (6 earlier review cycles)
  • reviewed 2026-07-07T15:58:43.450Z sha 7c0f8aa :: needs real behavior proof before merge. :: [P1] Do not match guild/channel IDs against QQ group OpenIDs
  • reviewed 2026-07-07T16:07:34.682Z sha 7c0f8aa :: needs real behavior proof before merge. :: [P1] Do not match guild/channel IDs against QQ group OpenIDs
  • reviewed 2026-07-07T16:32:54.643Z sha df398cc :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-07T18:42:45.910Z sha df398cc :: needs maintainer review before merge. :: none
  • reviewed 2026-07-08T13:27:22.647Z sha 26e46cd :: needs maintainer review before merge. :: none
  • reviewed 2026-07-08T13:40:30.376Z sha 26e46cd :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. labels Jul 7, 2026
@mmaps

mmaps commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

Verification before merge:

Behavior addressed: QQBot raw channel API calls now apply the configured QQBot group scope before any guild/channel API request is built or sent.
Real environment tested: local checkout, credentialless runtime probe against the real executor and QQ endpoint behavior, GitHub Actions PR checks.
Exact steps or commands run after this patch:

  • ./node_modules/.bin/oxfmt --write --threads=1 extensions/qqbot/src/engine/tools/channel-api.ts extensions/qqbot/src/engine/tools/channel-api.test.ts
  • git diff --check
  • node scripts/run-vitest.mjs extensions/qqbot/src/engine/tools/channel-api.test.ts
  • node_modules/.bin/tsx -e <direct executeChannelApi scoped/wildcard/unscoped probe with a redacted invalid token>
  • ghsa_dry_run: passed
  • ghsa_real_gate: passed
    Evidence after fix:
  • Focused unit shard passed: 1 file, 14 tests.
  • Runtime probe showed scoped groups: { G1: {} } returned local denial for /users/@me/guilds; wildcard and unscoped probes reached the QQ endpoint and failed only on redacted invalid-token auth status.
  • Review gate passed: Trail of Bits differential review found no blocker/important findings; autoreview reported no accepted/actionable findings.
  • CI passed at head df398cce9a7eb120bcdfe7ed859eed631c29d045: OpenGrep precise scan, CI preflight, security-fast, channel-runtime-boundary, dependency guard, security-sensitive guard, and runner-admission.
    Observed result after fix: scoped QQBot group configs fail closed for raw guild/channel API targets before outbound QQ requests; wildcard and unscoped configurations keep the previous broad proxy behavior.
    What was not tested: no authenticated live QQBot account was available in this session; Testbox/Crabbox CLIs were unavailable, so focused validation used the local runner fallback.

Regression Risk:
Medium. The affected boundary is QQBot raw channel API behavior under scoped non-wildcard channels.qqbot.groups; existing scoped users may lose raw guild/channel API access unless they use wildcard/unscoped config. Tool schema, config keys, defaults, and serialized data are unchanged.

Best fix verdict:
Acceptable conservative mitigation, provided maintainers want scoped QQBot group configs to disable raw guild/channel API access unless explicitly wildcard/unscoped. A granular guild/channel target allowlist would be a separate product contract and should not be folded into this PR without owner direction.

User behavior change:
Before, the raw QQBot channel API tool could still use caller-supplied guild/channel paths when QQBot groups were narrowed. After, narrowed groups block those raw paths locally; wildcard and unscoped setups continue to work as before.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 7, 2026
@pgondhi987
pgondhi987 merged commit 56e97da into openclaw:main Jul 10, 2026
90 checks passed
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 11, 2026
…claw#101765)

* fix(qqbot): scope channel API targets to configured groups

* fix(qqbot): fail closed scoped channel API resources

---------

Co-authored-by: Pavan Kumar Gondhi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: qqbot merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants