fix(exec) fail close on invalid deny pattern#781
Open
afjcjsbx wants to merge 2 commits intosipeed:mainfrom
Open
fix(exec) fail close on invalid deny pattern#781afjcjsbx wants to merge 2 commits intosipeed:mainfrom
afjcjsbx wants to merge 2 commits intosipeed:mainfrom
Conversation
3 tasks
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.
📝 Description
This PR fixes a critical "Fail-Open" security vulnerability in the
ExecToolinitialization process and improves overall error handling.Previously, if a custom deny pattern provided in the configuration contained a regex syntax error, the
NewExecToolWithConfigfunction would log the error viafmt.Printfand execute acontinuestatement. This caused the system to silently discard the malformed security rule and start the agent anyway, leaving it exposed to the commands that were supposed to be blocked.Changes introduced:
NewExecToolWithConfigandNewExecToolto return(*ExecTool, error).continuestatement during regex compilation. If a security pattern fails to compile, the initialization now correctly returns an error, adopting a strict Fail-Closed security posture.NewCronToolandtoolsRegistry.Register) to properly handle and bubble up the initialization error, preventing the application from starting in an insecure state.🗣️ Type of Change
🤖 AI Code Generation
🔗 Related Issue
📚 Technical Context (Skip for Docs)
netcat) is blocked, but the underlying system is completely open due to a simple typo in a configuration file.🧪 Test Environment
Hardware: Apple Silicon (Mac M-series)
OS: macOS
Model/Provider: Generic
Channels: All
Click to view Logs/Screenshots
Scenario: An administrator attempts to block
netcatbut makes a typo in the regex (missing closing parenthesis).❌ BEFORE THIS PR: The
picoclawassistant would start up normally, ignoring the malformed pattern. The commandncornetcatwould remain executable, completely bypassing the intended security measure.✅ AFTER THIS PR:
The system adopts a Fail-Closed approach. The application halts immediately on startup, notifying the user of the broken security configuration:
☑️ Checklist