Skip to content

Gate QQBot streaming command auth [AI]#76375

Merged
pgondhi987 merged 7 commits into
openclaw:mainfrom
pgondhi987:fix/fix-553
May 4, 2026
Merged

Gate QQBot streaming command auth [AI]#76375
pgondhi987 merged 7 commits into
openclaw:mainfrom
pgondhi987:fix/fix-553

Conversation

@pgondhi987

Copy link
Copy Markdown
Contributor

Summary

  • Problem: QQBot /bot-streaming was private-chat-only but was not routed through command authorization.
  • Why it matters: The command writes persistent QQBot streaming config, so it should require the same explicit sender authorization as neighboring config-changing commands.
  • What changed: Added requireAuth: true to /bot-streaming and regression coverage for blocked wildcard access plus allowed explicit access.
  • What did NOT change (scope boundary): No docs, config schema, network behavior, or storage behavior changed beyond the command gate.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Not linked in public PR metadata.
  • This PR addresses a bug or regression

Root Cause (if applicable)

  • Root cause: /bot-streaming omitted requireAuth, so the dispatcher’s existing command authorization guard did not run before the config-writing handler.
  • Missing detection / guardrail: The command registry did not have regression coverage ensuring config-changing QQBot slash commands are auth-gated.
  • Contributing context (if known): Nearby config-changing commands already use the same dispatcher guard.

Regression Test Plan (if applicable)

  • Coverage level that should have caught this:
    • Unit test
    • Seam / integration test
    • End-to-end test
    • Existing coverage already sufficient
  • Target test or file: extensions/qqbot/src/engine/commands/slash-commands-impl.test.ts
  • Scenario the test should lock in: /bot-streaming on does not write config when allowFrom is wildcard and commandAuthorized is false; the same command still writes config for an explicitly authorized sender.
  • Why this is the smallest reliable guardrail: It exercises the registered command through the dispatcher and fake runtime without requiring QQ platform I/O.
  • Existing test that already covers this (if any): None found for this command gate.
  • If no new test is added, why not: N/A

User-visible / Behavior Changes

Unauthorized QQBot private-chat senders who can otherwise chat through open or wildcard DM policy can no longer toggle streaming with /bot-streaming. Explicitly authorized senders can still use the command.

Diagram (if applicable)

N/A

Security Impact (required)

  • New permissions/capabilities? (Yes/No) No
  • Secrets/tokens handling changed? (Yes/No) No
  • New/changed network calls? (Yes/No) No
  • Command/tool execution surface changed? (Yes/No) Yes
  • Data access scope changed? (Yes/No) No
  • If any Yes, explain risk + mitigation: The command surface is narrowed to command-authorized senders using the existing QQBot authorization guard.

Repro + Verification

Environment

  • OS: Not environment-specific
  • Runtime/container: Not environment-specific
  • Model/provider: N/A
  • Integration/channel (if any): QQBot
  • Relevant config (redacted): channels.qqbot.allowFrom wildcard or explicit sender list, with channels.qqbot.streaming disabled before command execution

Steps

  1. Register QQBot slash commands with a fake runtime config API.
  2. Dispatch /bot-streaming on from a private-chat sender with wildcard allowFrom and commandAuthorized: false.
  3. Dispatch /bot-streaming on from a private-chat sender with explicit allowFrom and commandAuthorized: true.

Expected

  • The first dispatch returns a permission response and does not call replaceConfigFile.
  • The second dispatch updates the QQBot streaming config.

Actual

  • Covered by the added regression scenarios.

Evidence

Attach at least one:

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Current evidence: Regression coverage was added for the dispatcher behavior, and targeted formatting passed for the touched files.

Human Verification (required)

What you personally verified (not just CI), and how:

  • Verified scenarios: Static review confirmed /bot-streaming is now auth-gated and the tests cover unauthorized wildcard no-write plus authorized explicit write.
  • Edge cases checked: Default account writes update both top-level QQBot streaming config and accounts.default.streaming when present.
  • What you did not verify: Full package/test commands were not run in this metadata step.

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

If a bot review conversation is addressed by this PR, resolve that conversation yourself. Do not leave bot review conversation cleanup for maintainers.

Compatibility / Migration

  • Backward compatible? (Yes/No) Yes
  • Config/env changes? (Yes/No) No
  • Migration needed? (Yes/No) No
  • If yes, exact upgrade steps: N/A

Risks and Mitigations

  • Risk: Operators relying on open or wildcard DM policy to use /bot-streaming without explicit command authorization will now receive a permission response.
    • Mitigation: Add the intended operator sender ID to the explicit QQBot allowFrom command authorization list.

@clawsweeper

clawsweeper Bot commented May 3, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

Summary
The PR gates QQBot /bot-streaming through command authorization, aligns pre-dispatch command allowlist handling with explicit non-wildcard matching, preserves private-chat gating on the framework path, and adds regression coverage.

Reproducibility: yes. from source. Current main documents /bot-streaming as an explicit non-wildcard admin command, but its registry entry lacks requireAuth and the dispatcher only applies the auth guard when that flag is present.

Next step before merge
A repair worker can add the single required changelog entry without changing the QQBot auth implementation.

Security
Cleared: The diff narrows QQBot config-writing command access and does not change dependencies, secrets, workflows, or network calls.

Review findings

  • [P3] Add the required changelog entry — extensions/qqbot/src/engine/commands/builtin/register-streaming.ts:33
Review details

Best possible solution:

Keep the latest auth hardening, add one Unreleased QQBot fix/security changelog entry, then have a maintainer review and land the PR.

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

Yes, from source. Current main documents /bot-streaming as an explicit non-wildcard admin command, but its registry entry lacks requireAuth and the dispatcher only applies the auth guard when that flag is present.

Is this the best way to solve the issue?

Yes, functionally. Reusing requireAuth, matching only explicit non-wildcard entries, preserving c2c-only framework gating, and adding regression tests is the narrow maintainable fix; the remaining gap is changelog hygiene.

Full review comments:

  • [P3] Add the required changelog entry — extensions/qqbot/src/engine/commands/builtin/register-streaming.ts:33
    This user-visible QQBot security hardening blocks wildcard/open private-chat users from toggling persisted streaming config. Repo policy requires an Unreleased changelog entry for user-facing fix/security changes, but PR head does not update CHANGELOG.md.
    Confidence: 0.92

Overall correctness: patch is correct
Overall confidence: 0.86

Acceptance criteria:

  • git diff --check
  • pnpm test extensions/qqbot/src/engine/commands/slash-commands-impl.test.ts extensions/qqbot/src/engine/commands/slash-command-handler.test.ts extensions/qqbot/src/bridge/commands/framework-registration.test.ts

What I checked:

Likely related people:

  • cxyhhhhh: Merged PR fix(qqbot): unify slash command auth, c2cOnly gating, and file delivery #73616 introduced the QQBot slash-command auth and c2cOnly registry behavior that this PR extends for /bot-streaming. (role: introduced adjacent behavior; confidence: high; commits: 15ca5e8de8a9, 3eefde498a67; files: extensions/qqbot/src/engine/commands/slash-command-auth.ts, extensions/qqbot/src/engine/commands/slash-command-handler.ts, extensions/qqbot/src/engine/commands/slash-commands.ts)
  • sliverp: Provided PR history for fix(qqbot): unify slash command auth, c2cOnly gating, and file delivery #73616 identifies this maintainer account as the merger/committer for the QQBot auth consolidation now being extended. (role: recent maintainer/merger; confidence: medium; commits: 3eefde498a67; files: extensions/qqbot/src/engine/commands/slash-command-auth.ts, extensions/qqbot/src/engine/commands/slash-command-handler.ts, extensions/qqbot/src/engine/commands/slash-commands.ts)

Remaining risk / open question:

  • The required changelog entry is still absent, so landing as-is would miss the repo's user-facing fix/security release-note policy.
  • Targeted PR-head tests were not run in this read-only review; the verdict is based on source, docs, diff, and added coverage inspection.

Codex review notes: model gpt-5.5, reasoning high; reviewed against be41b8cbc73c.

@pgondhi987

pgondhi987 commented May 4, 2026

Copy link
Copy Markdown
Contributor Author

Not applicable; changelog is handled at merge time.

Quoted comment from @clawsweeper:

Codex review: found issues before merge.

Summary
The PR adds QQBot /bot-streaming to the auth-gated command registry, propagates c2cOnly into framework command registration, adds a framework private-chat guard, and adds regression tests for wildcard-only rejection plus explicit-sender success.

Reproducibility: yes. from source. Current main documents /bot-streaming as explicit-allowlist-only but registers it without requireAuth, and the PR’s remaining mixed-wildcard bypass follows directly from resolveSlashCommandAuth passing * through to createQQBotSenderMatcher.

Next step before merge
The protected maintainer label and the security-sensitive mixed-wildcard auth finding make this explicit maintainer-handled PR review work rather than an automated repair lane.

Security
Needs attention: The diff narrows the command surface, but the mixed wildcard allowlist path leaves an admin-command authorization bypass for /bot-streaming.

Review findings

  • [P2] Strip wildcard entries before command auth — extensions/qqbot/src/engine/commands/builtin/register-streaming.ts:33
  • [P3] Add the required changelog entry — extensions/qqbot/src/engine/commands/builtin/register-streaming.ts:33
Review details

Best possible solution:

Update QQBot command authorization so requireAuth matches only explicit non-wildcard entries, add regression coverage for mixed wildcard allowlists on /bot-streaming, add the changelog entry, then let a maintainer review and land the narrow hardening.

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

Yes, from source. Current main documents /bot-streaming as explicit-allowlist-only but registers it without requireAuth, and the PR’s remaining mixed-wildcard bypass follows directly from resolveSlashCommandAuth passing * through to createQQBotSenderMatcher.

Is this the best way to solve the issue?

No, not yet. Reusing requireAuth is the right maintainable seam, but the fix is incomplete until command auth ignores wildcard entries for admin-command matching and the changelog is added.

Full review comments:

  • [P2] Strip wildcard entries before command auth — extensions/qqbot/src/engine/commands/builtin/register-streaming.ts:33
    Adding requireAuth still leaves /bot-streaming open when allowFrom mixes * with an explicit admin ID: resolveSlashCommandAuth sees an explicit entry, then createQQBotSenderMatcher accepts the wildcard for any sender. That violates the documented non-wildcard admin-command rule and leaves this config write reachable for wildcard DM users.
    Confidence: 0.9
  • [P3] Add the required changelog entry — extensions/qqbot/src/engine/commands/builtin/register-streaming.ts:33
    This changes user-visible QQBot command authorization: wildcard/open DM users who could previously toggle /bot-streaming now receive a permission response. Repo policy requires user-facing fix/security changes to include an Unreleased CHANGELOG.md entry, but the PR diff does not touch the changelog.
    Confidence: 0.92

Overall correctness: patch is incorrect
Overall confidence: 0.88

Security concerns:

  • [medium] Mixed wildcard allowlists still authorize admin commands — extensions/qqbot/src/engine/commands/slash-command-auth.ts:47
    resolveSlashCommandAuth requires some explicit entry but then passes the full list to a matcher that accepts *, so allowFrom: ["*", "ADMIN"] still authorizes any sender for requireAuth commands, including the newly gated streaming config write.
    Confidence: 0.9

What I checked:

Likely related people:

  • cxyhhhhh: The QQBot streaming command traces to commit 5ccf179a34a97b165b5d6f149abcf4190e35efcc, and the related fix(qqbot): unify slash command auth, c2cOnly gating, and file delivery #73616 slash-command auth/c2cOnly work traces to 62fb87641eca39821e54ae560e7e90b1684903a3; the provided related context credits fix(qqbot): unify slash command auth, c2cOnly gating, and file delivery #73616 to this contributor. (role: introduced behavior and adjacent QQBot command-auth contributor; confidence: high; commits: 5ccf179a34a9, 62fb87641eca; files: extensions/qqbot/src/engine/commands/builtin/register-streaming.ts, extensions/qqbot/src/engine/commands/slash-commands.ts, extensions/qqbot/src/engine/commands/slash-command-handler.ts)
  • steipete: The existing ClawSweeper review context identified steipete as a relevant maintainer for the same QQBot command registry/docs surface, and this PR carries the protected maintainer label requiring explicit maintainer handling. (role: maintainer routing candidate; confidence: medium; commits: 68359cacbf58; files: extensions/qqbot/src/engine/commands/builtin/register-streaming.ts, extensions/qqbot/src/engine/commands/slash-commands.ts, docs/channels/qqbot.md)

Remaining risk / open question:

  • The mixed wildcard plus explicit allowFrom case still leaves /bot-streaming reachable to wildcard DM users unless command auth strips wildcard entries before matching.
  • The PR still needs an Unreleased CHANGELOG.md entry for the user-visible QQBot command authorization change.
  • No targeted test command was run during this read-only review; the focused QQBot command tests should run before merge.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 31161abd40fd.

Re-review progress:

@pgondhi987
pgondhi987 merged commit 1f724bc into openclaw:main May 4, 2026
14 of 15 checks passed
lxe pushed a commit to lxe/openclaw that referenced this pull request May 6, 2026
* fix: gate QQBot streaming command

* addressing codex review

* addressing review-skill

* addressing review-skill

* addressing codex review

* addressing claude review

* docs: add changelog entry for PR merge
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 2026
* fix: gate QQBot streaming command

* addressing codex review

* addressing review-skill

* addressing review-skill

* addressing codex review

* addressing claude review

* docs: add changelog entry for PR merge
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
* fix: gate QQBot streaming command

* addressing codex review

* addressing review-skill

* addressing review-skill

* addressing codex review

* addressing claude review

* docs: add changelog entry for PR merge
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
* fix: gate QQBot streaming command

* addressing codex review

* addressing review-skill

* addressing review-skill

* addressing codex review

* addressing claude review

* docs: add changelog entry for PR merge
sablehead pushed a commit to sablehead/openclaw that referenced this pull request Jun 10, 2026
* fix: gate QQBot streaming command

* addressing codex review

* addressing review-skill

* addressing review-skill

* addressing codex review

* addressing claude review

* docs: add changelog entry for PR merge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant