fix(core): ignore project shell hooks#48
Open
BunsDev wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR hardens settings merging in claurst-core by preventing repository-scoped (project-local) settings from registering shell hooks that could execute commands in response to model/provider events, while preserving trusted global settings behavior.
Changes:
- Drop project-provided hook registrations by clearing
config.hooksduringSettings::sanitize_project_settings. - Extend the existing settings-merge unit test to include both global and project
PreToolUsehooks and assert only the global hook survives the merge.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Motivation
Description
config.hooksinSettings::sanitize_project_settingsso project-provided hooks are dropped before merging into global settings.project_settings_do_not_merge_mcp_serversunit test to include a trusted globalPreToolUsehook and a project-localPreToolUsehook, then assert that only the global hook remains after merge.src-rust/crates/core/src/lib.rs(settings sanitization and test fixture); no behavioral changes to hook execution logic.Testing
cargo test -p claurst-core config::tests::project_settings_do_not_merge_mcp_servers -- --exact, and the test passed.cargo check -p claurst-core, which succeeded.cargo check --workspacewas attempted but blocked by a missing system dependency (alsa.pc) required byalsa-sysin this environment.cargo fmt --all --checkandcargo clippy -p claurst-core --all-targets -- -D warningswere not completed due to unrelated repo-wide formatting and clippy findings outside the scope of this patch.Codex Task