Fix security, correctness, and docs issues in file-writing feature#6
Merged
KHAEntertainment merged 2 commits intoclaude-plugin-v2from Mar 19, 2026
Merged
Fix security, correctness, and docs issues in file-writing feature#6KHAEntertainment merged 2 commits intoclaude-plugin-v2from
KHAEntertainment merged 2 commits intoclaude-plugin-v2from
Conversation
Co-authored-by: KHAEntertainment <43256680+KHAEntertainment@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Implement file writing for OpenClaw plugin
Fix security, correctness, and docs issues in file-writing feature
Mar 19, 2026
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.
Seven issues from PR review addressed across
grok_bridge.pyandREADME.md.Security
parse_and_write_files()was writing model-supplied paths directly to disk. Added_safe_dest()usingPath.relative_to()to reject absolute paths,..segments, and any resolved path escapingoutput_dir.Correctness
write_text()returns char count, not bytes. Replaced withencode("utf-8") + write_bytes(); reported count now matches actual file size for non-ASCII content.--write-files+--outputcoexistence —--write-fileswas silently skipped when--outputwas set. Both flags now work independently.--write-filesfinds no annotated blocks, a short stderr diagnostic is emitted instead of dumping the full model response to stdout (defeating the feature's purpose).Code quality
_write_file()helper to remove duplication.Docs
Supported Patternssection were terminating outer fences; replaced with 4-space-indented blocks.XAI_API_KEYand~/.config/grok-swarm/config.json; updated to match actualget_api_key()logic (OPENCLAW_OPENROUTER_DEFAULT_KEY, all four OpenClaw auth-profile paths).📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.