Skip to content

Respect skill tool policy in inline command dispatch - #40238

Closed
mohsindewan wants to merge 3 commits into
openclaw:mainfrom
mohsindewan:fix/skill-tool-dispatch-policy
Closed

mohsindewan wants to merge 3 commits into
openclaw:mainfrom
mohsindewan:fix/skill-tool-dispatch-policy

Conversation

@mohsindewan

Copy link
Copy Markdown

Summary

  • ensure inline command-dispatch: tool uses the same coding-tool policy filtering as normal coding sessions
  • remove the owner-only fallback tool filter in inline dispatch to avoid bypassing permission profiles
  • add regression coverage for non-owner users to confirm command-exec style tools are blocked when policy disallows them

Testing

  • pnpm -s vitest run src/auto-reply/reply/get-reply-inline-actions.skill-dispatch-policy.test.ts

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

Copy link
Copy Markdown
Contributor

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: 43588ba75f

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

@greptile-apps

greptile-apps Bot commented Mar 8, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR correctly fixes the security bypass by routing inline skill command-dispatch: tool through createOpenClawCodingTools, ensuring the full policy pipeline (profile filtering, owner-only rules, group/subagent policy, model/message-provider filtering) is applied consistently.

Core fix is correct:

  • createOpenClawCodingTools already calls applyOwnerOnlyToolPolicy internally (line 525 of pi-tools.ts), so removing the explicit call in the inline actions file is safe and not a regression.
  • The new code passes all the policy-critical parameters: senderIsOwner, config, groupId, groupChannel, spawnedBy, etc.

Test coverage gap:

  • The new tests verify dispatch outcomes (tool availability, error messages, execution) but do not assert the arguments passed to createOpenClawCodingToolsMock.
  • For a PR focused on "regression coverage for non-owner users," verifying that permission arguments are actually passed to the mock would strengthen confidence that policy filtering works as intended.

Confidence Score: 4/5

  • Safe to merge — the policy routing fix correctly closes the security bypass with proper permission enforcement.
  • The core fix is sound and securely routes inline skill tool dispatch through the full policy pipeline, ensuring non-owner users and restricted profiles are properly blocked from exec-style tools. One deduction because test assertions on mock call arguments would strengthen confidence that permission parameters are always passed correctly, preventing future regressions.
  • Test file could benefit from explicit assertions on createOpenClawCodingToolsMock call arguments to verify policy parameters are passed as expected.

Last reviewed commit: 43588ba

@mohsindewan
mohsindewan force-pushed the fix/skill-tool-dispatch-policy branch from 3aa3c20 to 0fe495f Compare March 8, 2026 21:38
@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Apr 25, 2026
@clawsweeper

clawsweeper Bot commented Apr 26, 2026 •

Copy link
Copy Markdown
Contributor

Thanks for the context here. I swept through the related work, and this is now duplicate or superseded.

Close as superseded. Current main still has the inline skill tool-policy gap, but this older PR is incomplete in the authorization path and the same remaining work is now tracked by the newer open PR #75125 plus bug report #75124.

So I’m closing this here and keeping the remaining discussion on the canonical linked item.

Review details

Best possible solution:

Close this stale branch as superseded and continue review of #75125, or an equivalent narrow replacement, while keeping #75124 open until the effective-policy fix lands.

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

Yes. A high-confidence source-level reproduction exists: current main resolves inline skill command-dispatch: tool through raw createOpenClawTools(...) plus owner-only filtering, while a restricted profile or group toolsBySender case should be evaluated through createOpenClawCodingTools(...).

Is this the best way to solve the issue?

No. Routing through createOpenClawCodingTools(...) is the right seam, but this PR is not the best current solution because it omits gateway subagent binding and full sender identity; the newer #75125 branch is the better canonical implementation candidate.

Security review:

Security review needs attention: The PR touches inline tool authorization and still omits sender identity inputs used by group-specific tool policy; the active security-hardening path should continue in #75125 or an equivalent fix.

  • [medium] Incomplete group policy context — src/auto-reply/reply/get-reply-inline-actions.ts:213
    The new policy-filtering call passes only senderId, while group tool policy can select rules using sender name, username, or E.164. Missing those inputs can bypass a sender-specific deny or fail to apply a sender-specific allow in inline skill dispatch.
    Confidence: 0.86

What I checked:

Likely related people:

  • dougvk: Local and ClawSweeper history identify feat: tool-dispatch skill commands as the commit that added the command-dispatch: tool feature and affected inline-action path. (role: introduced behavior; confidence: medium; commits: 9f280454ba87; files: src/auto-reply/reply/get-reply-inline-actions.ts, src/agents/skills/types.ts)
  • Peter Steinberger: Recent merged history on inline actions, owner-only tool gating, and scoped group tool policies intersects the authorization behavior under review. (role: recent maintainer and security-adjacent owner; confidence: high; commits: 2c1a4ddabc45, 3d7ad1cfca4d, 9cbfbd18e35e; files: src/auto-reply/reply/get-reply-inline-actions.ts, src/agents/tool-policy.ts, src/agents/pi-tools.policy.ts)
  • Takhoffman: Recent command-runtime commits preserved sender identity and target-session context in the same command tool inventory and inline dispatch area. (role: recent adjacent maintainer; confidence: medium; commits: cfae8fd1e927, c2f6ad9b3829, 1fb8a8cdff3d; files: src/auto-reply/reply/commands-system-prompt.ts, src/auto-reply/reply/get-reply-inline-actions.ts)
  • adam91holt: The per-sender group tool policy behavior involved in the missing sender identity context was introduced in a merged group-policy commit by this author. (role: group policy feature owner; confidence: medium; commits: 3b0c80ce245b; files: src/config/group-policy.ts)
  • Josh Lehman: The gateway subagent late-binding behavior affected by the missing allowGatewaySubagentBinding option was recently maintained in the plugin runtime path by this author. (role: adjacent plugin/runtime owner; confidence: medium; commits: eeb140b4f08b; files: src/agents/pi-tools.ts, src/plugins/runtime/index.ts)

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

@openclaw-barnacle openclaw-barnacle Bot removed the stale Marked as stale due to inactivity label Apr 27, 2026
@clawsweeper clawsweeper Bot closed this May 1, 2026
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