openclaw - 💡(How to fix) Fix [Feature]: exec allowlist should support argument-level pattern matching, not just binary path [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#60427Fetched 2026-04-08 02:51:19
View on GitHub
Comments
0
Participants
1
Timeline
1
Reactions
0
Author
Participants
Timeline (top)
labeled ×1

Allow exec allowlist entries to match against the full command (binary + arguments), so a restricted agent can be granted access to one specific script invocation without unlocking the entire interpreter.

Root Cause

Allow exec allowlist entries to match against the full command (binary + arguments), so a restricted agent can be granted access to one specific script invocation without unlocking the entire interpreter.

Code Example

{
  "id": "...",
  "pattern": "/opt/homebrew/bin/node",
  "argsPattern": "/Users/me/.openclaw/mute_user.mjs * *",
  "description": "Allow mute_user.mjs moderation script only"
}
RAW_BUFFERClick to expand / collapse

Summary

Allow exec allowlist entries to match against the full command (binary + arguments), so a restricted agent can be granted access to one specific script invocation without unlocking the entire interpreter.

Problem to solve

Currently, exec-approvals.json allowlist entries only match against the binary path. If I want a restricted agent (e.g. a group chat agent with minimal permissions) to run one specific Node.js script for moderation, I must either:

  1. Deny exec entirely — the agent can't automate anything
  2. Allowlist the node binary — the agent can run any Node.js code

There is no middle ground. This makes it impossible to safely delegate a narrow, script-level capability to a restricted agent.

Proposed solution

Extend the allowlist entry schema with an optional argsPattern field (glob-style) that is matched against the argv following the binary:

{
  "id": "...",
  "pattern": "/opt/homebrew/bin/node",
  "argsPattern": "/Users/me/.openclaw/mute_user.mjs * *",
  "description": "Allow mute_user.mjs moderation script only"
}

An entry with argsPattern would only match if both the binary path AND the argument pattern match, providing script-level authorization.

Alternatives considered

• Wrapping the script in a standalone binary (shell wrapper or compiled executable) so the allowlist can target it directly — works but adds operational complexity and breaks auditability. • Using a webhook/HTTP endpoint instead of exec — requires running an additional local service.

Impact

• Affected: Operators running restricted agents (group chat bots, low-trust contexts) • Severity: Blocks workflow — forces a choice between "no automation" and "unsafe broad access" • Frequency: Every time a restricted agent needs to call a single trusted script • Consequence: Either capability is lost or security is compromised

Evidence/examples

Exact use case: a Telegram group agent that should only be able to call node mute_user.mjs <chat_id> <user_id> to mute abusive users — but must not be able to run arbitrary Node.js code.

Additional information

No response

extent analysis

TL;DR

Extend the exec-approvals.json allowlist entry schema with an optional argsPattern field to enable script-level authorization.

Guidance

  • Introduce an argsPattern field in the allowlist entry schema to match against the command arguments.
  • Update the allowlist entry to include the argsPattern field with a glob-style pattern that matches the desired script invocation.
  • Ensure that the argsPattern field is matched against the argv following the binary, providing script-level authorization.
  • Test the updated allowlist entry with the restricted agent to verify that it can only run the specified script.

Example

{
  "id": "...",
  "pattern": "/opt/homebrew/bin/node",
  "argsPattern": "/Users/me/.openclaw/mute_user.mjs * *",
  "description": "Allow mute_user.mjs moderation script only"
}

Notes

This solution assumes that the argsPattern field will be matched against the argv following the binary, providing script-level authorization. The exact implementation details may vary depending on the underlying system.

Recommendation

Apply workaround: Extend the exec-approvals.json allowlist entry schema with an optional argsPattern field to enable script-level authorization. This provides a more fine-grained control over the scripts that can be executed by restricted agents, addressing the current limitation.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING