fix: word-boundary matching + blocked_overrides config#1
Open
rungmc357 wants to merge 1 commit into
Open
Conversation
- 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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Short blocked patterns were causing false positives due to naive substring matching. Most notably,
atwas matching insidecat, so benign commands likecat ~/.openclaw/openclaw.json | grep memory-lancedbwere blocked — leaving ClawDoc unable to diagnose or fix a broken config.Changes
Word-boundary matching for short tokens
Moved
at,nc, andsu -out of the flat substring list into a new_BLOCKED_WORD_PATTERNSlist 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_overridesconfig fieldAdded a
blocked_overrideslist toconfig.json(documented inconfig.example.json). Any pattern in this list is skipped during block checks — letting operators unblock specific patterns without editing source.Overrides are plumbed through all
is_blocked_command()call sites.