Skip to content

fix: word-boundary matching + blocked_overrides config#1

Open
rungmc357 wants to merge 1 commit into
mainfrom
fix/blocked-command-false-positives
Open

fix: word-boundary matching + blocked_overrides config#1
rungmc357 wants to merge 1 commit into
mainfrom
fix/blocked-command-false-positives

Conversation

@rungmc357

Copy link
Copy Markdown
Owner

Problem

Short blocked patterns were causing false positives due to naive substring matching. Most notably, at was matching inside cat, so benign commands like cat ~/.openclaw/openclaw.json | grep memory-lancedb were blocked — leaving ClawDoc unable to diagnose or fix a broken config.

Changes

Word-boundary matching for short tokens
Moved at , nc , and su - out of the flat substring list into a new _BLOCKED_WORD_PATTERNS list that uses regex word-boundary checks. These now only fire when the token appears as a standalone command, not as part of another word.

blocked_overrides config field
Added a blocked_overrides list to config.json (documented in config.example.json). Any pattern in this list is skipped during block checks — letting operators unblock specific patterns without editing source.

"blocked_overrides": ["ssh ", "rsync "]

Overrides are plumbed through all is_blocked_command() call sites.

-  was matching inside 'cat', blocking benign reads like
  `cat ~/.openclaw/openclaw.json`. Move short ambiguous tokens
  (at, nc, su -) to a word-boundary regex check so they only
  fire when the token appears as a standalone command.

- Add `blocked_overrides` list to config (and config.example.json).
  Any pattern in this list is skipped during block checks, allowing
  operators to unblock specific patterns without touching source.

- Pass `blocked_overrides` through parse_ai_response() and all
  is_blocked_command() call sites (watchdog + message handler).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant